feat(dashboard): wire EnrichmentBlock between Resume strip and Mission Control

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>
This commit is contained in:
Marcel
2026-04-20 22:08:09 +02:00
parent 90c9ca8708
commit f548128940
2 changed files with 30 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ type TranscriptionWeeklyStatsDTO = components['schemas']['TranscriptionWeeklySta
type DashboardResumeDTO = components['schemas']['DashboardResumeDTO'];
type DashboardPulseDTO = components['schemas']['DashboardPulseDTO'];
type ActivityFeedItemDTO = components['schemas']['ActivityFeedItemDTO'];
type IncompleteDocumentDTO = components['schemas']['IncompleteDocumentDTO'];
export async function load({ fetch }) {
const api = createApiClient(fetch);
@@ -27,7 +28,9 @@ export async function load({ fetch }) {
segmentationResult,
transcriptionResult,
readyResult,
weeklyStatsResult
weeklyStatsResult,
incompleteResult,
incompleteCountResult
] = await Promise.allSettled([
api.GET('/api/stats'),
api.GET('/api/dashboard/resume'),
@@ -36,7 +39,9 @@ export async function load({ fetch }) {
api.GET('/api/transcription/segmentation-queue'),
api.GET('/api/transcription/transcription-queue'),
api.GET('/api/transcription/ready-to-read'),
api.GET('/api/transcription/weekly-stats')
api.GET('/api/transcription/weekly-stats'),
api.GET('/api/documents/incomplete', { params: { query: { size: 5 } } }),
api.GET('/api/documents/incomplete-count')
]);
let stats: StatsDTO | null = null;
@@ -47,6 +52,8 @@ export async function load({ fetch }) {
let transcriptionDocs: TranscriptionQueueItemDTO[] = [];
let readyDocs: TranscriptionQueueItemDTO[] = [];
let weeklyStats: TranscriptionWeeklyStatsDTO | null = null;
let incompleteDocs: IncompleteDocumentDTO[] = [];
let incompleteTotal = 0;
if (statsResult.status === 'fulfilled' && statsResult.value.response.ok) {
stats = statsResult.value.data ?? null;
@@ -72,6 +79,12 @@ export async function load({ fetch }) {
if (weeklyStatsResult.status === 'fulfilled' && weeklyStatsResult.value.response.ok) {
weeklyStats = weeklyStatsResult.value.data ?? null;
}
if (incompleteResult.status === 'fulfilled' && incompleteResult.value.response.ok) {
incompleteDocs = (incompleteResult.value.data ?? []) as IncompleteDocumentDTO[];
}
if (incompleteCountResult.status === 'fulfilled' && incompleteCountResult.value.response.ok) {
incompleteTotal = (incompleteCountResult.value.data?.count as number | undefined) ?? 0;
}
return {
stats,
@@ -82,6 +95,8 @@ export async function load({ fetch }) {
transcriptionDocs,
readyDocs,
weeklyStats,
incompleteDocs,
incompleteTotal,
error: null as string | null
};
} catch (e) {
@@ -96,6 +111,8 @@ export async function load({ fetch }) {
transcriptionDocs: [],
readyDocs: [],
weeklyStats: null,
incompleteDocs: [] as IncompleteDocumentDTO[],
incompleteTotal: 0,
error: 'Daten konnten nicht geladen werden.' as string | null
};
}