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 61f89bb..3a84b0b 100644 --- a/src/features/tech-log/presentation/public/pages/home-page.tsx +++ b/src/features/tech-log/presentation/public/pages/home-page.tsx @@ -1,6 +1,9 @@ import { Link } from "react-router-dom"; -import type { PublicContentQueries } from "../../../application/ports/public-content-queries.ts"; +import type { + PublicContentQueries, + PublicTopicDetail, +} from "../../../application/ports/public-content-queries.ts"; import { publicSiteConfig } from "../../../contracts/public-site-config.ts"; import { normalizeFocus } from "../../../domain/public/focus-state.ts"; import { useRouteInput } from "../../../../../presentation/routes/route-input.tsx"; @@ -11,7 +14,10 @@ import { LatestIndex, type LatestEntry, } from "../components/latest-index.tsx"; -import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts"; +import { + DOCUMENT_KIND_LABELS, + EXPLORE_KIND_PATHS, +} from "../../shared/document-kind-labels.ts"; /* 종류별 입구. 예전에는 여기가 "이 낱말은 이런 뜻입니다" 하는 범례였고, 그 낱말을 쓰는 목록은 @@ -22,21 +28,10 @@ import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts"; 어디에도 없는 여섯 번째 표기가 생겨 있었다. */ const exploreEntries = [ - { - kind: "CASE", - description: "무엇을 해보고 무엇을 확인했는지", - path: "/explore/cases", - }, - { - kind: "REFERENCE", - description: "다음에 같은 판단을 할 때 볼 것", - path: "/explore/references", - }, - { - kind: "QUESTION", - description: "아직 답하지 못한 것과 다음 검증", - path: "/explore/questions", - }, + { kind: "CASE", description: "무엇을 해보고 무엇을 확인했는지" }, + { kind: "CONCEPT", description: "안에서 실제로 무슨 일이 일어나는지" }, + { kind: "REFERENCE", description: "다음에 같은 판단을 할 때 볼 것" }, + { kind: "QUESTION", description: "아직 답하지 못한 것과 다음 검증" }, ] as const; function optionalString(value: unknown): string | undefined { @@ -122,20 +117,41 @@ function dateLabel(isoTimestamp: string): string { ).padStart(2, "0")}`; } +/** + * 홈이 앞에 세울 주제 하나. + * + *

가장 많이 다룬 주제를 고른다 — 기록이 가장 많이 쌓인 곳이 이 기록의 중심이고, 그 주제 + * 안에서 무엇을 견줬는지가 방문자가 30초 안에 알아야 할 것이다. 축을 쓰지 않는 주제라면 + * 견줄 것이 없으므로 이 구역을 그리지 않는다. + * + *

요청은 둘이다(목록 하나 + 상세 하나). 주제마다 상세를 부르면 주제 수만큼 늘어난다 — + * 홈의 최근 기록이 프로젝트마다 요청을 보내던 시절에 겪은 것과 같은 모양이다. + */ +async function getFeaturedTopic( + publicContent: PublicContentQueries, +): Promise { + const topics = await publicContent.listTopics(); + const first = topics[0]; + if (!first) return null; + const detail = await publicContent.getTopicDetail(first.slug); + return detail && detail.variants.length > 1 ? detail : null; +} + export function HomePage() { const { search } = useRouteInput<"TECH_LOG_HOME">(); const requestedKey = optionalString(search.focus); const requestedState = optionalString(search.state); const view = usePublicContent(["tech-log", "home"], async (queries) => { - const [focusItems, latestEntries] = await Promise.all([ + const [focusItems, latestEntries, featuredTopic] = await Promise.all([ queries.getHomeFocusItems(), getLatestEntries(queries), + getFeaturedTopic(queries), ]); - return { focusItems, latestEntries }; + return { focusItems, latestEntries, featuredTopic }; }); if (!view.ready) return view.fallback; - const { focusItems, latestEntries } = view.data; + const { focusItems, latestEntries, featuredTopic } = view.data; const availableFocusItems = requestedState === "focus-empty" ? [] : focusItems; const normalizedKey = normalizeFocus( requestedKey, @@ -172,6 +188,33 @@ export function HomePage() { ) : null} + {/* + 30초 안에 알아야 할 것은 「무엇을 만들었나」가 아니라 「무엇을 견줬고 무엇이 남았나」다. + 축마다 만들어 보고 무엇을 알게 됐는지(결론)를 나란히 둔다 — 요약을 쓰면 무엇인가만 + 말하고 무엇을 알게 됐는지는 말하지 않는다. + */} + {featuredTopic ? ( +

+

+ {featuredTopic.variantLabel.trim() || "Comparison"} +

+

+ {featuredTopic.name} + {" — 무엇을 견줬나"} +

+ +
+ ) : null} + {exploreEntries.map((entry) => (
  • - + {entry.description} {DOCUMENT_KIND_LABELS[entry.kind]} diff --git a/src/features/tech-log/presentation/shared/document-kind-labels.ts b/src/features/tech-log/presentation/shared/document-kind-labels.ts index e1b1804..6a3cc01 100644 --- a/src/features/tech-log/presentation/shared/document-kind-labels.ts +++ b/src/features/tech-log/presentation/shared/document-kind-labels.ts @@ -39,3 +39,21 @@ export const DOCUMENT_KIND_STATES: Record이 대응이 세 화면에 흩어져 있었고 셋 다 개념을 빠뜨렸다 — 홈의 「종류별로 읽기」에는 개념이 + * 아예 없었고, 문서 머리말의 종류 링크는 삼항의 마지막 else 를 타 개념 문서에서 `/projects` 로 + * 갔다. `/explore/concepts` 는 처음부터 열려 있었는데 그리로 가는 길이 없었다. + * + *

    결정은 프로젝트 안에서만 읽히므로 자기 목록이 없다. 그 자리를 `/projects` 로 두는 것은 + * 빠뜨린 것이 아니라 그렇게 정한 것이고, 표에 적혀 있으니 다음 사람이 구분할 수 있다. + */ +export const EXPLORE_KIND_PATHS: Record = { + CASE: "/explore/cases", + CONCEPT: "/explore/concepts", + REFERENCE: "/explore/references", + QUESTION: "/explore/questions", + PROJECT_DECISION: "/projects", +}; 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 50803b3..b5f814e 100644 --- a/src/features/tech-log/presentation/shared/public-render/public-record-renderer.tsx +++ b/src/features/tech-log/presentation/shared/public-render/public-record-renderer.tsx @@ -13,7 +13,7 @@ import { PublicDocumentRelations, type PublicRelation, } from "./public-document-relations.tsx"; -import { DOCUMENT_KIND_LABELS } from "../document-kind-labels.ts"; +import { DOCUMENT_KIND_LABELS, EXPLORE_KIND_PATHS } from "../document-kind-labels.ts"; import { useDocumentMetadata } from "../use-document-metadata.ts"; type PublicRenderModel = components["schemas"]["PublicRenderModel"]; @@ -50,10 +50,7 @@ function publishedLabel( } function explorePath(kind: PublicRenderModelBase["kind"]) { - if (kind === "CASE") return "/explore/cases"; - if (kind === "REFERENCE") return "/explore/references"; - if (kind === "QUESTION") return "/explore/questions"; - return "/projects"; + return EXPLORE_KIND_PATHS[kind]; } function TargetLink({ @@ -168,7 +165,7 @@ function CaseDocument({ >