feat: Added TypeScript version types, fetchTechniqueVersions function,…

- "frontend/src/api/public-client.ts"
- "frontend/src/pages/TechniquePage.tsx"

GSD-Task: S04/T03
This commit is contained in:
jlightner 2026-03-30 07:19:31 +00:00
parent 872ffe0543
commit 2a07583d6d
2 changed files with 31 additions and 1 deletions

View file

@ -68,6 +68,18 @@ export interface TechniquePageDetail {
key_moments: KeyMomentSummary[];
creator_info: CreatorInfo | null;
related_links: RelatedLinkItem[];
version_count: number;
}
export interface TechniquePageVersionSummary {
version_number: number;
created_at: string;
pipeline_metadata: Record<string, unknown> | null;
}
export interface TechniquePageVersionListResponse {
items: TechniquePageVersionSummary[];
total: number;
}
export interface TechniqueListItem {
@ -217,6 +229,14 @@ export async function fetchTechnique(
return request<TechniquePageDetail>(`${BASE}/techniques/${slug}`);
}
export async function fetchTechniqueVersions(
slug: string,
): Promise<TechniquePageVersionListResponse> {
return request<TechniquePageVersionListResponse>(
`${BASE}/techniques/${slug}/versions`,
);
}
// ── Topics ───────────────────────────────────────────────────────────────────
export async function fetchTopics(): Promise<TopicCategory[]> {

View file

@ -151,7 +151,17 @@ export default function TechniquePage() {
"en-US",
{ year: "numeric", month: "short", day: "numeric" },
);
return `Compiled from ${sourceCount} source${sourceCount !== 1 ? "s" : ""} · ${momentCount} key moment${momentCount !== 1 ? "s" : ""} · Last updated ${updated}`;
const parts = [
`Compiled from ${sourceCount} source${sourceCount !== 1 ? "s" : ""}`,
`${momentCount} key moment${momentCount !== 1 ? "s" : ""}`,
];
if (technique.version_count > 0) {
parts.push(
`${technique.version_count} version${technique.version_count !== 1 ? "s" : ""}`,
);
}
parts.push(`Last updated ${updated}`);
return parts.join(" · ");
})()}
</div>
</header>