Dashboard loader fetches /api/documents/incomplete?size=5 plus the existing /incomplete-count and surfaces both via data; +page.svelte renders EnrichmentBlock with the top 5 docs, the total count, and the bannerCount state bound to DropZone's onUploadComplete callback (issue #296). The block returns null when there is nothing to show, so dashboards without pending uploads stay uncluttered. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
67 lines
2.1 KiB
Svelte
67 lines
2.1 KiB
Svelte
<script lang="ts">
|
|
import DropZone from './DropZone.svelte';
|
|
import DashboardResumeStrip from '$lib/components/DashboardResumeStrip.svelte';
|
|
import MissionControlStrip from '$lib/components/MissionControlStrip.svelte';
|
|
import DashboardFamilyPulse from '$lib/components/DashboardFamilyPulse.svelte';
|
|
import DashboardActivityFeed from '$lib/components/DashboardActivityFeed.svelte';
|
|
import EnrichmentBlock from '$lib/components/EnrichmentBlock.svelte';
|
|
import { m } from '$lib/paraglide/messages.js';
|
|
|
|
let { data } = $props();
|
|
|
|
let bannerCount = $state(0);
|
|
|
|
const greetingText = $derived.by(() => {
|
|
const name = data?.user?.firstName ?? '';
|
|
const h = new Date().getHours();
|
|
if (h < 12) return m.greeting_morning({ name });
|
|
if (h < 18) return m.greeting_day({ name });
|
|
return m.greeting_evening({ name });
|
|
});
|
|
</script>
|
|
|
|
<svelte:head>
|
|
<title>{m.page_title_home()}</title>
|
|
</svelte:head>
|
|
|
|
<main class="mx-auto max-w-7xl px-4 py-8 font-sans sm:px-6 lg:px-8">
|
|
{#if data?.user}
|
|
<div class="mb-6">
|
|
<h1 class="font-serif text-[2rem] text-ink">{greetingText}</h1>
|
|
</div>
|
|
{/if}
|
|
|
|
<div class="grid grid-cols-1 gap-5 lg:grid-cols-[1fr_320px] lg:items-start">
|
|
<div class="flex flex-col gap-5">
|
|
<DashboardResumeStrip resumeDoc={data.resumeDoc ?? null} />
|
|
|
|
<EnrichmentBlock
|
|
topDocs={data.incompleteDocs ?? []}
|
|
totalCount={data.incompleteTotal ?? 0}
|
|
bannerCount={bannerCount}
|
|
onBannerClose={() => (bannerCount = 0)}
|
|
/>
|
|
|
|
<section aria-label={m.dashboard_mission_caption()}>
|
|
<h2 class="mb-3 font-sans text-xs font-bold tracking-widest text-ink-3 uppercase">
|
|
{m.dashboard_mission_caption()}
|
|
</h2>
|
|
<MissionControlStrip
|
|
segmentationDocs={data.segmentationDocs ?? []}
|
|
transcriptionDocs={data.transcriptionDocs ?? []}
|
|
readyDocs={data.readyDocs ?? []}
|
|
weeklyStats={data.weeklyStats ?? null}
|
|
/>
|
|
</section>
|
|
</div>
|
|
|
|
<div class="flex flex-col gap-5 lg:sticky lg:top-[80px]">
|
|
<DashboardFamilyPulse pulse={data.pulse ?? null} />
|
|
<DashboardActivityFeed feed={data.activityFeed ?? []} />
|
|
{#if data.canWrite}
|
|
<DropZone onUploadComplete={(count) => (bannerCount = count)} />
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
</main>
|