From 99c05c567d798ae397ece3c9f261fbd8e272867f Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Wed, 16 Sep 2026 21:41:30 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B8=B0=EB=A1=9D=EC=9D=98=20=EB=A7=A5?= =?UTF-8?q?=EB=9D=BD=EC=9D=84=20=EC=9D=BD=EA=B8=B0=20=EB=82=9C=EA=B0=84?= =?UTF-8?q?=EC=9D=98=20=EC=95=9E=EB=92=A4=20=ED=95=9C=20=EC=B9=B8=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=AA=A8=EC=9D=80=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 제목 아래 맥락 블록(ContextNavigator)과 난간의 Related 가 같은 것을 두 번 말하고 있었다. 난간 하나만 남기고, 거기에 주제가 정한 사고 순서의 바로 앞·뒤 한 칸을 둔다. 기록 화면은 그 순서를 알아야 하므로 자기 주제의 기록 목록을 함께 받는다. 주제의 사고 순서는 종류마다 한 편이 아니라 전부를 세우고, 관계가 가리키는 프로젝트 결정을 기준 다음 칸에 끼운다. 답이 나온 질문은 흐름에는 남되 「아직 답하지 못한 질문」으로 다시 서지 않는다. 문서 머리말의 빵부스러기는 프로젝트/주제만 남기고 종류는 링크가 아닌 한 줄로 내린다. 홈의 「종류별로 읽기」는 주 내비가 이미 데려가므로 내린다. `tests/component/inline-line-breaks.test.tsx` 는 머리말의 `

` 를 전부 세고 있어서 종류 한 줄이 늘자 깨졌다. 요약만 세도록 좁혔다 — 문단 나누기를 망가뜨리면 여전히 실패한다. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Cfj8mZ9QmT3MEKonzM5xPj --- .../public/components/case-document-page.tsx | 10 +- .../components/concept-document-page.tsx | 10 +- .../public/components/project-path.tsx | 2 +- .../components/question-document-page.tsx | 10 +- .../public/components/record-navigation.ts | 26 ++ .../components/reference-document-page.tsx | 10 +- .../public/components/setup-document-page.tsx | 10 +- .../components/topic-reasoning-path.tsx | 120 ++++++--- .../presentation/public/pages/case-page.tsx | 17 +- .../public/pages/concept-page.tsx | 18 +- .../presentation/public/pages/home-page.tsx | 38 +-- .../public/pages/project-overview-page.tsx | 72 ++--- .../public/pages/question-page.tsx | 18 +- .../public/pages/reference-page.tsx | 18 +- .../presentation/public/pages/setup-page.tsx | 18 +- .../presentation/public/pages/topic-page.tsx | 53 ++-- .../public-render/context-navigator.tsx | 107 -------- .../public-render/public-record-renderer.tsx | 119 ++++----- .../shared/public-render/rail-context.tsx | 91 +++++-- .../shared/public-render/record-navigation.ts | 16 ++ .../tech-log/presentation/styles/globals.css | 246 +++--------------- tests/component/inline-line-breaks.test.tsx | 13 +- .../tech-log/context-navigator.test.tsx | 61 +++-- .../public-discovery-screens.test.tsx | 18 +- .../tech-log/public-document-screens.test.tsx | 48 ++-- 25 files changed, 547 insertions(+), 622 deletions(-) create mode 100644 src/features/tech-log/presentation/public/components/record-navigation.ts delete mode 100644 src/features/tech-log/presentation/shared/public-render/context-navigator.tsx create mode 100644 src/features/tech-log/presentation/shared/public-render/record-navigation.ts diff --git a/src/features/tech-log/presentation/public/components/case-document-page.tsx b/src/features/tech-log/presentation/public/components/case-document-page.tsx index c731387..ae4859d 100644 --- a/src/features/tech-log/presentation/public/components/case-document-page.tsx +++ b/src/features/tech-log/presentation/public/components/case-document-page.tsx @@ -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 ( { const asset = assetsByKey.get(key); if (!asset) return resolvePublicEvidenceAsset(key); diff --git a/src/features/tech-log/presentation/public/components/concept-document-page.tsx b/src/features/tech-log/presentation/public/components/concept-document-page.tsx index 83d91c2..82dceb0 100644 --- a/src/features/tech-log/presentation/public/components/concept-document-page.tsx +++ b/src/features/tech-log/presentation/public/components/concept-document-page.tsx @@ -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 ( { const asset = assetsByKey.get(key); if (!asset) throw new Error(`concept evidence asset not found: ${key}`); diff --git a/src/features/tech-log/presentation/public/components/project-path.tsx b/src/features/tech-log/presentation/public/components/project-path.tsx index 9090b0b..9498aab 100644 --- a/src/features/tech-log/presentation/public/components/project-path.tsx +++ b/src/features/tech-log/presentation/public/components/project-path.tsx @@ -68,7 +68,7 @@ export function ProjectPath({ return (

Project path

-

어떤 주제 순서로 파고들었나

+

Topic으로 이어지는 조사 순서

    {listed.map((topic, index) => { const count = counts.get(topic.slug) ?? 0; diff --git a/src/features/tech-log/presentation/public/components/question-document-page.tsx b/src/features/tech-log/presentation/public/components/question-document-page.tsx index 1720192..141665e 100644 --- a/src/features/tech-log/presentation/public/components/question-document-page.tsx +++ b/src/features/tech-log/presentation/public/components/question-document-page.tsx @@ -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 ( path === record.path ? record.publishedLabel : undefined diff --git a/src/features/tech-log/presentation/public/components/record-navigation.ts b/src/features/tech-log/presentation/public/components/record-navigation.ts new file mode 100644 index 0000000..abf83ed --- /dev/null +++ b/src/features/tech-log/presentation/public/components/record-navigation.ts @@ -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, + 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, + }; +} diff --git a/src/features/tech-log/presentation/public/components/reference-document-page.tsx b/src/features/tech-log/presentation/public/components/reference-document-page.tsx index 3d6918f..5ebf805 100644 --- a/src/features/tech-log/presentation/public/components/reference-document-page.tsx +++ b/src/features/tech-log/presentation/public/components/reference-document-page.tsx @@ -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 ( path === record.path ? record.publishedLabel : undefined diff --git a/src/features/tech-log/presentation/public/components/setup-document-page.tsx b/src/features/tech-log/presentation/public/components/setup-document-page.tsx index e55742f..037a522 100644 --- a/src/features/tech-log/presentation/public/components/setup-document-page.tsx +++ b/src/features/tech-log/presentation/public/components/setup-document-page.tsx @@ -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 ( { const asset = assetsByKey.get(key); if (!asset) throw new Error(`setup evidence asset not found: ${key}`); diff --git a/src/features/tech-log/presentation/public/components/topic-reasoning-path.tsx b/src/features/tech-log/presentation/public/components/topic-reasoning-path.tsx index a68f35c..fea085d 100644 --- a/src/features/tech-log/presentation/public/components/topic-reasoning-path.tsx +++ b/src/features/tech-log/presentation/public/components/topic-reasoning-path.tsx @@ -6,35 +6,91 @@ import type { } from "../../../application/ports/public-content-queries.ts"; import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts"; -/** - * 결론까지 간 사고의 순서. - * - *

    원리를 먼저 알고, 그것을 직접 확인하고, 거기서 다음에 쓸 기준을 남긴다. 주제 화면이 답하는 - * 계층은 기록이고, 답해야 하는 질문은 "무엇이 있나" 가 아니라 "어떤 순서로 생각해서 여기까지 - * 왔나" 다. - * - *

    종류마다 한 편씩만 세운다. 둘씩 담아 봤더니 일곱 줄이 되어 흐름이 아니라 또 하나의 목록이 - * 됐다. 나머지는 아래 「정리해 둔 것」이 받는다. - * - *

    열린 질문은 여기 넣지 않는다. 아직 답하지 못한 것은 사고의 결과가 아니라 다음 할 일이고, - * 흐름의 마지막 칸에 두면 이 주제가 질문으로 끝난 것처럼 읽힌다 — 그 자리는 「아직 답하지 못한 - * 것」이 따로 맡는다. - */ -const REASONING_ORDER: ReadonlyArray = ["CONCEPT", "CASE", "REFERENCE"]; +type ReasoningStep = Readonly<{ + key: string; + label: string; + title: string; + path: string; + summary: string; +}>; -/** - * 흐름에 오른 기록. 아래 목록이 같은 편을 다시 그리지 않도록 부르는 쪽도 이 함수를 쓴다. +/* + * Topic은 "어떤 자료가 있나"가 아니라 "어떤 사고 단계를 거쳤나"를 먼저 보여 준다. * - *

    한 칸짜리는 흐름이 아니므로 빈 목록이다. 이 판단을 화면 안에 두었더니 기록이 하나뿐인 - * 주제에서 그 하나가 통째로 사라졌다 — 흐름은 그리지 않으면서 목록은 "흐름에 올랐다"며 빼고 - * 있었다. 그리는 쪽과 빼는 쪽이 같은 값을 봐야 한다. + * 현재 공개 계약에는 relation의 방향(Previous/Next)이 따로 없다. 관계의 order만으로 앞뒤를 + * 만들어 내면 작성자가 의도하지 않은 인과를 UI가 지어내게 된다. 그래서 명시적인 reasoning + * edge가 생기기 전까지는 Record의 역할을 기준으로 안정적인 fallback 순서를 사용한다. + * + * 리뷰에서 정한 핵심 흐름은 Case → Question → Reference → Decision이다. Concept/Setup은 이 + * 네 단계가 부족한 Topic에서만 뒤를 보강한다. 같은 종류가 여러 편이면 게시 시각 순으로 모두 + * 둬서 어떤 기록도 이 화면에서 사라지지 않게 한다. */ -export function reasoningSteps(records: ReadonlyArray) { - 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 = [ + "CASE", + "QUESTION", + "REFERENCE", + "CONCEPT", + "SETUP", +]; + +function recordSteps(records: ReadonlyArray): 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): ReasoningStep[] { + const seen = new Set(); + 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): 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 (

    Reasoning path

    -

    어떤 순서로 생각했나

    +

    결론까지 이어진 사고 흐름

      - {steps.map((record, index) => ( -
    1. + {steps.map((step, index) => ( +
    2. - {DOCUMENT_KIND_LABELS[record.kind]} - {record.title} - {record.summary.trim() ?

      {record.summary}

      : null} + {step.label} + {step.title} + {step.summary.trim() ?

      {step.summary}

      : null}
    3. ))} diff --git a/src/features/tech-log/presentation/public/pages/case-page.tsx b/src/features/tech-log/presentation/public/pages/case-page.tsx index 6d622cc..24493e8 100644 --- a/src/features/tech-log/presentation/public/pages/case-page.tsx +++ b/src/features/tech-log/presentation/public/pages/case-page.tsx @@ -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 ; return ( ({ - 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 ? ( - + ) : ( ); diff --git a/src/features/tech-log/presentation/public/pages/home-page.tsx b/src/features/tech-log/presentation/public/pages/home-page.tsx index e279e25..759f9f5 100644 --- a/src/features/tech-log/presentation/public/pages/home-page.tsx +++ b/src/features/tech-log/presentation/public/pages/home-page.tsx @@ -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() {

      Projects

      -

      조사가 사는 곳

      +

      프로젝트

      전체 보기 @@ -208,25 +192,7 @@ export function HomePage() { status={requestedState === "latest-error" ? "error" : "ready"} /> -
      -
      -
      -

      Explore

      -

      종류별로 읽기

      -
      -
      -
        - {exploreEntries.map((entry) => ( -
      • - - {entry.description} - {DOCUMENT_KIND_LABELS[entry.kind]} - - -
      • - ))} -
      -
      + ); } diff --git a/src/features/tech-log/presentation/public/pages/project-overview-page.tsx b/src/features/tech-log/presentation/public/pages/project-overview-page.tsx index 781a08b..30bf56b 100644 --- a/src/features/tech-log/presentation/public/pages/project-overview-page.tsx +++ b/src/features/tech-log/presentation/public/pages/project-overview-page.tsx @@ -62,26 +62,6 @@ export function ProjectOverviewPage() { return (
      - {/* - 논지는 이 프로젝트가 무엇을 밝혔는가다. 담을 칸이 없던 동안 목적이 여기 나왔고, 목적은 - 시작할 때 쓰는 글이라 화면에는 늘 시작할 때의 말만 남았다. 여러 문단으로 쓸 수 있으므로 - 평문 한 줄이 아니라 산문으로 그린다. - */} -
      -

      Thesis

      -

      프로젝트를 통해 확인한 결과

      - {/* - 아직 안 쓴 것과 쓸 것이 없는 것은 다르다. 빈 문단을 그리면 화면이 덜 만들어진 것처럼 - 보이고, 읽는 사람은 이 프로젝트에 결론이 없다고 읽는다. 조사가 어디쯤인지를 말한다. - */} - {project.thesis.trim() ? ( - - ) : ( -

      - 아직 정리한 결론이 없습니다. 아래 조사 지도가 지금까지 모은 기록을 보여 줍니다. -

      - )} -
      단계
      @@ -113,6 +93,42 @@ export function ProjectOverviewPage() {
      {decisions.filter((decision) => decision.status === "ADOPTED").length}
      + {/* + 논지는 이 프로젝트가 무엇을 밝혔는가다. 담을 칸이 없던 동안 목적이 여기 나왔고, 목적은 + 시작할 때 쓰는 글이라 화면에는 늘 시작할 때의 말만 남았다. 여러 문단으로 쓸 수 있으므로 + 평문 한 줄이 아니라 산문으로 그린다. + */} +
      +

      Current findings

      +

      현재까지 확인한 것

      + {/* + 아직 안 쓴 것과 쓸 것이 없는 것은 다르다. 빈 문단을 그리면 화면이 덜 만들어진 것처럼 + 보이고, 읽는 사람은 이 프로젝트에 결론이 없다고 읽는다. 조사가 어디쯤인지를 말한다. + */} + {project.thesis.trim() ? ( + + ) : ( +

      + 아직 정리한 결론이 없습니다. 아래 조사 지도가 지금까지 모은 기록을 보여 줍니다. +

      + )} +
      + {/* + 이 프로젝트가 다루는 주제. + + 고른 목록(`project.topics`)이 먼저다 — 작성자가 순서까지 정한 값이기 때문이다. 고르지 + 않았으면 기록에서 뽑는다: 이 프로젝트의 공개 기록이 어느 주제에 사는지가 곧 이 프로젝트가 + 다루는 주제다. + + 번호와 화살표로 순서를 보이고, 주제마다 한 줄 설명과 이 프로젝트가 그 주제에 남긴 기록 + 수만 붙인다. 기록 자체는 주제 화면이 편다. + */} + {/* 기록 목록은 여기 두지 않는다. 이 화면이 답하는 계층은 주제이고, 기록은 주제 화면과 `/records` 가 맡는다 — 예전에는 같은 기록이 「여기서부터 읽으면 됩니다」와 주제별 지도에 @@ -132,22 +148,6 @@ export function ProjectOverviewPage() { 활동 기록
      - {/* - 이 프로젝트가 다루는 주제. - - 고른 목록(`project.topics`)이 먼저다 — 작성자가 순서까지 정한 값이기 때문이다. 고르지 - 않았으면 기록에서 뽑는다: 이 프로젝트의 공개 기록이 어느 주제에 사는지가 곧 이 프로젝트가 - 다루는 주제다. - - 번호와 화살표로 순서를 보이고, 주제마다 한 줄 설명과 이 프로젝트가 그 주제에 남긴 기록 - 수만 붙인다. 기록 자체는 주제 화면이 편다. - */} - ); } diff --git a/src/features/tech-log/presentation/public/pages/question-page.tsx b/src/features/tech-log/presentation/public/pages/question-page.tsx index c796ed5..c766c4d 100644 --- a/src/features/tech-log/presentation/public/pages/question-page.tsx +++ b/src/features/tech-log/presentation/public/pages/question-page.tsx @@ -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 ? ( - + ) : ( ); diff --git a/src/features/tech-log/presentation/public/pages/reference-page.tsx b/src/features/tech-log/presentation/public/pages/reference-page.tsx index 03dd9d5..198ea49 100644 --- a/src/features/tech-log/presentation/public/pages/reference-page.tsx +++ b/src/features/tech-log/presentation/public/pages/reference-page.tsx @@ -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 ? ( - + ) : ( ); diff --git a/src/features/tech-log/presentation/public/pages/setup-page.tsx b/src/features/tech-log/presentation/public/pages/setup-page.tsx index 865c6fc..4f4548d 100644 --- a/src/features/tech-log/presentation/public/pages/setup-page.tsx +++ b/src/features/tech-log/presentation/public/pages/setup-page.tsx @@ -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 ? ( - + ) : ( ); diff --git a/src/features/tech-log/presentation/public/pages/topic-page.tsx b/src/features/tech-log/presentation/public/pages/topic-page.tsx index 6bc3d3d..024d5c8 100644 --- a/src/features/tech-log/presentation/public/pages/topic-page.tsx +++ b/src/features/tech-log/presentation/public/pages/topic-page.tsx @@ -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 ; 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 (
      @@ -83,23 +98,17 @@ export function TopicPage() { )} - {/* - 기록이 하나뿐인 주제는 제목과 한 줄, 목록 한 줄이 전부여서 "아직 아무것도 없는 곳"과 - "이제 막 시작한 조사"가 구분되지 않았다. 무엇이 있고 무엇이 아직 없는지를 먼저 말한다. - */} - - {topic.variants.length > 0 ? (
      -

      {axisLabel}

      +

      Knowledge

      {/* 이 표는 어디로 갈지 고르는 자리가 아니라 이 주제가 세운 모델 자체다. 한때 같은 네 줄이 홈에도 「주제별 흐름」이라는 이름으로 서 있었고, 그래서 읽는 사람에게는 또 하나의 길 안내처럼 보였다 — 홈에서 내리고 이름도 내용에 맞게 고친다. */} -

      {`이 주제가 세운 ${axisLabel}`}

      +

      이 Topic에서 확립한 핵심 모델

      {/* 오른쪽 숫자를 더해도 아래 목록의 개수와 맞지 않는다. 한 기록이 여러 축에 걸릴 수 있고, 어느 축에도 걸리지 않은 기록은 공통이기 때문이다 — 그 규칙을 화면이 말하지 @@ -132,13 +141,16 @@ export function TopicPage() { 흐름에 오른 편은 여기서 뺀다. 예전에는 같은 네 편이 위아래로 두 번 나왔다 — 순서를 정해 준 자리가 목록의 앞부분을 복사한 것처럼 보이면 순서를 정해 준 뜻이 없어진다. */} -
      -

      정리해 둔 것

      +
      +
      +

      Knowledge

      +

      정리된 개념과 기준

      +

      {`${knowledge.length}개`}

      {/* @@ -147,8 +159,11 @@ export function TopicPage() { */} {open.length > 0 ? ( <> -
      -

      아직 답하지 못한 것

      +
      +
      +

      Open

      +

      아직 답하지 못한 질문

      +

      {`${open.length}개`}

      diff --git a/src/features/tech-log/presentation/shared/public-render/context-navigator.tsx b/src/features/tech-log/presentation/shared/public-render/context-navigator.tsx deleted file mode 100644 index e0f986f..0000000 --- a/src/features/tech-log/presentation/shared/public-render/context-navigator.tsx +++ /dev/null @@ -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]; -} - -/** - * 이 기록이 어느 조사의 어디쯤인지. - * - *

      이 사이트의 차별점은 "기록 하나에 아무 데서나 들어와도 그 결론을 만든 맥락의 사슬을 잃지 - * 않는다"는 것이다. 그런데 그 사슬이 화면에서는 제목 위 얇은 breadcrumb 한 줄과 문서 맨 아래 - * 「다음에 읽을 것」으로만 표현돼 있었다 — 검색으로 Case 하나에 들어온 사람은 바닥까지 내려가야 - * 이 기록이 어느 프로젝트의 어느 질문에서 나왔는지 알 수 있었다. 저장은 되어 있는데 겪게 되지는 - * 않는 상태였다. - * - *

      그래서 제목·요약 바로 아래에 맥락을 하나의 덩어리로 세운다. 프로젝트 → 주제까지 올라가는 - * 길과, 같은 조사 안에서 이웃한 기록들을 함께 보인다. 지금 보는 기록은 링크가 아니라 현재 - * 위치로 표시한다. - * - *

      이웃 기록에는 작성자가 그 관계에 남긴 문장을 그대로 붙인다. 「다음에 무엇을 읽을지」보다 - * 「왜 그것을 읽어야 하는지」가 먼저 있어야 목록이 아니라 사슬로 읽힌다. - * - *

      `

      ` 하나로 두 폭을 모두 쓴다. 좁은 화면에서는 접을 수 있고, 넓은 화면에서는 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 ( -
      -
      - 이 기록의 맥락 - -
      -
      - ); -} 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 fe00dc8..002dfb2 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 @@ -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 ( + + ); +} + function ModelDocumentHeader({ model, resolvePublishedLabel, @@ -77,25 +94,8 @@ function ModelDocumentHeader({ }) { return (
      - + +

      {DOCUMENT_KIND_LABELS[model.kind]}

      {model.title}

      @@ -145,9 +145,11 @@ function publicRelations( function StructuredRecordRail({ model, sections, + navigation, }: { model: PublicRenderModelBase; sections: ReadonlyArray<{ id: string; label: string }>; + navigation?: RecordNavigation; }) { return ( ); } @@ -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" : ""}`} >
      - + +

      {DOCUMENT_KIND_LABELS.CASE}

      {model.title}

      @@ -273,8 +267,6 @@ function CaseDocument({
      - -
      @@ -288,7 +280,7 @@ function CaseDocument({ } + context={} />
      @@ -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" : ""}`} >
      - + +

      {DOCUMENT_KIND_LABELS.CONCEPT}

      {model.title}

      @@ -354,8 +338,6 @@ function ConceptDocument({
      - -
      @@ -369,7 +351,7 @@ function ConceptDocument({ } + context={} />
      @@ -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" : ""}`} >
      - + +

      {DOCUMENT_KIND_LABELS.SETUP}

      {model.title}

      @@ -447,8 +417,6 @@ function SetupDocument({
      - -
      @@ -462,7 +430,7 @@ function SetupDocument({ } + context={} />
      @@ -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} />
      -
      @@ -564,7 +533,7 @@ function ReferenceDocument({
      - +
      ); @@ -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} />
      -

      - +
      ); @@ -732,7 +702,6 @@ function ProjectDecisionDocument({ ) : null} -
      1. @@ -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": diff --git a/src/features/tech-log/presentation/shared/public-render/rail-context.tsx b/src/features/tech-log/presentation/shared/public-render/rail-context.tsx index 2353f46..b151a99 100644 --- a/src/features/tech-log/presentation/shared/public-render/rail-context.tsx +++ b/src/features/tech-log/presentation/shared/public-render/rail-context.tsx @@ -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 ( ); } diff --git a/src/features/tech-log/presentation/shared/public-render/record-navigation.ts b/src/features/tech-log/presentation/shared/public-render/record-navigation.ts new file mode 100644 index 0000000..7548822 --- /dev/null +++ b/src/features/tech-log/presentation/shared/public-render/record-navigation.ts @@ -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; +}>; diff --git a/src/features/tech-log/presentation/styles/globals.css b/src/features/tech-log/presentation/styles/globals.css index bbae0ab..eb13a60 100644 --- a/src/features/tech-log/presentation/styles/globals.css +++ b/src/features/tech-log/presentation/styles/globals.css @@ -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, diff --git a/tests/component/inline-line-breaks.test.tsx b/tests/component/inline-line-breaks.test.tsx index 58e02e1..417beda 100644 --- a/tests/component/inline-line-breaks.test.tsx +++ b/tests/component/inline-line-breaks.test.tsx @@ -98,9 +98,18 @@ describe("문서 머리말의 요약", () => { /> , ); - const paragraphs = container.querySelectorAll(".public-document-header p"); + /* + 머리말에는 요약 말고도 종류를 적은 한 줄(`.section-kicker`)이 있다. 이 가드가 보는 것은 + 요약이 문단으로 나뉘는가이므로 그 줄은 빼고 센다 — 예전처럼 머리말의 `

        ` 를 전부 세면 + 머리말에 줄이 하나 늘 때마다 요약과 상관없이 깨진다. + */ + const paragraphs = container.querySelectorAll( + ".public-document-header p:not(.section-kicker)", + ); expect(paragraphs).toHaveLength(2); - expect(container.querySelectorAll(".public-document-header p br")).toHaveLength(1); + expect( + container.querySelectorAll(".public-document-header p:not(.section-kicker) br"), + ).toHaveLength(1); expect(paragraphs[0]).toHaveTextContent("둘 다 메모리에 있다."); expect(paragraphs[1]).toHaveTextContent("인스턴스를 늘리면 설계가 필요하다."); }); diff --git a/tests/features/tech-log/context-navigator.test.tsx b/tests/features/tech-log/context-navigator.test.tsx index cda2d42..175c32f 100644 --- a/tests/features/tech-log/context-navigator.test.tsx +++ b/tests/features/tech-log/context-navigator.test.tsx @@ -116,16 +116,39 @@ const dependencies = { resolvePublishedLabel: ResolvePublishedLabel; }; -describe("기록마다 맥락이 제목 바로 아래에 있다", () => { - for (const [kind, model] of Object.entries(MODELS)) { - it(`${kind} 기록이 프로젝트·주제·이웃 기록을 함께 보여 준다`, () => { +describe("Record는 위치와 앞뒤 탐색만 보여 준다", () => { + const navigation = { + previous: { + label: "열린 질문", + title: "앞에서 확인할 질문", + path: "/questions/previous", + }, + next: { + label: "적용 기준", + title: "다음에 읽을 기준", + path: "/references/next", + }, + } as const; + + for (const kind of ["CASE", "CONCEPT", "SETUP", "REFERENCE", "QUESTION"] as const) { + it(`${kind} 기록이 Project / Topic / Previous / Current / Next만 rail에 보여 준다`, () => { render( - + , ); - const context = screen.getByRole("navigation", { name: "이 기록의 맥락" }); + // 예전처럼 제목 아래에 별도 Context Path를 다시 그리지 않는다. + expect(screen.queryByRole("navigation", { name: "이 기록의 맥락" })).toBeNull(); + + const breadcrumb = screen.getByRole("navigation", { name: "문서 경로" }); + expect(breadcrumb).toHaveTextContent("가상화/CPU 가상화"); + + const context = screen.getByRole("navigation", { name: "읽기 맥락" }); expect(within(context).getByRole("link", { name: "가상화" })).toHaveAttribute( "href", "/projects/gasanghwa", @@ -134,28 +157,22 @@ describe("기록마다 맥락이 제목 바로 아래에 있다", () => { "href", "/topics/cpu", ); - // 이웃 기록은 제목만이 아니라 "왜 그것을 읽어야 하는지"를 함께 보여야 사슬로 읽힌다. - expect(within(context).getByRole("link", { name: "이어지는 기준" })).toBeInTheDocument(); - expect( - within(context).getByText("이 기록의 결론이 그대로 이 기준이 되었다."), - ).toBeInTheDocument(); - // 지금 보는 기록도 목록에 있어야 "내가 그중 어디인가"가 보인다. - expect(within(context).getByText("지금 읽는 기록")).toBeInTheDocument(); + expect(within(context).getByRole("link", { name: /앞에서 확인할 질문/ })).toHaveAttribute( + "href", + "/questions/previous", + ); + expect(within(context).getByText(/Current/)).toBeInTheDocument(); + expect(within(context).getByRole("link", { name: /다음에 읽을 기준/ })).toHaveAttribute( + "href", + "/references/next", + ); }); } - it("올라갈 곳도 옆으로 갈 곳도 없으면 빈 상자를 남기지 않는다", () => { + it("Project Decision도 본문 위에 별도 Context Path를 만들지 않는다", () => { render( - + , ); diff --git a/tests/features/tech-log/public-discovery-screens.test.tsx b/tests/features/tech-log/public-discovery-screens.test.tsx index 9330821..29538b5 100644 --- a/tests/features/tech-log/public-discovery-screens.test.tsx +++ b/tests/features/tech-log/public-discovery-screens.test.tsx @@ -125,7 +125,7 @@ afterEach(() => { }); describe("TechLog home discovery", () => { - it("renders the exact identity, now block, latest ordering, and explore choices", async () => { + it("renders the exact identity and the NOW → PROJECTS → RECENT hierarchy", async () => { await renderDiscoveryRoute("TECH_LOG_HOME", "/"); expect(screen.getByRole("heading", { level: 1, name: "TechLog" })).toBeVisible(); @@ -152,7 +152,7 @@ describe("TechLog home discovery", () => { 홈의 입구는 프로젝트다. 맥락을 자세히 그리는 일은 프로젝트·주제 화면이 맡고, 홈은 어디로 들어갈지 정하게 한다. */ - const projects = screen.getByRole("region", { name: "조사가 사는 곳" }); + const projects = screen.getByRole("region", { name: "프로젝트" }); expect(within(projects).getAllByRole("listitem").length).toBeGreaterThan(0); /* @@ -181,17 +181,9 @@ describe("TechLog home discovery", () => { Array.from(latest.querySelectorAll(".latest-time > span"), (span) => span.textContent), )].every((label) => /^[가-힣 ]+$/u.test(label ?? "")), ).toBe(true); - /* - 종류별 입구. 예전에는 이 자리가 낱말 뜻풀이였고 이름이 `Case`·`OpenQuestion` 같은 - 저장소의 말이었다. 이름이 하는 일을 말하도록 바뀌었으므로 설명도 함께 바뀐다. - 프로젝트는 종류가 아니라 그릇이므로 이 목록에서 뺐다 — 주 내비가 이미 데려간다. - */ - expect( - screen.getByRole("link", { name: /무엇을 해보고 무엇을 확인했는지.*검증 기록/ }), - ).toHaveAttribute("href", "/explore/cases"); - expect( - screen.getByRole("link", { name: /아직 답하지 못한 것과 다음 검증.*열린 질문/ }), - ).toHaveAttribute("href", "/explore/questions"); + // Home은 계층별 Context Path를 그리지 않는다. 현재 작업과 Project 입구만 남긴다. + expect(screen.queryByText(/한 프로젝트의 맥락을 따라 읽습니다/)).toBeNull(); + expect(screen.queryByText("종류별로 읽기")).toBeNull(); }); it("preserves the source home empty and error states", async () => { diff --git a/tests/features/tech-log/public-document-screens.test.tsx b/tests/features/tech-log/public-document-screens.test.tsx index 72a6fc6..36cda92 100644 --- a/tests/features/tech-log/public-document-screens.test.tsx +++ b/tests/features/tech-log/public-document-screens.test.tsx @@ -219,7 +219,12 @@ describe("TechLog canonical Public documents", () => { const [firstEvidence] = within(main).getAllByText(evidence, { exact: false }); expect(firstEvidence).toBeVisible(); const breadcrumb = within(main).getByRole("navigation", { name: "문서 경로" }); - expect(breadcrumb).toHaveTextContent(`${kind}/${topic}/${project}`); + expect(breadcrumb).toHaveTextContent(`${project}/${topic}`); + expect(breadcrumb).not.toHaveTextContent(kind); + const typeLabel = main.querySelector( + ".case-header > .section-kicker, .public-document-header > .section-kicker", + ); + expect(typeLabel).toHaveTextContent(kind); /* 글자만 보고 있었더니 주제 링크가 어디로 가는지는 아무도 묻지 않았다. 그 링크는 `/topics/:slug` 를 가리켰고, 그 화면은 세 개의 주제를 하드코딩해 두고 있어 실제 주제는 @@ -349,7 +354,7 @@ describe("TechLog topics and Public not-found routing", () => { await renderDocumentRoute("TECH_LOG_TOPIC", `/topics/${slug}`); expect(screen.getByRole("heading", { level: 1, name: title })).toBeVisible(); - expect(screen.getByRole("heading", { name: "정리해 둔 것" })).toBeVisible(); + expect(screen.getByRole("heading", { name: "정리된 개념과 기준" })).toBeVisible(); }); /* @@ -361,24 +366,27 @@ describe("TechLog topics and Public not-found routing", () => { 아직 답하지 못한 질문은 흐름에 넣지 않는다. 마지막 칸에 두면 이 주제가 질문으로 끝난 것처럼 읽히고, 그것은 사고의 결과가 아니라 다음 할 일이다. */ - it("orders the reasoning path by kind and does not repeat it below", async () => { + it("separates Record reasoning flow from Knowledge and Open", async () => { const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/jpa"); const steps = [...container.querySelectorAll(".context-flow__copy")].map((copy) => ({ label: copy.querySelector(".context-flow__meta")?.textContent, href: copy.querySelector("a")?.getAttribute("href"), })); - expect(steps.map((entry) => entry.label)).toEqual(["검증 기록", "적용 기준"]); + expect(steps.map((entry) => entry.label)).toEqual([ + "검증 기록", + "열린 질문", + "적용 기준", + "결정", + ]); - // 흐름에 오른 편은 아래 목록에서 빠진다 — 같은 편이 두 번 나오면 순서를 정해 준 뜻이 없다. - const rest = [...container.querySelectorAll(".public-record-list > li > a")].map((link) => + // Knowledge는 navigation의 나머지가 아니라 Topic에서 정리한 Concept / Reference 콘텐츠다. + const knowledge = [...container.querySelectorAll(".public-record-list > li > a")].map((link) => link.getAttribute("href"), ); - for (const entry of steps) { - expect(rest).not.toContain(entry.href); - } - expect(rest).toContain("/questions/collection-fetch-join-with-pagination"); - expect(screen.getByRole("heading", { name: "아직 답하지 못한 것" })).toBeVisible(); + expect(knowledge).toContain("/references/jpa-list-fetch-strategy"); + // 해결된 질문은 Reasoning Path에는 남아도 OPEN으로 다시 나타나지 않는다. + expect(screen.queryByRole("heading", { name: "아직 답하지 못한 질문" })).toBeNull(); }); /* @@ -395,27 +403,23 @@ describe("TechLog topics and Public not-found routing", () => { ).not.toBeInTheDocument(); }); - /* - 흐름이 서지 않는 주제에서도 기록은 남아야 한다. 흐름을 그릴지 말지를 화면 안에서만 판단했을 - 때, 기록이 하나뿐인 주제는 흐름도 없고 목록도 "흐름에 올랐다" 며 그 하나를 빼서 화면에 - 아무것도 남지 않았다. - */ - it("keeps the only record of a single-record topic visible", async () => { + it("keeps a sparse Topic useful when a Record leads directly to a Decision", async () => { const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/redis"); - expect(container.querySelectorAll(".context-flow").length).toBe(0); expect( Array.from( - container.querySelectorAll(".public-record-list > li > a"), + container.querySelectorAll(".context-flow__copy > a"), (link) => link.getAttribute("href"), ), - ).toContain("/cases/redis-adapter-ttl-boundary"); + ).toEqual([ + "/cases/redis-adapter-ttl-boundary", + "/projects/backend-skeleton/decisions#storage-port-unification", + ]); }); it("keeps JPA topic records in canonical reasoning order", async () => { const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/jpa"); - // 픽스처의 JPA 주제는 종류마다 한 편씩이다. 원리가 없으므로 흐름은 확인 → 기준 둘이다. expect( Array.from( container.querySelectorAll(".context-flow__copy > a"), @@ -423,7 +427,9 @@ describe("TechLog topics and Public not-found routing", () => { ), ).toEqual([ "/cases/collection-fetch-join-pagination", + "/questions/collection-fetch-join-with-pagination", "/references/jpa-list-fetch-strategy", + "/projects/backend-skeleton/decisions#feed-pagination-boundary", ]); });