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' : ''}">
|
||||
|
||||
@@ -17,14 +17,18 @@ export async function load({ params, fetch, locals }) {
|
||||
receivedDocsResult,
|
||||
aliasesResult,
|
||||
relsResult,
|
||||
inferredResult
|
||||
inferredResult,
|
||||
geschichtenResult
|
||||
] = await Promise.all([
|
||||
api.GET('/api/persons/{id}', { params: { path: { id } } }),
|
||||
api.GET('/api/persons/{id}/documents', { params: { path: { id } } }),
|
||||
api.GET('/api/persons/{id}/received-documents', { params: { path: { id } } }),
|
||||
api.GET('/api/persons/{id}/aliases', { params: { path: { id } } }),
|
||||
api.GET('/api/persons/{id}/relationships', { params: { path: { id } } }),
|
||||
api.GET('/api/persons/{id}/inferred-relationships', { params: { path: { id } } })
|
||||
api.GET('/api/persons/{id}/inferred-relationships', { params: { path: { id } } }),
|
||||
api.GET('/api/geschichten', {
|
||||
params: { query: { status: 'PUBLISHED', personId: id } }
|
||||
})
|
||||
]);
|
||||
|
||||
if (!personResult.response.ok) {
|
||||
@@ -39,6 +43,7 @@ export async function load({ params, fetch, locals }) {
|
||||
aliases: aliasesResult.data ?? [],
|
||||
relationships: relsResult.data ?? [],
|
||||
inferredRelationships: inferredResult.data ?? [],
|
||||
geschichten: geschichtenResult.data ?? [],
|
||||
canWrite
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import NameHistoryCard from './NameHistoryCard.svelte';
|
||||
import CoCorrespondentsList from './CoCorrespondentsList.svelte';
|
||||
import PersonDocumentList from './PersonDocumentList.svelte';
|
||||
import PersonRelationshipsCard from './PersonRelationshipsCard.svelte';
|
||||
import GeschichtenCard from '$lib/components/GeschichtenCard.svelte';
|
||||
|
||||
let { data } = $props();
|
||||
|
||||
@@ -92,6 +93,17 @@ const coCorrespondents = $derived.by(() => {
|
||||
emptyMessage={m.person_no_received_docs()}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{#if data.geschichten && data.geschichten.length > 0}
|
||||
<div class="mt-6">
|
||||
<GeschichtenCard
|
||||
geschichten={data.geschichten}
|
||||
personId={person.id}
|
||||
personName={person.displayName}
|
||||
canWrite={data.canBlogWrite ?? false}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user