diff --git a/src/features/tech-log/presentation/public/components/public-document-header.tsx b/src/features/tech-log/presentation/public/components/public-document-header.tsx index e82fe43..1b43122 100644 --- a/src/features/tech-log/presentation/public/components/public-document-header.tsx +++ b/src/features/tech-log/presentation/public/components/public-document-header.tsx @@ -3,13 +3,7 @@ import { Link } from "react-router-dom"; import type { PublicRecord } from "../../../application/ports/public-content-queries.ts"; import type { components } from "../../../contracts/studio/generated.ts"; import { ProseText } from "../../shared/public-render/prose-text.tsx"; - -const kindLabels = { - CASE: "Case", - REFERENCE: "Reference", - QUESTION: "Open Question", - CONCEPT: "개념", -} as const; +import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts"; export function PublicDocumentHeader({ record }: { record: PublicRecord }) { return ( @@ -18,7 +12,7 @@ export function PublicDocumentHeader({ record }: { record: PublicRecord }) { - {kindLabels[record.kind]} + {DOCUMENT_KIND_LABELS[record.kind]} {/* @@ -39,7 +33,7 @@ export function PublicDocumentHeader({ record }: { record: PublicRecord }) {
유형
-
{kindLabels[record.kind]}
+
{DOCUMENT_KIND_LABELS[record.kind]}
프로젝트
diff --git a/src/features/tech-log/presentation/public/components/public-record-list.tsx b/src/features/tech-log/presentation/public/components/public-record-list.tsx index f155862..82995c3 100644 --- a/src/features/tech-log/presentation/public/components/public-record-list.tsx +++ b/src/features/tech-log/presentation/public/components/public-record-list.tsx @@ -1,13 +1,7 @@ import { Link } from "react-router-dom"; import type { PublicRecord } from "../../../application/ports/public-content-queries.ts"; - -const kindLabels = { - CASE: "Case", - REFERENCE: "Reference", - QUESTION: "Open Question", - CONCEPT: "개념", -} as const; +import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts"; export function PublicRecordList({ records, @@ -25,7 +19,7 @@ export function PublicRecordList({ {records.map((record) => (
  • - {kindLabels[record.kind]} + {DOCUMENT_KIND_LABELS[record.kind]}
    {record.title}

    {record.summary}

    diff --git a/src/features/tech-log/presentation/shared/document-kind-labels.ts b/src/features/tech-log/presentation/shared/document-kind-labels.ts new file mode 100644 index 0000000..87548a4 --- /dev/null +++ b/src/features/tech-log/presentation/shared/document-kind-labels.ts @@ -0,0 +1,21 @@ +import type { components } from "../../contracts/studio/generated.ts"; + +type RecordKind = components["schemas"]["RecordKind"]; + +/** + * 문서 종류를 사람에게 보여 주는 이름. + * + *

    이 표는 화면마다 하나씩 복사되어 있었고, 그래서 갈라졌다. 같은 `QUESTION` 이 공개 화면에서는 + * "Open Question", 작업본 목록과 게시 기록에서는 "Question", 편집기 상태 줄에서는 "QUESTION" 으로 + * 나왔다 — 여섯 벌 중 네 가지 표기였다. 쓰는 사람은 같은 문서를 화면마다 다른 이름으로 만난다. + * + *

    한 곳에 두면 다음에 종류가 늘어날 때도 한 번만 고친다. 종류를 더하면 이 표가 비어 있는 것을 + * 타입이 잡는다 — `Record` 이므로 빠진 종류가 있으면 컴파일되지 않는다. + */ +export const DOCUMENT_KIND_LABELS: Record = { + CASE: "Case", + REFERENCE: "Reference", + QUESTION: "Open Question", + CONCEPT: "개념", + PROJECT_DECISION: "Decision", +}; diff --git a/src/features/tech-log/presentation/shared/public-render/public-record-renderer.tsx b/src/features/tech-log/presentation/shared/public-render/public-record-renderer.tsx index 950cb20..3be152f 100644 --- a/src/features/tech-log/presentation/shared/public-render/public-record-renderer.tsx +++ b/src/features/tech-log/presentation/shared/public-render/public-record-renderer.tsx @@ -13,6 +13,7 @@ import { PublicDocumentRelations, type PublicRelation, } from "./public-document-relations.tsx"; +import { DOCUMENT_KIND_LABELS } from "../document-kind-labels.ts"; type PublicRenderModel = components["schemas"]["PublicRenderModel"]; type PublicRenderModelBase = components["schemas"]["PublicRenderModelBase"]; @@ -31,14 +32,6 @@ type RenderDependencies = { resolvePublishedLabel: ResolvePublishedLabel; }; -const kindLabels = { - CASE: "Case", - REFERENCE: "Reference", - QUESTION: "Open Question", - CONCEPT: "개념", - PROJECT_DECISION: "Decision", -} as const; - function assertNever(value: never): never { throw new Error(`Unsupported Public render model: ${JSON.stringify(value)}`); } @@ -84,7 +77,7 @@ function ModelDocumentHeader({ return (