feat: 기록의 맥락을 읽기 난간의 앞뒤 한 칸으로 모은다

제목 아래 맥락 블록(ContextNavigator)과 난간의 Related 가 같은 것을 두 번
말하고 있었다. 난간 하나만 남기고, 거기에 주제가 정한 사고 순서의 바로
앞·뒤 한 칸을 둔다. 기록 화면은 그 순서를 알아야 하므로 자기 주제의 기록
목록을 함께 받는다.

주제의 사고 순서는 종류마다 한 편이 아니라 전부를 세우고, 관계가 가리키는
프로젝트 결정을 기준 다음 칸에 끼운다. 답이 나온 질문은 흐름에는 남되
「아직 답하지 못한 질문」으로 다시 서지 않는다.

문서 머리말의 빵부스러기는 프로젝트/주제만 남기고 종류는 링크가 아닌 한
줄로 내린다. 홈의 「종류별로 읽기」는 주 내비가 이미 데려가므로 내린다.

`tests/component/inline-line-breaks.test.tsx` 는 머리말의 `<p>` 를 전부
세고 있어서 종류 한 줄이 늘자 깨졌다. 요약만 세도록 좁혔다 — 문단 나누기를
망가뜨리면 여전히 실패한다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cfj8mZ9QmT3MEKonzM5xPj
This commit is contained in:
DongHyeonka
2026-09-16 21:41:30 +09:00
co-authored by Claude Opus 5
parent 8c57ed7d57
commit 99c05c567d
25 changed files with 547 additions and 622 deletions
@@ -7,6 +7,7 @@ import {
import { resolveCaseEvidenceAssets } from "../../../domain/content-format/project-public-render-model.ts";
import type { EvidenceAsset } from "../../../domain/public-render-content.ts";
import { PublicRecordRenderer } from "../../shared/public-render/public-record-renderer.tsx";
import type { RecordNavigation } from "../../shared/public-render/record-navigation.ts";
import { publicRenderModelBase } from "./public-document-header.tsx";
const failedQueryCode = `@Query("""
@@ -202,7 +203,13 @@ function caseBodyBlocks(record: CaseRecord): CaseAuthoringBlock[] {
}
}
export function CaseDocumentPage({ record }: { record: CaseRecord }) {
export function CaseDocumentPage({
record,
navigation,
}: {
record: CaseRecord;
navigation?: RecordNavigation;
}) {
/*
본문은 evidence 를 key 로만 가리키고 `/media/{assetId}` 는 UUID 로만 서빙하므로, 계약이 함께
준 `bodyAssets` 로 key 를 주소로 바꾼다. 대응이 없는 key 는 그 블록을 지운다 — 해석기가
@@ -245,6 +252,7 @@ export function CaseDocumentPage({ record }: { record: CaseRecord }) {
return (
<PublicRecordRenderer
model={model}
navigation={navigation}
resolveEvidenceAsset={(key) => {
const asset = assetsByKey.get(key);
if (!asset) return resolvePublicEvidenceAsset(key);
@@ -5,6 +5,7 @@ import {
} from "../../../domain/content-format/parse-case-content.ts";
import { resolveCaseEvidenceAssets } from "../../../domain/content-format/project-public-render-model.ts";
import { PublicRecordRenderer } from "../../shared/public-render/public-record-renderer.tsx";
import type { RecordNavigation } from "../../shared/public-render/record-navigation.ts";
import { publicRenderModelBase } from "./public-document-header.tsx";
/**
@@ -23,7 +24,13 @@ function conceptBodyBlocks(record: ConceptRecord): CaseAuthoringBlock[] {
}
}
export function ConceptDocumentPage({ record }: { record: ConceptRecord }) {
export function ConceptDocumentPage({
record,
navigation,
}: {
record: ConceptRecord;
navigation?: RecordNavigation;
}) {
/*
본문은 evidence 를 key 로만 가리키고 `/media/{assetId}` 는 UUID 로만 서빙하므로, 계약이 함께
준 `bodyAssets` 로 key 를 주소로 바꾼다. 대응이 없는 key 는 그 블록을 지운다 — 해석기가
@@ -62,6 +69,7 @@ export function ConceptDocumentPage({ record }: { record: ConceptRecord }) {
return (
<PublicRecordRenderer
model={model}
navigation={navigation}
resolveEvidenceAsset={(key) => {
const asset = assetsByKey.get(key);
if (!asset) throw new Error(`concept evidence asset not found: ${key}`);
@@ -68,7 +68,7 @@ export function ProjectPath({
return (
<section className="project-path" aria-labelledby={headingId}>
<p className="section-kicker">Project path</p>
<h2 id={headingId}>어떤 주제 순서로 파고들었나</h2>
<h2 id={headingId}>Topic으로 이어지는 조사 순서</h2>
<ol className="context-flow">
{listed.map((topic, index) => {
const count = counts.get(topic.slug) ?? 0;
@@ -1,6 +1,7 @@
import type { QuestionRecord } from "../../../application/ports/public-content-queries.ts";
import type { components } from "../../../contracts/studio/generated.ts";
import { PublicRecordRenderer } from "../../shared/public-render/public-record-renderer.tsx";
import type { RecordNavigation } from "../../shared/public-render/record-navigation.ts";
import { publicRenderModelBase } from "./public-document-header.tsx";
function orderedText(
@@ -22,7 +23,13 @@ function questionStatus(record: QuestionRecord): "OPEN" | "RESOLVED" {
throw new Error(`Unsupported public Question status: ${record.questionStatus}`);
}
export function QuestionDocumentPage({ record }: { record: QuestionRecord }) {
export function QuestionDocumentPage({
record,
navigation,
}: {
record: QuestionRecord;
navigation?: RecordNavigation;
}) {
const model: components["schemas"]["QuestionPublicRenderModel"] = {
...publicRenderModelBase(record),
kind: "QUESTION",
@@ -54,6 +61,7 @@ export function QuestionDocumentPage({ record }: { record: QuestionRecord }) {
return (
<PublicRecordRenderer
model={model}
navigation={navigation}
resolveEvidenceAsset={missingQuestionEvidence}
resolvePublishedLabel={(path) =>
path === record.path ? record.publishedLabel : undefined
@@ -0,0 +1,26 @@
import type { PublicRecord } from "../../../application/ports/public-content-queries.ts";
import type { RecordNavigation } from "../../shared/public-render/record-navigation.ts";
import { reasoningSteps } from "./topic-reasoning-path.tsx";
/**
* Topic에서 정한 reasoning sequence를 Record의 앞/뒤 탐색에도 그대로 사용한다.
* 이렇게 해야 Topic에서는 A→B→C인데 Record에서는 다른 순서가 나오는 불일치가 생기지 않는다.
*/
export function deriveRecordNavigation(
records: ReadonlyArray<PublicRecord>,
currentPath: string,
): RecordNavigation {
const steps = reasoningSteps(records);
const index = steps.findIndex((step) => step.path === currentPath);
if (index < 0) return {};
const previous = steps[index - 1];
const next = steps[index + 1];
return {
previous: previous
? { label: previous.label, title: previous.title, path: previous.path }
: undefined,
next: next ? { label: next.label, title: next.title, path: next.path } : undefined,
};
}
@@ -1,6 +1,7 @@
import type { ReferenceRecord } from "../../../application/ports/public-content-queries.ts";
import type { components } from "../../../contracts/studio/generated.ts";
import { PublicRecordRenderer } from "../../shared/public-render/public-record-renderer.tsx";
import type { RecordNavigation } from "../../shared/public-render/record-navigation.ts";
import { publicRenderModelBase } from "./public-document-header.tsx";
function orderedText(
@@ -15,7 +16,13 @@ function orderedText(
}));
}
export function ReferenceDocumentPage({ record }: { record: ReferenceRecord }) {
export function ReferenceDocumentPage({
record,
navigation,
}: {
record: ReferenceRecord;
navigation?: RecordNavigation;
}) {
const model: components["schemas"]["ReferencePublicRenderModel"] = {
...publicRenderModelBase(record),
kind: "REFERENCE",
@@ -35,6 +42,7 @@ export function ReferenceDocumentPage({ record }: { record: ReferenceRecord }) {
return (
<PublicRecordRenderer
model={model}
navigation={navigation}
resolveEvidenceAsset={missingReferenceEvidence}
resolvePublishedLabel={(path) =>
path === record.path ? record.publishedLabel : undefined
@@ -5,6 +5,7 @@ import {
} from "../../../domain/content-format/parse-case-content.ts";
import { resolveCaseEvidenceAssets } from "../../../domain/content-format/project-public-render-model.ts";
import { PublicRecordRenderer } from "../../shared/public-render/public-record-renderer.tsx";
import type { RecordNavigation } from "../../shared/public-render/record-navigation.ts";
import { publicRenderModelBase } from "./public-document-header.tsx";
/**
@@ -23,7 +24,13 @@ function setupBodyBlocks(record: SetupRecord): CaseAuthoringBlock[] {
}
}
export function SetupDocumentPage({ record }: { record: SetupRecord }) {
export function SetupDocumentPage({
record,
navigation,
}: {
record: SetupRecord;
navigation?: RecordNavigation;
}) {
/*
본문은 evidence 를 key 로만 가리키고 `/media/{assetId}` 는 UUID 로만 서빙하므로, 계약이 함께
준 `bodyAssets` 로 key 를 주소로 바꾼다. 대응이 없는 key 는 그 블록을 지운다 — 해석기가
@@ -62,6 +69,7 @@ export function SetupDocumentPage({ record }: { record: SetupRecord }) {
return (
<PublicRecordRenderer
model={model}
navigation={navigation}
resolveEvidenceAsset={(key) => {
const asset = assetsByKey.get(key);
if (!asset) throw new Error(`setup evidence asset not found: ${key}`);
@@ -6,35 +6,91 @@ import type {
} from "../../../application/ports/public-content-queries.ts";
import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
/**
* 결론까지 간 사고의 순서.
*
* <p>원리를 먼저 알고, 그것을 직접 확인하고, 거기서 다음에 쓸 기준을 남긴다. 주제 화면이 답하는
* 계층은 기록이고, 답해야 하는 질문은 "무엇이 있나" 가 아니라 "어떤 순서로 생각해서 여기까지
* 왔나" 다.
*
* <p>종류마다 한 편씩만 세운다. 둘씩 담아 봤더니 일곱 줄이 되어 흐름이 아니라 또 하나의 목록이
* 됐다. 나머지는 아래 「정리해 둔 것」이 받는다.
*
* <p>열린 질문은 여기 넣지 않는다. 아직 답하지 못한 것은 사고의 결과가 아니라 다음 할 일이고,
* 흐름의 마지막 칸에 두면 이 주제가 질문으로 끝난 것처럼 읽힌다 — 그 자리는 「아직 답하지 못한
* 것」이 따로 맡는다.
*/
const REASONING_ORDER: ReadonlyArray<RecordKind> = ["CONCEPT", "CASE", "REFERENCE"];
type ReasoningStep = Readonly<{
key: string;
label: string;
title: string;
path: string;
summary: string;
}>;
/**
* 흐름에 오른 기록. 아래 목록이 같은 편을 다시 그리지 않도록 부르는 쪽도 이 함수를 쓴다.
/*
* Topic은 "어떤 자료가 있나"가 아니라 "어떤 사고 단계를 거쳤나"를 먼저 보여 준다.
*
* <p>한 칸짜리는 흐름이 아니므로 빈 목록이다. 이 판단을 화면 안에 두었더니 기록이 하나뿐인
* 주제에서 그 하나가 통째로 사라졌다 — 흐름은 그리지 않으면서 목록은 "흐름에 올랐다"며 빼고
* 있었다. 그리는 쪽과 빼는 쪽이 같은 값을 봐야 한다.
* 현재 공개 계약에는 relation의 방향(Previous/Next)이 따로 없다. 관계의 order만으로 앞뒤를
* 만들어 내면 작성자가 의도하지 않은 인과를 UI가 지어내게 된다. 그래서 명시적인 reasoning
* edge가 생기기 전까지는 Record의 역할을 기준으로 안정적인 fallback 순서를 사용한다.
*
* 리뷰에서 정한 핵심 흐름은 Case → Question → Reference → Decision이다. Concept/Setup은 이
* 네 단계가 부족한 Topic에서만 뒤를 보강한다. 같은 종류가 여러 편이면 게시 시각 순으로 모두
* 둬서 어떤 기록도 이 화면에서 사라지지 않게 한다.
*/
export function reasoningSteps(records: ReadonlyArray<PublicRecord>) {
const steps = REASONING_ORDER.flatMap((kind) => {
const first = records.find((record) => record.kind === kind);
return first ? [first] : [];
});
return steps.length < 2 ? [] : steps;
const REASONING_ORDER: ReadonlyArray<RecordKind> = [
"CASE",
"QUESTION",
"REFERENCE",
"CONCEPT",
"SETUP",
];
function recordSteps(records: ReadonlyArray<PublicRecord>): ReasoningStep[] {
return REASONING_ORDER.flatMap((kind) =>
records
.filter((record) => record.kind === kind)
.sort((left, right) => left.publishedAt.localeCompare(right.publishedAt))
.map((record) => ({
key: record.path,
label: DOCUMENT_KIND_LABELS[record.kind],
title: record.title,
path: record.path,
summary: record.summary,
})),
);
}
function decisionSteps(records: ReadonlyArray<PublicRecord>): ReasoningStep[] {
const seen = new Set<string>();
const steps: ReasoningStep[] = [];
for (const record of records) {
for (const relation of [...record.relations].sort(
(left, right) => left.priority - right.priority,
)) {
if (!relation.path.includes("/decisions#") || seen.has(relation.path)) continue;
seen.add(relation.path);
steps.push({
key: relation.path,
label: "결정",
title: relation.title,
path: relation.path,
summary: relation.note || relation.summary,
});
}
}
return steps;
}
export function reasoningSteps(records: ReadonlyArray<PublicRecord>): ReasoningStep[] {
const byKind = recordSteps(records);
const decisions = decisionSteps(records);
/* Decision은 Reference 다음, Concept/Setup보다 앞에 둔다. */
let referenceEnd = -1;
for (let index = byKind.length - 1; index >= 0; index -= 1) {
if (byKind[index]?.label === DOCUMENT_KIND_LABELS.REFERENCE) {
referenceEnd = index;
break;
}
}
const insertion = referenceEnd >= 0 ? referenceEnd + 1 : Math.min(byKind.length, 3);
const steps = [
...byKind.slice(0, insertion),
...decisions,
...byKind.slice(insertion),
];
return steps.length >= 2 ? steps : [];
}
export function TopicReasoningPath({
@@ -50,17 +106,17 @@ export function TopicReasoningPath({
return (
<section className="topic-path" aria-labelledby={headingId}>
<p className="section-kicker">Reasoning path</p>
<h2 id={headingId}>어떤 순서로 생각했나</h2>
<h2 id={headingId}>결론까지 이어진 사고 흐름</h2>
<ol className="context-flow">
{steps.map((record, index) => (
<li key={record.path}>
{steps.map((step, index) => (
<li key={step.key}>
<span className="context-flow__step" aria-hidden="true">
{String(index + 1).padStart(2, "0")}
</span>
<div className="context-flow__copy">
<span className="context-flow__meta">{DOCUMENT_KIND_LABELS[record.kind]}</span>
<Link to={record.path}>{record.title}</Link>
{record.summary.trim() ? <p>{record.summary}</p> : null}
<span className="context-flow__meta">{step.label}</span>
<Link to={step.path}>{step.title}</Link>
{step.summary.trim() ? <p>{step.summary}</p> : null}
</div>
</li>
))}
@@ -3,6 +3,7 @@ import {
useRouteInput,
} from "../../../../../presentation/routes/route-input.tsx";
import { CaseDocumentPage } from "../components/case-document-page.tsx";
import { deriveRecordNavigation } from "../components/record-navigation.ts";
import { usePublicContent } from "../use-public-content.tsx";
function optionalString(value: unknown): string | undefined {
@@ -13,16 +14,24 @@ export function CasePage() {
const { params, search } = useRouteInput<"TECH_LOG_CASE">();
const slug = optionalString(params.slug);
const requestedState = optionalString(search.state);
const view = usePublicContent(["tech-log", "case", slug], async (queries) => ({
record: slug ? await queries.getRecord("CASE", slug) : undefined,
}));
const view = usePublicContent(["tech-log", "case", slug], async (queries) => {
const record = slug ? await queries.getRecord("CASE", slug) : undefined;
const records = record?.topicSlug
? await queries.listRecords({ topic: record.topicSlug })
: [];
return {
record,
navigation: record ? deriveRecordNavigation(records, record.path) : {},
};
});
if (!view.ready) return view.fallback;
const { record } = view.data;
const { record, navigation } = view.data;
if (!record) return <RegisteredNotFoundRoute />;
return (
<CaseDocumentPage
navigation={navigation}
record={
requestedState === "relations-empty"
? { ...record, relations: [] }
@@ -3,6 +3,7 @@ import {
useRouteInput,
} from "../../../../../presentation/routes/route-input.tsx";
import { ConceptDocumentPage } from "../components/concept-document-page.tsx";
import { deriveRecordNavigation } from "../components/record-navigation.ts";
import { usePublicContent } from "../use-public-content.tsx";
function optionalString(value: unknown): string | undefined {
@@ -14,15 +15,22 @@ export function ConceptPage() {
const slug = optionalString(params.slug);
const view = usePublicContent(
["tech-log", "concept", slug],
async (queries) => ({
record: slug ? await queries.getRecord("CONCEPT", slug) : undefined,
}),
async (queries) => {
const record = slug ? await queries.getRecord("CONCEPT", slug) : undefined;
const records = record?.topicSlug
? await queries.listRecords({ topic: record.topicSlug })
: [];
return {
record,
navigation: record ? deriveRecordNavigation(records, record.path) : {},
};
},
);
if (!view.ready) return view.fallback;
const { record } = view.data;
const { record, navigation } = view.data;
return record ? (
<ConceptDocumentPage record={record} />
<ConceptDocumentPage record={record} navigation={navigation} />
) : (
<RegisteredNotFoundRoute />
);
@@ -13,24 +13,8 @@ import {
import {
DOCUMENT_KIND_LABELS,
DOCUMENT_KIND_STATES,
EXPLORE_KIND_PATHS,
} from "../../shared/document-kind-labels.ts";
/*
종류별 입구. 예전에는 여기가 "이 낱말은 이런 뜻입니다" 하는 범례였고, 그 낱말을 쓰는 목록은
2,000px 위에 있었다 — 배우기 한참 전에 먼저 쓰는 셈이었다. 이름 자체가 하는 일을 말하도록
바꾼 뒤로는 뜻풀이가 필요 없으므로, 설명 대신 그 종류에서 무엇을 얻는지를 적는다.
라벨은 공용 표에서 가져온다. 여기 손으로 적어 두었을 때 `OpenQuestion` 이라는, 사이트
어디에도 없는 여섯 번째 표기가 생겨 있었다.
*/
const exploreEntries = [
{ kind: "CASE", description: "무엇을 해보고 무엇을 확인했는지" },
{ kind: "CONCEPT", description: "안에서 실제로 무슨 일이 일어나는지" },
{ kind: "REFERENCE", description: "다음에 같은 판단을 할 때 볼 것" },
{ kind: "QUESTION", description: "아직 답하지 못한 것과 다음 검증" },
] as const;
function optionalString(value: unknown): string | undefined {
return typeof value === "string" ? value : undefined;
}
@@ -183,7 +167,7 @@ export function HomePage() {
<div className="section-heading-row">
<div>
<p className="section-kicker">Projects</p>
<h2 id="home-projects-title">조사가 사는 곳</h2>
<h2 id="home-projects-title">프로젝트</h2>
</div>
<Link className="text-link" to="/projects">
전체 보기 <span aria-hidden="true">↗</span>
@@ -208,25 +192,7 @@ export function HomePage() {
status={requestedState === "latest-error" ? "error" : "ready"}
/>
<section className="shell explore-section" aria-labelledby="explore-title">
<div className="section-heading-row explore-heading">
<div>
<p className="section-kicker">Explore</p>
<h2 id="explore-title">종류별로 읽기</h2>
</div>
</div>
<ul className="explore-list">
{exploreEntries.map((entry) => (
<li key={entry.kind}>
<Link to={EXPLORE_KIND_PATHS[entry.kind]}>
<span>{entry.description}</span>
<strong>{DOCUMENT_KIND_LABELS[entry.kind]}</strong>
<span aria-hidden="true">↗</span>
</Link>
</li>
))}
</ul>
</section>
</main>
);
}
@@ -62,26 +62,6 @@ export function ProjectOverviewPage() {
return (
<main id="main-content" className="shell project-page">
<ProjectPageHeader project={project} title={project.title} />
{/*
논지는 이 프로젝트가 무엇을 밝혔는가다. 담을 칸이 없던 동안 목적이 여기 나왔고, 목적은
시작할 때 쓰는 글이라 화면에는 늘 시작할 때의 말만 남았다. 여러 문단으로 쓸 수 있으므로
평문 한 줄이 아니라 산문으로 그린다.
*/}
<section className="project-thesis" aria-labelledby="thesis-title">
<p className="section-kicker">Thesis</p>
<h2 id="thesis-title">프로젝트를 통해 확인한 결과</h2>
{/*
아직 안 쓴 것과 쓸 것이 없는 것은 다르다. 빈 문단을 그리면 화면이 덜 만들어진 것처럼
보이고, 읽는 사람은 이 프로젝트에 결론이 없다고 읽는다. 조사가 어디쯤인지를 말한다.
*/}
{project.thesis.trim() ? (
<ProseText text={project.thesis} />
) : (
<p className="project-thesis-pending">
아직 정리한 결론이 없습니다. 아래 조사 지도가 지금까지 모은 기록을 보여 줍니다.
</p>
)}
</section>
<dl className="project-status-grid">
<div>
<dt>단계</dt>
@@ -113,6 +93,42 @@ export function ProjectOverviewPage() {
<dd>{decisions.filter((decision) => decision.status === "ADOPTED").length}</dd>
</div>
</dl>
{/*
논지는 이 프로젝트가 무엇을 밝혔는가다. 담을 칸이 없던 동안 목적이 여기 나왔고, 목적은
시작할 때 쓰는 글이라 화면에는 늘 시작할 때의 말만 남았다. 여러 문단으로 쓸 수 있으므로
평문 한 줄이 아니라 산문으로 그린다.
*/}
<section className="project-thesis" aria-labelledby="thesis-title">
<p className="section-kicker">Current findings</p>
<h2 id="thesis-title">현재까지 확인한 것</h2>
{/*
아직 안 쓴 것과 쓸 것이 없는 것은 다르다. 빈 문단을 그리면 화면이 덜 만들어진 것처럼
보이고, 읽는 사람은 이 프로젝트에 결론이 없다고 읽는다. 조사가 어디쯤인지를 말한다.
*/}
{project.thesis.trim() ? (
<ProseText text={project.thesis} />
) : (
<p className="project-thesis-pending">
아직 정리한 결론이 없습니다. 아래 조사 지도가 지금까지 모은 기록을 보여 줍니다.
</p>
)}
</section>
{/*
이 프로젝트가 다루는 주제.
고른 목록(`project.topics`)이 먼저다 — 작성자가 순서까지 정한 값이기 때문이다. 고르지
않았으면 기록에서 뽑는다: 이 프로젝트의 공개 기록이 어느 주제에 사는지가 곧 이 프로젝트가
다루는 주제다.
번호와 화살표로 순서를 보이고, 주제마다 한 줄 설명과 이 프로젝트가 그 주제에 남긴 기록
수만 붙인다. 기록 자체는 주제 화면이 편다.
*/}
<ProjectPath
topics={topics}
records={records}
catalog={topicCatalog}
headingId="project-path-title"
/>
{/*
기록 목록은 여기 두지 않는다. 이 화면이 답하는 계층은 주제이고, 기록은 주제 화면과
`/records` 가 맡는다 — 예전에는 같은 기록이 「여기서부터 읽으면 됩니다」와 주제별 지도에
@@ -132,22 +148,6 @@ export function ProjectOverviewPage() {
<span>활동 기록</span>
</Link>
</div>
{/*
이 프로젝트가 다루는 주제.
고른 목록(`project.topics`)이 먼저다 — 작성자가 순서까지 정한 값이기 때문이다. 고르지
않았으면 기록에서 뽑는다: 이 프로젝트의 공개 기록이 어느 주제에 사는지가 곧 이 프로젝트가
다루는 주제다.
번호와 화살표로 순서를 보이고, 주제마다 한 줄 설명과 이 프로젝트가 그 주제에 남긴 기록
수만 붙인다. 기록 자체는 주제 화면이 편다.
*/}
<ProjectPath
topics={topics}
records={records}
catalog={topicCatalog}
headingId="project-path-title"
/>
</main>
);
}
@@ -3,6 +3,7 @@ import {
useRouteInput,
} from "../../../../../presentation/routes/route-input.tsx";
import { QuestionDocumentPage } from "../components/question-document-page.tsx";
import { deriveRecordNavigation } from "../components/record-navigation.ts";
import { usePublicContent } from "../use-public-content.tsx";
function optionalString(value: unknown): string | undefined {
@@ -14,15 +15,22 @@ export function QuestionPage() {
const slug = optionalString(params.slug);
const view = usePublicContent(
["tech-log", "question", slug],
async (queries) => ({
record: slug ? await queries.getRecord("QUESTION", slug) : undefined,
}),
async (queries) => {
const record = slug ? await queries.getRecord("QUESTION", slug) : undefined;
const records = record?.topicSlug
? await queries.listRecords({ topic: record.topicSlug })
: [];
return {
record,
navigation: record ? deriveRecordNavigation(records, record.path) : {},
};
},
);
if (!view.ready) return view.fallback;
const { record } = view.data;
const { record, navigation } = view.data;
return record ? (
<QuestionDocumentPage record={record} />
<QuestionDocumentPage record={record} navigation={navigation} />
) : (
<RegisteredNotFoundRoute />
);
@@ -3,6 +3,7 @@ import {
useRouteInput,
} from "../../../../../presentation/routes/route-input.tsx";
import { ReferenceDocumentPage } from "../components/reference-document-page.tsx";
import { deriveRecordNavigation } from "../components/record-navigation.ts";
import { usePublicContent } from "../use-public-content.tsx";
function optionalString(value: unknown): string | undefined {
@@ -14,15 +15,22 @@ export function ReferencePage() {
const slug = optionalString(params.slug);
const view = usePublicContent(
["tech-log", "reference", slug],
async (queries) => ({
record: slug ? await queries.getRecord("REFERENCE", slug) : undefined,
}),
async (queries) => {
const record = slug ? await queries.getRecord("REFERENCE", slug) : undefined;
const records = record?.topicSlug
? await queries.listRecords({ topic: record.topicSlug })
: [];
return {
record,
navigation: record ? deriveRecordNavigation(records, record.path) : {},
};
},
);
if (!view.ready) return view.fallback;
const { record } = view.data;
const { record, navigation } = view.data;
return record ? (
<ReferenceDocumentPage record={record} />
<ReferenceDocumentPage record={record} navigation={navigation} />
) : (
<RegisteredNotFoundRoute />
);
@@ -3,6 +3,7 @@ import {
useRouteInput,
} from "../../../../../presentation/routes/route-input.tsx";
import { SetupDocumentPage } from "../components/setup-document-page.tsx";
import { deriveRecordNavigation } from "../components/record-navigation.ts";
import { usePublicContent } from "../use-public-content.tsx";
function optionalString(value: unknown): string | undefined {
@@ -14,15 +15,22 @@ export function SetupPage() {
const slug = optionalString(params.slug);
const view = usePublicContent(
["tech-log", "setup", slug],
async (queries) => ({
record: slug ? await queries.getRecord("SETUP", slug) : undefined,
}),
async (queries) => {
const record = slug ? await queries.getRecord("SETUP", slug) : undefined;
const records = record?.topicSlug
? await queries.listRecords({ topic: record.topicSlug })
: [];
return {
record,
navigation: record ? deriveRecordNavigation(records, record.path) : {},
};
},
);
if (!view.ready) return view.fallback;
const { record } = view.data;
const { record, navigation } = view.data;
return record ? (
<SetupDocumentPage record={record} />
<SetupDocumentPage record={record} navigation={navigation} />
) : (
<RegisteredNotFoundRoute />
);
@@ -9,7 +9,6 @@ import type {
RecordKind,
} from "../../../application/ports/public-content-queries.ts";
import { PublicRecordList } from "../components/public-record-list.tsx";
import { RecordStateSummary } from "../components/record-state-summary.tsx";
import {
reasoningSteps,
TopicReasoningPath,
@@ -51,14 +50,30 @@ export function TopicPage() {
if (!topic) return <RegisteredNotFoundRoute />;
const axisLabel = topic.variantLabel.trim() || "접근";
const stepPaths = new Set(reasoningSteps(records).map((record) => record.path));
const flowSteps = reasoningSteps(records);
/*
아직 답하지 못한 질문은 따로 모은다. 지식과 섞어 두면 "정리해 둔 것" 안에 답이 없는 줄이
끼어들고, 이 주제에 무엇이 남았는지는 다 읽어야만 알 수 있다.
OPEN은 정말 아직 남아 있는 질문만 보여 준다. 해결된 Question은 사고 흐름에는 남지만
"남아 있는 것"으로 다시 세우지 않는다.
*/
const open = records.filter(
(record) =>
record.kind === "QUESTION" &&
record.questionStatus !== "RESOLVED" &&
record.questionStatus !== "ARCHIVED",
);
/*
KNOWLEDGE는 탐색 UI가 아니라 이 Topic에서 정리된 내용이다. Concept / Reference / Setup을
중심으로 두고, 흐름 자체가 만들어지지 않는 단일 기록 Topic에서는 그 기록을 숨기지 않기 위해
non-Question 기록을 그대로 보여 준다.
*/
const open = records.filter((record) => record.kind === "QUESTION");
const knowledge = byKnowledgeOrder(
records.filter((record) => record.kind !== "QUESTION" && !stepPaths.has(record.path)),
records.filter((record) =>
flowSteps.length === 0
? record.kind !== "QUESTION"
: record.kind === "CONCEPT" ||
record.kind === "REFERENCE" ||
record.kind === "SETUP",
),
);
return (
<main id="main-content" className="shell public-index-page topic-hub">
@@ -83,23 +98,17 @@ export function TopicPage() {
)}
</header>
{/*
기록이 하나뿐인 주제는 제목과 한 줄, 목록 한 줄이 전부여서 "아직 아무것도 없는 곳"과
"이제 막 시작한 조사"가 구분되지 않았다. 무엇이 있고 무엇이 아직 없는지를 먼저 말한다.
*/}
<RecordStateSummary records={records} headingId="topic-state-title" />
<TopicReasoningPath records={records} headingId="topic-path-title" />
{topic.variants.length > 0 ? (
<section className="topic-variants" aria-labelledby="topic-variants-title">
<p className="section-kicker">{axisLabel}</p>
<p className="section-kicker">Knowledge</p>
{/*
이 표는 어디로 갈지 고르는 자리가 아니라 이 주제가 세운 모델 자체다. 한때 같은 네
줄이 홈에도 「주제별 흐름」이라는 이름으로 서 있었고, 그래서 읽는 사람에게는 또 하나의
길 안내처럼 보였다 — 홈에서 내리고 이름도 내용에 맞게 고친다.
*/}
<h2 id="topic-variants-title">{`이 주제가 세운 ${axisLabel}`}</h2>
<h2 id="topic-variants-title">이 Topic에서 확립한 핵심 모델</h2>
{/*
오른쪽 숫자를 더해도 아래 목록의 개수와 맞지 않는다. 한 기록이 여러 축에 걸릴 수
있고, 어느 축에도 걸리지 않은 기록은 공통이기 때문이다 — 그 규칙을 화면이 말하지
@@ -132,13 +141,16 @@ export function TopicPage() {
흐름에 오른 편은 여기서 뺀다. 예전에는 같은 네 편이 위아래로 두 번 나왔다 — 순서를
정해 준 자리가 목록의 앞부분을 복사한 것처럼 보이면 순서를 정해 준 뜻이 없어진다.
*/}
<div className="public-result-heading">
<h2>정리해 둔 것</h2>
<div className="public-result-heading topic-knowledge-heading">
<div>
<p className="section-kicker">Knowledge</p>
<h2>정리된 개념과 기준</h2>
</div>
<p>{`${knowledge.length}개`}</p>
</div>
<PublicRecordList
records={knowledge}
emptyMessage="사고 흐름에 오른 기록 외에 정리해 둔 것이 아직 없습니다."
emptyMessage="이 Topic에서 별도로 정리한 개념이나 기준이 아직 없습니다."
/>
{/*
@@ -147,8 +159,11 @@ export function TopicPage() {
*/}
{open.length > 0 ? (
<>
<div className="public-result-heading">
<h2>아직 답하지 못한 것</h2>
<div className="public-result-heading topic-open-heading">
<div>
<p className="section-kicker">Open</p>
<h2>아직 답하지 못한 질문</h2>
</div>
<p>{`${open.length}개`}</p>
</div>
<PublicRecordList records={open} />
@@ -1,107 +0,0 @@
import { Link } from "react-router-dom";
import type { components } from "../../../contracts/studio/generated.ts";
import { resolvesToPublicRoute } from "../../../domain/navigation/public-path.ts";
import { DOCUMENT_KIND_LABELS } from "../document-kind-labels.ts";
type PublicRenderModelBase = components["schemas"]["PublicRenderModelBase"];
type ResolvedRelation = components["schemas"]["ResolvedRelation"];
/** 관계 대상의 종류 이름. 프로젝트만 표에 없다 — 기록이 아니라 묶음이기 때문이다. */
function kindLabel(kind: ResolvedRelation["targetKind"]): string {
return kind === "PROJECT" ? "프로젝트" : DOCUMENT_KIND_LABELS[kind];
}
/**
* 이 기록이 어느 조사의 어디쯤인지.
*
* <p>이 사이트의 차별점은 "기록 하나에 아무 데서나 들어와도 그 결론을 만든 맥락의 사슬을 잃지
* 않는다"는 것이다. 그런데 그 사슬이 화면에서는 제목 위 얇은 breadcrumb 한 줄과 문서 맨 아래
* 「다음에 읽을 것」으로만 표현돼 있었다 — 검색으로 Case 하나에 들어온 사람은 바닥까지 내려가야
* 이 기록이 어느 프로젝트의 어느 질문에서 나왔는지 알 수 있었다. 저장은 되어 있는데 겪게 되지는
* 않는 상태였다.
*
* <p>그래서 제목·요약 바로 아래에 맥락을 하나의 덩어리로 세운다. 프로젝트 → 주제까지 올라가는
* 길과, 같은 조사 안에서 이웃한 기록들을 함께 보인다. 지금 보는 기록은 링크가 아니라 현재
* 위치로 표시한다.
*
* <p>이웃 기록에는 작성자가 그 관계에 남긴 문장을 그대로 붙인다. 「다음에 무엇을 읽을지」보다
* 「왜 그것을 읽어야 하는지」가 먼저 있어야 목록이 아니라 사슬로 읽힌다.
*
* <p>`<details>` 하나로 두 폭을 모두 쓴다. 좁은 화면에서는 접을 수 있고, 넓은 화면에서는 CSS 가
* 여는 손잡이를 감춰 늘 펼친 덩어리로 보인다 — 폭을 재서 DOM 을 둘로 만들면 같은 이름의 landmark
* 가 둘이 되어 보조 기술에는 같은 것이 두 번 나온다.
*/
export function ContextNavigator({ model }: { model: PublicRenderModelBase }) {
const project = model.project;
const topic = model.topic.label ? model.topic : null;
/*
열리지 않는 주소는 줄로 그리지 않는다. 게시할 때 만들어 저장한 문자열이라 라우트가 없는
모양이면 화면 코드 어디에도 흔적이 없고 방문자만 404 를 만난다 — 결정의 주소가 실제로 그랬다.
*/
const siblings = [...model.relations]
.filter((relation) => resolvesToPublicRoute(relation.publicPath ?? ""))
.sort((left, right) => left.order - right.order);
// 올라갈 곳도 옆으로 갈 곳도 없으면 맥락이랄 것이 없다. 빈 상자를 남기지 않는다.
if (!project && !topic && siblings.length === 0) return null;
return (
<div className="shell context-navigator-wrap">
<details className="context-navigator" open>
<summary>이 기록의 맥락</summary>
<nav aria-label="이 기록의 맥락">
{project || topic ? (
<ol className="context-trail">
{project ? (
<li>
<span>프로젝트</span>
{project.publicPath ? (
<Link to={project.publicPath}>{project.label}</Link>
) : (
<strong>{project.label}</strong>
)}
</li>
) : null}
{topic ? (
<li>
<span>주제</span>
{topic.publicPath ? (
<Link to={topic.publicPath}>{topic.label}</Link>
) : (
<strong>{topic.label}</strong>
)}
</li>
) : null}
</ol>
) : null}
<ul className="context-siblings">
{/*
지금 보는 기록도 목록에 둔다. 빼 두면 이웃만 나열되어 "내가 그중 어디인가"가 보이지
않는다 — 맥락은 주변이 아니라 자기 자리를 포함해야 위치가 된다.
*/}
<li aria-current="true">
<span className="context-kind">{DOCUMENT_KIND_LABELS[model.kind]}</span>
<div>
<strong>{model.title}</strong>
<p className="context-here">지금 읽는 기록</p>
</div>
</li>
{siblings.map((relation) => (
<li key={relation.id}>
<span className="context-kind">{kindLabel(relation.targetKind)}</span>
<div>
<Link to={relation.publicPath ?? ""}>{relation.title}</Link>
{relation.reason?.trim() ? (
<p className="context-why">{relation.reason}</p>
) : null}
</div>
</li>
))}
</ul>
</nav>
</details>
</div>
);
}
@@ -8,9 +8,9 @@ import type {
ResolvePublishedLabel,
} from "../../../domain/public-render-content.ts";
import { CaseBodyRenderer } from "./case-body-renderer.tsx";
import { ContextNavigator } from "./context-navigator.tsx";
import { DocumentToc } from "./document-toc.tsx";
import { RailContext } from "./rail-context.tsx";
import type { RecordNavigation } from "./record-navigation.ts";
import {
PublicDocumentRelations,
type PublicRelation,
@@ -34,6 +34,7 @@ type ProjectDecisionPublicRenderModel =
type RenderDependencies = {
resolveEvidenceAsset: ResolveEvidenceAsset;
resolvePublishedLabel: ResolvePublishedLabel;
navigation?: RecordNavigation;
};
function assertNever(value: never): never {
@@ -68,6 +69,22 @@ function TargetLink({
);
}
function RecordBreadcrumb({ model }: { model: PublicRenderModelBase }) {
const hasProject = Boolean(model.project);
const hasTopic = Boolean(model.topic.label);
if (!hasProject && !hasTopic) return null;
return (
<nav className="case-breadcrumb" aria-label="문서 경로">
{model.project ? <TargetLink target={model.project} /> : null}
{model.project && hasTopic ? <span aria-hidden="true">/</span> : null}
{hasTopic ? <TargetLink target={model.topic} /> : null}
</nav>
);
}
function ModelDocumentHeader({
model,
resolvePublishedLabel,
@@ -77,25 +94,8 @@ function ModelDocumentHeader({
}) {
return (
<header className="public-document-header">
<nav aria-label="문서 경로">
<Link to={explorePath(model.kind)}>{DOCUMENT_KIND_LABELS[model.kind]}</Link>
{/*
주제가 없는 기록도 있다. 이름 없는 조각이 `/topics/` 로 가는 죽은 링크로 남았었다 —
프로젝트 조각은 처음부터 조건부였는데 주제 쪽만 아니었다.
*/}
{model.topic.label ? (
<>
<span aria-hidden="true">/</span>
<TargetLink target={model.topic} />
</>
) : null}
{model.project ? (
<>
<span aria-hidden="true">/</span>
<TargetLink target={model.project} />
</>
) : null}
</nav>
<RecordBreadcrumb model={model} />
<p className="section-kicker">{DOCUMENT_KIND_LABELS[model.kind]}</p>
<h1>{model.title}</h1>
<ProseText text={model.summary} />
<dl>
@@ -145,9 +145,11 @@ function publicRelations(
function StructuredRecordRail({
model,
sections,
navigation,
}: {
model: PublicRenderModelBase;
sections: ReadonlyArray<{ id: string; label: string }>;
navigation?: RecordNavigation;
}) {
return (
<aside className="structured-record-rail" aria-label="문서 안내">
@@ -162,7 +164,7 @@ function StructuredRecordRail({
))}
</nav>
) : null}
<RailContext model={model} />
<RailContext model={model} navigation={navigation} />
</aside>
);
}
@@ -183,6 +185,7 @@ function CaseDocument({
embedded,
resolveEvidenceAsset,
resolvePublishedLabel,
navigation,
}: {
model: CasePublicRenderModel;
embedded: boolean;
@@ -201,17 +204,8 @@ function CaseDocument({
className={`case-page${embedded ? " public-record-embedded" : ""}`}
>
<header className="shell case-header">
<nav className="case-breadcrumb" aria-label="문서 경로">
<Link to={EXPLORE_KIND_PATHS.CASE}>{DOCUMENT_KIND_LABELS.CASE}</Link>
<span aria-hidden="true">/</span>
<TargetLink target={model.topic} />
{model.project ? (
<>
<span aria-hidden="true">/</span>
<TargetLink target={model.project} />
</>
) : null}
</nav>
<RecordBreadcrumb model={model} />
<p className="section-kicker">{DOCUMENT_KIND_LABELS.CASE}</p>
<h1>{model.title}</h1>
<ProseText text={model.summary} className="case-summary" />
@@ -273,8 +267,6 @@ function CaseDocument({
</details>
</header>
<ContextNavigator model={model} />
<DocumentToc headings={headings} variant="mobile" />
<div className="shell document-layout">
@@ -288,7 +280,7 @@ function CaseDocument({
<DocumentToc
headings={headings}
variant="desktop"
context={<RailContext model={model} />}
context={<RailContext model={model} navigation={navigation} />}
/>
</div>
</Root>
@@ -307,6 +299,7 @@ function ConceptDocument({
embedded,
resolveEvidenceAsset,
resolvePublishedLabel,
navigation,
}: {
model: ConceptPublicRenderModel;
embedded: boolean;
@@ -325,17 +318,8 @@ function ConceptDocument({
className={`case-page${embedded ? " public-record-embedded" : ""}`}
>
<header className="shell case-header">
<nav className="case-breadcrumb" aria-label="문서 경로">
<Link to="/explore/concepts">{DOCUMENT_KIND_LABELS.CONCEPT}</Link>
<span aria-hidden="true">/</span>
<TargetLink target={model.topic} />
{model.project ? (
<>
<span aria-hidden="true">/</span>
<TargetLink target={model.project} />
</>
) : null}
</nav>
<RecordBreadcrumb model={model} />
<p className="section-kicker">{DOCUMENT_KIND_LABELS.CONCEPT}</p>
<h1>{model.title}</h1>
<ProseText text={model.summary} className="case-summary" />
@@ -354,8 +338,6 @@ function ConceptDocument({
</dl>
</header>
<ContextNavigator model={model} />
<DocumentToc headings={headings} variant="mobile" />
<div className="shell document-layout">
@@ -369,7 +351,7 @@ function ConceptDocument({
<DocumentToc
headings={headings}
variant="desktop"
context={<RailContext model={model} />}
context={<RailContext model={model} navigation={navigation} />}
/>
</div>
</Root>
@@ -391,6 +373,7 @@ function SetupDocument({
embedded,
resolveEvidenceAsset,
resolvePublishedLabel,
navigation,
}: {
model: SetupPublicRenderModel;
embedded: boolean;
@@ -409,21 +392,8 @@ function SetupDocument({
className={`case-page${embedded ? " public-record-embedded" : ""}`}
>
<header className="shell case-header">
<nav className="case-breadcrumb" aria-label="문서 경로">
<Link to="/explore/setups">{DOCUMENT_KIND_LABELS.SETUP}</Link>
{model.topic.label ? (
<>
<span aria-hidden="true">/</span>
<TargetLink target={model.topic} />
</>
) : null}
{model.project ? (
<>
<span aria-hidden="true">/</span>
<TargetLink target={model.project} />
</>
) : null}
</nav>
<RecordBreadcrumb model={model} />
<p className="section-kicker">{DOCUMENT_KIND_LABELS.SETUP}</p>
<h1>{model.title}</h1>
<ProseText text={model.summary} className="case-summary" />
@@ -447,8 +417,6 @@ function SetupDocument({
</dl>
</header>
<ContextNavigator model={model} />
<DocumentToc headings={headings} variant="mobile" />
<div className="shell document-layout">
@@ -462,7 +430,7 @@ function SetupDocument({
<DocumentToc
headings={headings}
variant="desktop"
context={<RailContext model={model} />}
context={<RailContext model={model} navigation={navigation} />}
/>
</div>
</Root>
@@ -473,10 +441,12 @@ function ReferenceDocument({
model,
embedded,
resolvePublishedLabel,
navigation,
}: {
model: ReferencePublicRenderModel;
embedded: boolean;
resolvePublishedLabel: ResolvePublishedLabel;
navigation?: RecordNavigation;
}) {
const Root = embedded ? "div" : "main";
const railSections = [
@@ -498,7 +468,6 @@ function ReferenceDocument({
resolvePublishedLabel={resolvePublishedLabel}
/>
</div>
<ContextNavigator model={model} />
<div className="shell structured-record-layout">
<div className="structured-record-main">
<section className="reference-purpose" aria-labelledby="purpose-title">
@@ -564,7 +533,7 @@ function ReferenceDocument({
</article>
<PublicDocumentRelations relations={publicRelations(model.relations)} />
</div>
<StructuredRecordRail model={model} sections={railSections} />
<StructuredRecordRail model={model} sections={railSections} navigation={navigation} />
</div>
</Root>
);
@@ -591,10 +560,12 @@ function QuestionDocument({
model,
embedded,
resolvePublishedLabel,
navigation,
}: {
model: QuestionPublicRenderModel;
embedded: boolean;
resolvePublishedLabel: ResolvePublishedLabel;
navigation?: RecordNavigation;
}) {
const resolutionPath = model.resolution?.evidenceTarget.publicPath;
const Root = embedded ? "div" : "main";
@@ -618,7 +589,6 @@ function QuestionDocument({
resolvePublishedLabel={resolvePublishedLabel}
/>
</div>
<ContextNavigator model={model} />
<div className="shell structured-record-layout">
<div className="structured-record-main">
<p
@@ -701,7 +671,7 @@ function QuestionDocument({
</article>
<PublicDocumentRelations relations={publicRelations(model.relations)} />
</div>
<StructuredRecordRail model={model} sections={railSections} />
<StructuredRecordRail model={model} sections={railSections} navigation={navigation} />
</div>
</Root>
);
@@ -732,7 +702,6 @@ function ProjectDecisionDocument({
</>
) : null}
</nav>
<ContextNavigator model={model} />
<ol className="project-decision-list">
<li>
<article id={model.slug}>
@@ -788,6 +757,7 @@ export function PublicRecordRenderer({
embedded = false,
resolveEvidenceAsset,
resolvePublishedLabel,
navigation,
}: {
model: PublicRenderModel;
embedded?: boolean;
@@ -809,6 +779,7 @@ export function PublicRecordRenderer({
embedded={embedded}
resolveEvidenceAsset={resolveEvidenceAsset}
resolvePublishedLabel={resolvePublishedLabel}
navigation={navigation}
/>
);
case "REFERENCE":
@@ -817,6 +788,7 @@ export function PublicRecordRenderer({
model={model}
embedded={embedded}
resolvePublishedLabel={resolvePublishedLabel}
navigation={navigation}
/>
);
case "QUESTION":
@@ -825,6 +797,7 @@ export function PublicRecordRenderer({
model={model}
embedded={embedded}
resolvePublishedLabel={resolvePublishedLabel}
navigation={navigation}
/>
);
case "CONCEPT":
@@ -834,6 +807,7 @@ export function PublicRecordRenderer({
embedded={embedded}
resolveEvidenceAsset={resolveEvidenceAsset}
resolvePublishedLabel={resolvePublishedLabel}
navigation={navigation}
/>
);
case "SETUP":
@@ -843,6 +817,7 @@ export function PublicRecordRenderer({
embedded={embedded}
resolveEvidenceAsset={resolveEvidenceAsset}
resolvePublishedLabel={resolvePublishedLabel}
navigation={navigation}
/>
);
case "PROJECT_DECISION":
@@ -3,23 +3,34 @@ import { Link } from "react-router-dom";
import type { components } from "../../../contracts/studio/generated.ts";
import { resolvesToPublicRoute } from "../../../domain/navigation/public-path.ts";
import { DOCUMENT_KIND_LABELS } from "../document-kind-labels.ts";
import type { RecordNavigation } from "./record-navigation.ts";
type PublicRenderModelBase = components["schemas"]["PublicRenderModelBase"];
/**
* 긴 글을 읽는 동안 유지되는 조사 맥락.
* Record에서 유지하는 최소 맥락.
*
* 본문 사이에 별도의 관계 표를 끼우지 않고, reading rail이 현재 위치와 관련 기록을 맡는다.
* 관계 데이터에는 앞/뒤 의미가 따로 없으므로 임의로 "이전/다음"이라 부르지 않는다.
* Project/Topic이 가진 전체 Context Path를 여기서 다시 그리지 않는다. Record는 현재 위치와
* reasoning sequence의 바로 앞/뒤만 책임진다. 공개 페이지는 `navigation`을 명시적으로 넘기고,
* Studio Preview처럼 Topic 전체 목록을 모르는 렌더링만 기존 relation을 fallback으로 보여 준다.
*/
export function RailContext({ model }: { model: PublicRenderModelBase }) {
export function RailContext({
model,
navigation,
}: {
model: PublicRenderModelBase;
navigation?: RecordNavigation;
}) {
const topic = model.topic.label ? model.topic : null;
const related = [...model.relations]
.filter((relation) => resolvesToPublicRoute(relation.publicPath ?? ""))
.sort((left, right) => left.order - right.order)
.slice(0, 3);
const related =
navigation === undefined
? [...model.relations]
.filter((relation) => resolvesToPublicRoute(relation.publicPath ?? ""))
.sort((left, right) => left.order - right.order)
.slice(0, 3)
: [];
if (!model.project && !topic && related.length === 0) return null;
if (!model.project && !topic && related.length === 0 && navigation === undefined) return null;
return (
<nav className="rail-context" aria-label="읽기 맥락">
@@ -48,27 +59,51 @@ export function RailContext({ model }: { model: PublicRenderModelBase }) {
) : null}
</div>
<div className="rail-context__current">
<span>{DOCUMENT_KIND_LABELS[model.kind]} · Current</span>
<strong>{model.title}</strong>
</div>
{related.length > 0 ? (
<div className="rail-context__related">
<p>Related</p>
{related.map((relation) => (
<Link key={relation.id} to={relation.publicPath ?? ""}>
<span>{
relation.targetKind === "PROJECT"
? "프로젝트"
: DOCUMENT_KIND_LABELS[relation.targetKind]
}</span>
<strong>{relation.title}</strong>
{relation.reason?.trim() ? <small>{relation.reason}</small> : null}
{navigation !== undefined ? (
<div className="rail-context__path">
<p>Path</p>
{navigation.previous ? (
<Link to={navigation.previous.path} data-direction="previous">
<span>Previous · {navigation.previous.label}</span>
<strong>{navigation.previous.title}</strong>
</Link>
))}
) : null}
<div className="rail-context__current">
<span>{DOCUMENT_KIND_LABELS[model.kind]} · Current</span>
<strong>{model.title}</strong>
</div>
{navigation.next ? (
<Link to={navigation.next.path} data-direction="next">
<span>Next · {navigation.next.label}</span>
<strong>{navigation.next.title}</strong>
</Link>
) : null}
</div>
) : null}
) : (
<>
<div className="rail-context__current">
<span>{DOCUMENT_KIND_LABELS[model.kind]} · Current</span>
<strong>{model.title}</strong>
</div>
{related.length > 0 ? (
<div className="rail-context__related">
<p>Related</p>
{related.map((relation) => (
<Link key={relation.id} to={relation.publicPath ?? ""}>
<span>
{relation.targetKind === "PROJECT"
? "프로젝트"
: DOCUMENT_KIND_LABELS[relation.targetKind]}
</span>
<strong>{relation.title}</strong>
{relation.reason?.trim() ? <small>{relation.reason}</small> : null}
</Link>
))}
</div>
) : null}
</>
)}
</nav>
);
}
@@ -0,0 +1,16 @@
/**
* Record 화면에서 필요한 최소 탐색 정보.
*
* Project/Topic의 전체 흐름을 Record 본문에서 다시 그리지 않는다. 현재 Topic의 reasoning
* sequence에서 바로 앞/뒤 한 칸만 전달한다.
*/
export type RecordNavigationTarget = Readonly<{
label: string;
title: string;
path: string;
}>;
export type RecordNavigation = Readonly<{
previous?: RecordNavigationTarget;
next?: RecordNavigationTarget;
}>;
@@ -2478,7 +2478,10 @@ dialog::backdrop {
}
.public-result-heading h2 { margin: 0; font-size: 24px; letter-spacing: -0.03em; }
.public-result-heading p { margin: 0; color: var(--faint); font-size: 12px; }
.public-result-heading > p { margin: 0; color: var(--faint); font-size: 12px; }
.public-result-heading > div .section-kicker { margin: 0 0 6px; }
.public-result-heading > div h2 { margin: 0; }
.public-record-list { margin: 0; padding: 0; list-style: none; }
.public-record-list li { border-bottom: 1px solid var(--line); }
@@ -3135,148 +3138,6 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
}
}
/* Context Navigator — 이 기록이 어느 조사의 어디쯤인지 */
/*
제목·요약 바로 아래 자리다. 맥락이 breadcrumb 한 줄과 문서 맨 아래 「다음에 읽을 것」에만
있던 동안, 검색으로 기록 하나에 들어온 사람은 바닥까지 내려가야 이 기록이 어디에서 나왔는지
알 수 있었다. 상자를 두르지 않고 왼쪽 선 하나로만 묶는다 — 이 사이트의 나머지 화면이 카드를
쓰지 않는다.
*/
.context-navigator-wrap {
padding-bottom: 8px;
}
.context-navigator {
max-width: 860px;
padding-left: 17px;
border-left: 2px solid var(--line-strong);
}
.context-navigator > summary {
color: var(--muted);
cursor: pointer;
font-size: 12px;
font-weight: 660;
letter-spacing: 0.06em;
list-style: none;
text-transform: uppercase;
}
.context-navigator > summary::-webkit-details-marker {
display: none;
}
.context-navigator > summary::after {
content: " ▾";
}
.context-navigator:not([open]) > summary::after {
content: " ▸";
}
.context-trail {
display: flex;
flex-wrap: wrap;
gap: 8px 26px;
margin: 14px 0 0;
padding: 0;
list-style: none;
}
.context-trail li {
display: flex;
gap: 9px;
align-items: baseline;
}
.context-trail span {
color: var(--faint);
font-size: 12px;
font-weight: 620;
}
.context-trail a,
.context-trail strong {
color: var(--ink);
font-size: 15px;
font-weight: 620;
}
.context-trail a:hover {
color: var(--signal);
}
.context-siblings {
margin: 16px 0 0;
padding: 0;
list-style: none;
}
.context-siblings li {
display: grid;
grid-template-columns: 96px minmax(0, 1fr);
gap: 16px;
padding: 9px 0;
border-top: 1px solid var(--line);
}
.context-siblings li:first-child {
border-top: 0;
}
.context-kind {
color: var(--faint);
font-size: 12px;
font-weight: 620;
line-height: 1.7;
}
.context-siblings a,
.context-siblings strong {
color: var(--ink);
font-size: 15px;
font-weight: 560;
line-height: 1.55;
}
.context-siblings a:hover {
color: var(--signal);
}
/* 지금 보는 기록. 링크가 아니라 현재 위치다. */
.context-siblings li[aria-current] .context-kind,
.context-siblings li[aria-current] strong {
color: var(--signal);
}
.context-here,
.context-why {
margin: 3px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.6;
}
.context-here {
color: var(--signal);
font-weight: 560;
}
/* 넓은 화면에서는 접는 손잡이를 감춘다. 늘 펼쳐 둔 덩어리로 읽힌다. */
@media (min-width: 900px) {
.context-navigator > summary {
display: none;
}
}
@media (max-width: 767px) {
.context-siblings li {
grid-template-columns: minmax(0, 1fr);
gap: 3px;
}
}
/* 묶음의 상태 — 무엇이 있고 무엇이 아직 없는가 */
.record-state {
@@ -3854,11 +3715,7 @@ summary {
color: var(--signal);
}
/* Desktop reading chrome. Context no longer interrupts the article body. */
.context-navigator-wrap {
display: none;
}
/* Desktop reading chrome. Record context lives in the reading rail. */
.document-layout {
grid-template-columns: minmax(0, var(--body-copy)) minmax(13.5rem, var(--reading-rail));
gap: var(--reading-gap);
@@ -3925,6 +3782,8 @@ summary {
.rail-context__location span,
.rail-context__current > span,
.rail-context__path > p,
.rail-context__path > a > span,
.rail-context__related > p,
.rail-context__related a > span {
color: var(--faint);
@@ -3950,6 +3809,40 @@ summary {
border-left: 2px solid var(--signal);
}
.rail-context__path {
display: grid;
gap: 0;
margin-top: 18px;
padding-top: 16px;
border-top: 1px solid var(--line);
}
.rail-context__path > p {
margin: 0 0 5px;
}
.rail-context__path > a {
display: grid;
gap: 4px;
padding: 10px 0;
border-bottom: 1px solid var(--line);
}
.rail-context__path > a strong {
color: var(--ink-soft);
font-size: 12.5px;
font-weight: 620;
line-height: 1.5;
}
.rail-context__path > a:hover strong {
color: var(--signal);
}
.rail-context__path .rail-context__current {
margin-top: 6px;
}
.rail-context__current strong {
color: var(--ink);
font-size: 13px;
@@ -4176,48 +4069,12 @@ summary {
margin-top: 62px;
}
/* Mobile keeps context, but as a compact disclosure above the body. */
/* On narrow screens the persistent rail disappears; breadcrumb and bottom relations remain. */
@media (max-width: 1179px) {
:root {
--reading-gap: 0px;
}
.context-navigator-wrap {
display: block;
width: min(var(--body-copy), calc(100% - 64px));
margin: 0 auto 38px;
padding: 0;
}
.context-navigator {
max-width: none;
padding: 0;
border-top: 1px solid var(--line-strong);
border-bottom: 1px solid var(--line);
border-left: 0;
}
.context-navigator > summary {
display: flex;
min-height: 52px;
align-items: center;
justify-content: space-between;
color: var(--ink-soft);
font-size: 12px;
}
.context-navigator > summary::after {
margin-left: auto;
}
.context-navigator > nav {
padding-bottom: 18px;
}
.context-siblings {
margin-top: 13px;
}
.structured-record-layout {
display: block;
}
@@ -4225,10 +4082,6 @@ summary {
.structured-record-rail {
display: none;
}
.public-document-page > .shell.context-navigator-wrap {
width: min(var(--body-copy), calc(100% - 64px));
}
}
@media (max-width: 767px) {
@@ -4314,21 +4167,6 @@ summary {
gap: 18px;
}
.context-navigator-wrap,
.public-document-page > .shell.context-navigator-wrap {
width: calc(100% - 40px);
margin-bottom: 28px;
}
.context-trail {
display: grid;
gap: 7px;
}
.context-siblings li {
padding: 10px 0;
}
.document-body h2,
.public-document-body h2,
.reference-purpose h2,