feat: port TechLog document screens
This commit is contained in:
@@ -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",
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user