Skip to content

Commit c336a5c

Browse files
committed
fix: inline processing status and avoid SW supabase route
1 parent 1120e32 commit c336a5c

File tree

2 files changed

+39
-48
lines changed

2 files changed

+39
-48
lines changed

src/components/DashboardViews/DocumentsView.tsx

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -377,49 +377,6 @@ export default function DocumentsView({ isDark = true }: { isDark?: boolean }) {
377377
"lg:col-span-12 relative rounded-xl border p-6 transition-all duration-200",
378378
isDark ? "bg-white/5 border-white/10" : "bg-white border-gray-200 shadow-sm"
379379
)}>
380-
{/* Processing Progress Overlay */}
381-
{processingProgress && processingProgress.stage !== 'done' && processingProgress.stage !== 'error' && (
382-
<div className="absolute inset-0 rounded-xl bg-black/50 backdrop-blur-sm flex items-center justify-center z-10">
383-
<div className="flex flex-col items-center gap-3 text-center px-6">
384-
<Loader2 className="w-8 h-8 text-[#FFB286] animate-spin" />
385-
<p className="text-white font-medium text-sm">{processingProgress.message}</p>
386-
{processingProgress.total > 1 && ( // Only show progress bar for multi-step processes if applicable
387-
<div className="w-48">
388-
<div className={cn("h-1.5 rounded-full overflow-hidden", isDark ? "bg-white/10" : "bg-gray-200")}>
389-
<div
390-
className="h-full bg-gradient-to-r from-[#FF8A5B] via-[#FF9E6C] to-[#FFB286] rounded-full transition-all duration-300"
391-
style={{ width: `${(processingProgress.current / processingProgress.total) * 100}%` }}
392-
/>
393-
</div>
394-
<p className="text-white/60 text-xs mt-1.5">
395-
{processingProgress.current} / {processingProgress.total}
396-
</p>
397-
</div>
398-
)}
399-
</div>
400-
</div>
401-
)}
402-
403-
{/* Success overlay */}
404-
{processingProgress?.stage === 'done' && (
405-
<div className="absolute inset-0 rounded-xl bg-[#FF8A5B]/10 backdrop-blur-sm flex items-center justify-center z-10">
406-
<div className="flex items-center gap-2 text-[#FFB286]">
407-
<CheckCircle className="w-6 h-6" />
408-
<span className="font-medium text-sm">{processingProgress.message}</span>
409-
</div>
410-
</div>
411-
)}
412-
413-
{/* Error overlay */}
414-
{processingProgress?.stage === 'error' && (
415-
<div className="absolute inset-0 rounded-xl bg-red-500/10 backdrop-blur-sm flex items-center justify-center z-10">
416-
<div className="flex items-center gap-2 text-red-400">
417-
<AlertCircle className="w-6 h-6" />
418-
<span className="font-medium text-sm">{processingProgress.message}</span>
419-
</div>
420-
</div>
421-
)}
422-
423380
<div className="flex flex-col gap-6">
424381
{/* Tabs */}
425382
<div className="flex items-center gap-1 p-1 bg-black/20 rounded-lg w-fit">
@@ -445,6 +402,45 @@ export default function DocumentsView({ isDark = true }: { isDark?: boolean }) {
445402
</button>
446403
</div>
447404

405+
{processingProgress && (
406+
<div className={cn(
407+
"rounded-lg border px-4 py-3 flex items-start gap-3",
408+
processingProgress.stage === 'error'
409+
? "border-red-500/30 bg-red-500/10 text-red-300"
410+
: processingProgress.stage === 'done'
411+
? "border-[#FF8A5B]/30 bg-[#FF8A5B]/10 text-[#FFB286]"
412+
: isDark
413+
? "border-white/10 bg-black/20 text-white/80"
414+
: "border-gray-200 bg-gray-50 text-gray-700"
415+
)}>
416+
<div className="mt-0.5">
417+
{processingProgress.stage === 'error' ? (
418+
<AlertCircle className="w-4 h-4" />
419+
) : processingProgress.stage === 'done' ? (
420+
<CheckCircle className="w-4 h-4" />
421+
) : (
422+
<Loader2 className="w-4 h-4 animate-spin" />
423+
)}
424+
</div>
425+
<div className="flex-1">
426+
<p className="text-xs font-medium">{processingProgress.message}</p>
427+
{processingProgress.total > 1 && (
428+
<div className="mt-2">
429+
<div className={cn("h-1.5 rounded-full overflow-hidden", isDark ? "bg-white/10" : "bg-gray-200")}>
430+
<div
431+
className="h-full bg-gradient-to-r from-[#FF8A5B] via-[#FF9E6C] to-[#FFB286] rounded-full transition-all duration-300"
432+
style={{ width: `${(processingProgress.current / processingProgress.total) * 100}%` }}
433+
/>
434+
</div>
435+
<p className={cn("text-[10px] mt-1", isDark ? "text-white/50" : "text-gray-500")}>
436+
{processingProgress.current} / {processingProgress.total}
437+
</p>
438+
</div>
439+
)}
440+
</div>
441+
</div>
442+
)}
443+
448444
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
449445
<div className="space-y-4">
450446
<div>

vite.config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ export default defineConfig({
3434
// Prevent the service worker from handling auth callback routes
3535
navigateFallbackDenylist: [/^\/auth\//, /^\/api\//],
3636
runtimeCaching: [
37-
{
38-
// NEVER cache Supabase API calls — always go to network
39-
urlPattern: /^https:\/\/.*\.supabase\.co\/.*/i,
40-
handler: 'NetworkOnly',
41-
},
4237
{
4338
// HTML pages: always fetch from network first, fall back to cache only if offline
4439
urlPattern: ({ request }) => request.mode === 'navigate',

0 commit comments

Comments
 (0)