fix(documents): WCAG text-size and API error pattern fixes
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 2m37s
CI / OCR Service Tests (pull_request) Successful in 29s
CI / Unit & Component Tests (push) Failing after 2m44s
CI / OCR Service Tests (push) Successful in 38s
CI / Backend Unit Tests (push) Failing after 2m45s
CI / Backend Unit Tests (pull_request) Failing after 2m45s
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 2m37s
CI / OCR Service Tests (pull_request) Successful in 29s
CI / Unit & Component Tests (push) Failing after 2m44s
CI / OCR Service Tests (push) Successful in 38s
CI / Backend Unit Tests (push) Failing after 2m45s
CI / Backend Unit Tests (pull_request) Failing after 2m45s
- DashboardResumeStrip: text-[10px] → text-xs on collaborator initials (WCAG 1.4.4) - documents/+page.server.ts: use !result.response.ok per CLAUDE.md; keep narrow try/catch for network-level failures only Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -97,7 +97,7 @@ function safeColor(color: string): string {
|
||||
</div>
|
||||
{#each resumeDoc.collaborators.slice(0, 3) as collab (collab.initials + collab.color)}
|
||||
<span
|
||||
class="-ml-1 inline-flex h-6 w-6 items-center justify-center rounded-full font-sans text-[10px] font-bold text-white ring-2 ring-white"
|
||||
class="-ml-1 inline-flex h-6 w-6 items-center justify-center rounded-full font-sans text-xs font-bold text-white ring-2 ring-white"
|
||||
style="background:{safeColor(collab.color)}">{collab.initials}</span
|
||||
>
|
||||
{/each}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { createApiClient } from '$lib/api.server';
|
||||
import { getErrorMessage } from '$lib/errors';
|
||||
import type { components } from '$lib/generated/api';
|
||||
|
||||
type DocumentSearchItem = components['schemas']['DocumentSearchItem'];
|
||||
@@ -29,8 +30,9 @@ export async function load({ url, fetch }) {
|
||||
|
||||
const api = createApiClient(fetch);
|
||||
|
||||
let result;
|
||||
try {
|
||||
const result = await api.GET('/api/documents/search', {
|
||||
result = await api.GET('/api/documents/search', {
|
||||
params: {
|
||||
query: {
|
||||
q: q || undefined,
|
||||
@@ -46,32 +48,7 @@ export async function load({ url, fetch }) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (result.response.status === 401) {
|
||||
throw redirect(302, '/login');
|
||||
}
|
||||
|
||||
const items: DocumentSearchItem[] = (result.data?.items ?? []) as DocumentSearchItem[];
|
||||
const total: number = result.data?.total ?? 0;
|
||||
|
||||
return {
|
||||
items,
|
||||
total,
|
||||
q,
|
||||
from,
|
||||
to,
|
||||
senderId,
|
||||
receiverId,
|
||||
tags,
|
||||
sort,
|
||||
dir,
|
||||
tagQ,
|
||||
tagOp,
|
||||
error: null as string | null
|
||||
};
|
||||
} catch (e) {
|
||||
if ((e as { status?: number }).status) throw e;
|
||||
console.error('Error loading documents:', e);
|
||||
} catch {
|
||||
return {
|
||||
items: [] as DocumentSearchItem[],
|
||||
total: 0,
|
||||
@@ -88,4 +65,29 @@ export async function load({ url, fetch }) {
|
||||
error: 'Daten konnten nicht geladen werden.' as string | null
|
||||
};
|
||||
}
|
||||
|
||||
if (result.response.status === 401) {
|
||||
throw redirect(302, '/login');
|
||||
}
|
||||
|
||||
const errorMessage: string | null = !result.response.ok
|
||||
? (getErrorMessage((result.error as unknown as { code?: string })?.code) ??
|
||||
'Daten konnten nicht geladen werden.')
|
||||
: null;
|
||||
|
||||
return {
|
||||
items: (result.data?.items ?? []) as DocumentSearchItem[],
|
||||
total: result.data?.total ?? 0,
|
||||
q,
|
||||
from,
|
||||
to,
|
||||
senderId,
|
||||
receiverId,
|
||||
tags,
|
||||
sort,
|
||||
dir,
|
||||
tagQ,
|
||||
tagOp,
|
||||
error: errorMessage
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user