feat(geschichten): wire discovery integrations on Person and Document pages
Person detail (/persons/[id]):
- Server load fetches GET /api/geschichten?status=PUBLISHED&personId={id}
in parallel with the existing person/document queries.
- Renders <GeschichtenCard> below the received-documents list when the
person has at least one published story.
Document detail (/documents/[id]):
- Server load adds the same parallel call with documentId={id}.
- DocumentTopBar gains geschichten + canBlogWrite props that flow through
to DocumentMetadataDrawer.
- DocumentMetadataDrawer's grid expands to lg:grid-cols-4 when the
Geschichten column should appear (stories exist OR user can author),
and shows "+ Geschichte anhängen" / "Alle anzeigen" links following the
>= 3-story threshold from issue comment #5758.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,12 @@ export async function load({ params, fetch }) {
|
||||
const { id } = params;
|
||||
const api = createApiClient(fetch);
|
||||
|
||||
const docResult = await api.GET('/api/documents/{id}', { params: { path: { id } } });
|
||||
const [docResult, geschichtenResult] = await Promise.all([
|
||||
api.GET('/api/documents/{id}', { params: { path: { id } } }),
|
||||
api.GET('/api/geschichten', {
|
||||
params: { query: { status: 'PUBLISHED', documentId: id } }
|
||||
})
|
||||
]);
|
||||
|
||||
if (docResult.response.status === 401) throw redirect(302, '/login');
|
||||
|
||||
@@ -18,8 +23,9 @@ export async function load({ params, fetch }) {
|
||||
|
||||
const document = docResult.data!;
|
||||
const inferredRelationship = await loadInferredRelationship(api, document);
|
||||
const geschichten = geschichtenResult.data ?? [];
|
||||
|
||||
return { document, inferredRelationship };
|
||||
return { document, inferredRelationship, geschichten };
|
||||
}
|
||||
|
||||
async function loadInferredRelationship(
|
||||
|
||||
@@ -424,6 +424,8 @@ onMount(() => {
|
||||
fileUrl={fileLoader.fileUrl}
|
||||
bind:transcribeMode={transcribeMode}
|
||||
inferredRelationship={data.inferredRelationship}
|
||||
geschichten={data.geschichten ?? []}
|
||||
canBlogWrite={data.canBlogWrite ?? false}
|
||||
/>
|
||||
|
||||
<div class="relative flex-1 overflow-hidden {transcribeMode ? 'flex flex-col md:flex-row' : ''}">
|
||||
|
||||
Reference in New Issue
Block a user