feat: port TechLog document screens

This commit is contained in:
DongHyeonka
2026-08-15 23:06:57 +09:00
parent 512aa4a1e9
commit 4283e40bb2
10 changed files with 878 additions and 0 deletions
@@ -0,0 +1,89 @@
import { Link } from "react-router-dom";
import type { PublicRecord } from "../../../application/ports/public-content-queries.ts";
import type { components } from "../../../contracts/studio/generated.ts";
const kindLabels = {
CASE: "Case",
REFERENCE: "Reference",
QUESTION: "Open Question",
} as const;
export function PublicDocumentHeader({ record }: { record: PublicRecord }) {
return (
<header className="public-document-header">
<nav aria-label="문서 경로">
<Link
to={`/explore/${record.kind === "CASE" ? "cases" : record.kind === "REFERENCE" ? "references" : "questions"}`}
>
{kindLabels[record.kind]}
</Link>
<span aria-hidden="true">/</span>
<Link to={`/topics/${record.topicSlug}`}>{record.topic}</Link>
<span aria-hidden="true">/</span>
<Link to={`/projects/${record.projectSlug}`}>
{record.projectTitle}
</Link>
</nav>
<h1>{record.title}</h1>
<p>{record.summary}</p>
<dl>
<div>
<dt></dt>
<dd>{kindLabels[record.kind]}</dd>
</div>
<div>
<dt></dt>
<dd>{record.projectTitle}</dd>
</div>
<div>
<dt></dt>
<dd>{record.publishedLabel}</dd>
</div>
</dl>
</header>
);
}
export function publicRenderModelBase(
record: PublicRecord,
): components["schemas"]["PublicRenderModelBase"] {
return {
kind: record.kind,
slug: record.slug,
title: record.title,
summary: record.summary,
publicPath: record.path,
topic: {
id: `topic-${record.topicSlug}`,
label: record.topic,
publicPath: `/topics/${record.topicSlug}`,
},
project: {
id: `project-${record.projectSlug}`,
label: record.projectTitle,
publicPath: `/projects/${record.projectSlug}`,
},
relations: record.relations.map((relation, index) => ({
id: `public-relation-${index + 1}-${relation.path}`,
targetId: relation.path,
targetKind: relation.path.startsWith("/cases/")
? "CASE"
: relation.path.startsWith("/references/")
? "REFERENCE"
: relation.path.startsWith("/questions/")
? "QUESTION"
: relation.path.includes("/decisions#")
? "PROJECT_DECISION"
: "PROJECT",
title: relation.title,
publicPath: relation.path,
reason: relation.reason,
order: index + 1,
})),
renderContext: {
generatedAt: record.publishedAt,
dependencyRevision: "public-v1",
},
};
}