feat(chronik): rename route and heading to Aktivitäten
Some checks failed
CI / Unit & Component Tests (push) Failing after 2m48s
CI / OCR Service Tests (push) Successful in 31s
CI / Backend Unit Tests (push) Failing after 2m43s

/chronik → /aktivitaeten; heading updated in all three locales.
Component folder (lib/components/chronik/) stays unchanged — internal
implementation detail, not user-facing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-22 09:28:09 +02:00
parent 4f671824dd
commit fd93f1a4da
15 changed files with 23 additions and 20 deletions

View File

@@ -0,0 +1,67 @@
import { createApiClient } from '$lib/api.server';
import type { components, operations } from '$lib/generated/api';
type ActivityFeedItemDTO = components['schemas']['ActivityFeedItemDTO'];
type NotificationDTO = components['schemas']['NotificationDTO'];
type AuditKind = NonNullable<operations['getActivity']['parameters']['query']>['kinds'] extends
| (infer K)[]
| undefined
? K
: never;
export type FilterValue = 'alle' | 'fuer-dich' | 'hochgeladen' | 'transkription' | 'kommentare';
const VALID_FILTERS: FilterValue[] = [
'alle',
'fuer-dich',
'hochgeladen',
'transkription',
'kommentare'
];
// fuer-dich stays client-side: youMentioned || youParticipated cannot be expressed as a kinds filter
const KINDS_FOR_FILTER: Partial<Record<FilterValue, AuditKind[]>> = {
hochgeladen: ['FILE_UPLOADED'],
transkription: ['TEXT_SAVED', 'BLOCK_REVIEWED', 'ANNOTATION_CREATED'],
kommentare: ['COMMENT_ADDED', 'MENTION_CREATED']
};
function parseFilter(raw: string | null): FilterValue {
if (raw && (VALID_FILTERS as string[]).includes(raw)) return raw as FilterValue;
return 'alle';
}
export async function load({ fetch, url }) {
const api = createApiClient(fetch);
const filter = parseFilter(url.searchParams.get('filter'));
const limit = Math.min(Number(url.searchParams.get('limit')) || 40, 40);
const kinds = KINDS_FOR_FILTER[filter];
const [activityResult, unreadResult] = await Promise.allSettled([
api.GET('/api/dashboard/activity', { params: { query: { limit, ...(kinds && { kinds }) } } }),
api.GET('/api/notifications', {
params: { query: { read: false, page: 0, size: 20 } }
})
]);
let activityFeed: ActivityFeedItemDTO[] = [];
let unreadNotifications: NotificationDTO[] = [];
let loadError: string | null = null;
if (activityResult.status === 'fulfilled' && activityResult.value.response.ok) {
activityFeed = (activityResult.value.data as ActivityFeedItemDTO[]) ?? [];
} else if (activityResult.status === 'fulfilled') {
loadError = 'activity';
}
if (unreadResult.status === 'fulfilled' && unreadResult.value.response.ok) {
unreadNotifications = unreadResult.value.data?.content ?? [];
}
return {
filter,
activityFeed,
unreadNotifications,
loadError
};
}