refactor(document-thumbnail): read doc.thumbnailUrl instead of composing locally
The backend now exposes thumbnailUrl as a serialised computed property on Document, so the component drops its dependency on the frontend URL-builder. PersonDocumentList's inline Doc prop type follows the same shift (#309). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { components } from '$lib/generated/api';
|
import type { components } from '$lib/generated/api';
|
||||||
import { thumbnailUrl } from '$lib/thumbnails';
|
|
||||||
|
|
||||||
type Doc = Pick<
|
type Doc = Pick<components['schemas']['Document'], 'id' | 'thumbnailUrl' | 'contentType'>;
|
||||||
components['schemas']['Document'],
|
|
||||||
'id' | 'thumbnailKey' | 'thumbnailGeneratedAt' | 'contentType'
|
|
||||||
>;
|
|
||||||
|
|
||||||
let { doc, size = 'sm' }: { doc: Doc; size?: 'sm' | 'lg' } = $props();
|
let { doc, size = 'sm' }: { doc: Doc; size?: 'sm' | 'lg' } = $props();
|
||||||
const url = $derived(thumbnailUrl(doc));
|
const url = $derived(doc.thumbnailUrl ?? null);
|
||||||
|
|
||||||
const containerClass = $derived(
|
const containerClass = $derived(
|
||||||
size === 'lg'
|
size === 'lg'
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ let {
|
|||||||
location?: string | null;
|
location?: string | null;
|
||||||
status: string;
|
status: string;
|
||||||
contentType?: string;
|
contentType?: string;
|
||||||
thumbnailKey?: string;
|
thumbnailUrl?: string;
|
||||||
thumbnailGeneratedAt?: string;
|
|
||||||
}[];
|
}[];
|
||||||
heading: string;
|
heading: string;
|
||||||
emptyMessage: string;
|
emptyMessage: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user