feat: 화면마다 제 바로 아래 한 계층만 설명하게 한다

홈에 「맥락 흐름」(기록의 사슬)·「지금 집중하는 것」(작업 상태)·「주제별 흐름」(주제 내부
구조)이 연달아 섰다. 데이터로는 서로 다른 계층이지만 읽는 사람에게는 셋 다 "그래서 뭘
읽으라는 거지" 에 답하는 같은 종류의 안내였고, 같은 말을 세 방식으로 반복하는 화면이 됐다.

계층마다 제 자리를 준다.

- 홈: 지금 무엇을 하고 있는가. 탭 셋을 한 번에 펴고(`HomeNow`), 맥락 흐름과 주제 비교를
  내리고, 들어갈 입구로 프로젝트 목록을 세운다. 고를 것이 없어졌으므로 주소의 `focus` 도
  계약에서 내린다.
- 프로젝트: 어떤 주제 순서로 파고들었는가. 기록을 펼치던 조사 지도를 주제까지만 그리는
  흐름(`ProjectPath`)으로 바꾼다. 한 줄 설명은 주제 목록에서 찾아 붙인다.
- 주제: 어떤 순서로 생각했는가. 원리 → 확인 → 기준을 흐름으로 세우고(`TopicReasoningPath`),
  남은 기록은 「정리해 둔 것」, 답하지 못한 질문은 「아직 답하지 못한 것」이 받는다. 축 비교표는
  길 안내가 아니라 이 주제가 세운 모델이므로 이름을 그렇게 고친다.

기록 화면은 그대로다 — 위치와 앞뒤만 보이고 새 맥락 경로를 다시 그리지 않는다.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-16 18:06:37 +09:00
co-authored by Claude Opus 5
parent 7dda6c7923
commit 40b0176824
19 changed files with 578 additions and 1899 deletions
@@ -1,41 +0,0 @@
export function normalizeFocus(
value: string | null | undefined,
availableKeys: readonly string[],
): string | null {
if (availableKeys.length === 0) return null;
return value && availableKeys.includes(value) ? value : availableKeys[0];
}
/**
* A missing query is the default home URL, while an explicitly empty or
* invalid query must be replaced with the selected fallback.
*/
export function shouldNormalizeFocusUrl(
requestedKey: string | undefined,
normalizedKey: string,
): boolean {
return requestedKey !== undefined && requestedKey !== normalizedKey;
}
export function moveFocus(
current: string,
key: string,
availableKeys: readonly string[],
): string | null {
if (availableKeys.length === 0) return null;
const currentIndex = Math.max(0, availableKeys.indexOf(current));
if (key === "Home") return availableKeys[0];
if (key === "End") return availableKeys[availableKeys.length - 1];
if (key === "ArrowLeft") {
return availableKeys[
(currentIndex - 1 + availableKeys.length) % availableKeys.length
];
}
if (key === "ArrowRight") {
return availableKeys[(currentIndex + 1) % availableKeys.length];
}
return availableKeys[currentIndex];
}
@@ -1,153 +0,0 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { Link, useLocation, useNavigate } from "react-router-dom";
import type {
FocusKey,
HomeFocusItem,
} from "../../../application/ports/public-content-queries.ts";
import {
moveFocus,
shouldNormalizeFocusUrl,
} from "../../../domain/public/focus-state.ts";
import { cardSummary } from "../../../domain/content-format/card-summary.ts";
type HomeFocusProps = {
items: ReadonlyArray<HomeFocusItem>;
initialKey: FocusKey;
requestedKey?: string;
};
export function HomeFocus({
items,
initialKey,
requestedKey,
}: HomeFocusProps) {
const [activeKey, setActiveKey] = useState<FocusKey>(initialKey);
const buttons = useRef<Array<HTMLButtonElement | null>>([]);
const location = useLocation();
const navigate = useNavigate();
const keys = items.map((item) => item.key);
const activeItem = items.find((item) => item.key === activeKey) ?? items[0];
const replaceFocus = useCallback(
(key: FocusKey) => {
const search = new URLSearchParams(location.search);
search.set("focus", key);
void navigate(
{
pathname: location.pathname,
search: `?${search.toString()}`,
hash: location.hash,
},
{ replace: true },
);
},
[location.hash, location.pathname, location.search, navigate],
);
useEffect(() => {
setActiveKey(initialKey);
}, [initialKey]);
useEffect(() => {
if (!shouldNormalizeFocusUrl(requestedKey, initialKey)) return;
replaceFocus(initialKey);
}, [initialKey, replaceFocus, requestedKey]);
function select(key: FocusKey, moveKeyboardFocus = false) {
setActiveKey(key);
replaceFocus(key);
if (moveKeyboardFocus) {
requestAnimationFrame(() => {
buttons.current[keys.indexOf(key)]?.focus();
});
}
}
function onKeyDown(event: React.KeyboardEvent<HTMLButtonElement>) {
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) {
return;
}
event.preventDefault();
const next = moveFocus(activeKey, event.key, keys);
if (next === "current" || next === "question" || next === "decision") {
select(next, true);
}
}
if (!activeItem) return null;
const usesTabs = items.length > 1;
const renderedItems = usesTabs ? items : [activeItem];
return (
<>
{usesTabs ? (
<div className="focus-tabs" role="tablist" aria-label="집중 항목 선택">
{items.map((item, index) => {
const selected = item.key === activeKey;
return (
<button
key={item.key}
ref={(button) => {
buttons.current[index] = button;
}}
id={"focus-tab-" + item.key}
type="button"
role="tab"
aria-selected={selected}
aria-controls={"focus-panel-" + item.key}
tabIndex={selected ? 0 : -1}
onClick={() => select(item.key)}
onKeyDown={onKeyDown}
>
{item.label}
</button>
);
})}
</div>
) : null}
{renderedItems.map((item) => {
const selected = item.key === activeKey;
const shown = item.details.filter((detail) => detail.value.trim() !== "");
return (
<article
className="focus-content"
id={"focus-panel-" + item.key}
key={item.key}
role={usesTabs ? "tabpanel" : undefined}
aria-labelledby={usesTabs ? "focus-tab-" + item.key : undefined}
hidden={!selected}
>
<div className="focus-summary">
<h2>{item.title}</h2>
{/* 프로젝트 한 줄 설명이 비어 있을 수 있다 — 그때는 빈 문단을 두지 않는다. */}
{item.summary.trim() ? <p>{cardSummary(item.summary)}</p> : null}
<Link className="text-link" to={item.targetPath}>
작업 맥락 보기 <span aria-hidden="true">↗</span>
</Link>
</div>
{/*
값이 없는 항목은 그리지 않는다. 「현재 목표」·「다음 작업」을 아직 적지 않은
프로젝트에서 라벨과 구분선만 남아 빈 칸 두 개가 화면에 있었다 — 비어 있다는 사실을
보여 줄 이유가 없는 자리다.
*/}
{shown.length > 0 ? (
<dl className="focus-details">
{shown.map((detail) => (
<div key={detail.label}>
<dt>{detail.label}</dt>
<dd>{detail.value}</dd>
</div>
))}
</dl>
) : null}
</article>
);
})}
</>
);
}
@@ -1,75 +0,0 @@
import { Link } from "react-router-dom";
import type { LatestEntry } from "./latest-index.tsx";
const PATH_SIZE = 4;
/**
* 홈에서 실제 프로젝트 하나를 이용해 이 사이트의 읽는 방식을 보여 준다.
*
* 단순 행 목록이 아니라 하나의 investigation sequence로 보이게 한다. 기록 종류와 주제는
* 보조 정보이고, 제목과 짧은 요약이 단계의 본문이다.
*/
export function HomeInvestigationPath({ entries }: { entries: ReadonlyArray<LatestEntry> }) {
const records = entries.filter((entry) => entry.typeState !== undefined && entry.topic);
const byProject = new Map<string, LatestEntry[]>();
for (const record of records) {
const bucket = byProject.get(record.project);
if (bucket) bucket.push(record);
else byProject.set(record.project, [record]);
}
let lead: LatestEntry[] = [];
for (const bucket of byProject.values()) {
if (bucket.length > lead.length) lead = bucket;
}
if (lead.length < 2) return null;
const head = lead[0]!;
const path = lead.slice(0, PATH_SIZE);
return (
<section className="shell home-path" aria-labelledby="home-path-title">
<div className="home-path__intro">
<div>
<p className="section-kicker">Context path</p>
<h2 id="home-path-title">한 프로젝트의 맥락을 따라 읽습니다</h2>
</div>
<p>
한 편의 글로 끝내지 않고, 같은 프로젝트 안에서 서로 다른 주제를 오가며
확인한 기록을 이어 봅니다.
</p>
</div>
<div className="home-path__project">
<span>Project</span>
<strong>{head.project}</strong>
</div>
<ol className="home-path-records">
{path.map((record, index) => (
<li key={record.path}>
<div className="home-path-step" aria-hidden="true">
<span>{String(index + 1).padStart(2, "0")}</span>
</div>
<div className="home-path-copy">
<p className="home-path-meta">
{record.typeLabel}
{record.topic ? <><span aria-hidden="true">·</span>{record.topic}</> : null}
</p>
<Link to={record.path}>{record.title}</Link>
{record.summary.trim() ? <p>{firstSentence(record.summary)}</p> : null}
</div>
</li>
))}
</ol>
</section>
);
}
function firstSentence(summary: string): string {
const line = summary.split(/\n+/u)[0]?.trim() ?? "";
const stop = line.search(/[.。]\s|다\s/u);
return stop > 0 ? line.slice(0, stop + 1) : line;
}
@@ -0,0 +1,61 @@
import { Link } from "react-router-dom";
import type { HomeFocusItem } from "../../../application/ports/public-content-queries.ts";
import { cardSummary } from "../../../domain/content-format/card-summary.ts";
/**
* 홈이 말하는 단 하나 — 지금 무엇을 하고 있는가.
*
* <p>예전에는 탭 세 개였다. 「지금 하는 일」·「열린 질문」·「최근 결정」이 서로를 가린 채 한
* 번에 하나씩 나왔고, 나머지 둘이 있다는 것은 탭 이름으로만 알 수 있었다. 세 줄짜리 정보를
* 고르게 만들 이유가 없다 — 고르는 동작은 값이 많을 때 쓴다.
*
* <p>그래서 셋을 한 번에 편다. 진행 중인 프로젝트가 머리에 서고, 열린 질문과 최근 결정이 그
* 아래 두 줄로 붙는다. 탭이 사라지면서 주소의 `focus` 값도 같이 사라졌다 — 고를 것이 없으면
* 고른 것을 기억할 이유도 없다.
*
* <p>값이 없는 칸은 그리지 않는다. 아직 적지 않은 「현재 목표」 자리에 라벨과 구분선만 남으면
* 화면이 덜 만들어진 것처럼 보이고, 읽는 사람은 그 프로젝트에 목표가 없다고 읽는다.
*/
export function HomeNow({ items }: { items: ReadonlyArray<HomeFocusItem> }) {
const lead = items.find((item) => item.key === "current") ?? items[0];
if (!lead) return null;
const rest = items.filter((item) => item.key !== lead.key);
const details = lead.details.filter((detail) => detail.value.trim() !== "");
return (
<section className="shell home-now" aria-labelledby="home-now-title">
<p className="section-kicker">Now</p>
<h2 id="home-now-title">{lead.title}</h2>
{lead.summary.trim() ? <p className="home-now__summary">{cardSummary(lead.summary)}</p> : null}
{details.length > 0 ? (
<dl className="home-now__details">
{details.map((detail) => (
<div key={detail.label}>
<dt>{detail.label}</dt>
<dd>{detail.value}</dd>
</div>
))}
</dl>
) : null}
<Link className="text-link home-now__target" to={lead.targetPath}>
프로젝트 보기 <span aria-hidden="true">↗</span>
</Link>
{rest.length > 0 ? (
<ul className="home-now__items">
{rest.map((item) => (
<li key={item.key}>
<p className="home-now__label">{item.label}</p>
<Link to={item.targetPath}>{item.title}</Link>
{item.summary.trim() ? <p>{cardSummary(item.summary)}</p> : null}
</li>
))}
</ul>
) : null}
</section>
);
}
@@ -1,225 +0,0 @@
import { useEffect, useRef, useState } from "react";
import { Link } from "react-router-dom";
import { useApplication } from "../../../../../presentation/providers/application-provider.tsx";
import { TECH_LOG_FEATURE_ID } from "../../../application/tech-log-feature-input.ts";
import type {
PublicRecord,
PublicTopic,
PublicTopicDetail,
} from "../../../application/ports/public-content-queries.ts";
import { moveFocus } from "../../../domain/public/focus-state.ts";
/**
* 홈에서 주제를 갈아 가며 그 안의 비교를 읽는 자리.
*
* <p>예전에는 주제 하나만 펴 두고 나머지는 아래 「다른 주제 N개 보기」 한 줄로 보냈다. 그 줄은
* 비교 목록 밑에 작은 글씨로 있어서 읽는 사람이 첫 주제를 다 읽고 나서야 만났고 대개 그냥
* 지나쳤다 — 실제로 JPA 주제는 홈에 있는데도 없는 것과 같았다. 주제 이름을 나란히 세우면
* 무엇이 더 있는지가 목록을 읽기 전에 먼저 보인다.
*
* <p>이름은 칩 크기로 적는다. 한때 구역 제목 급(30px)으로 세웠는데, 그 급은 주제가 둘일 때나
* 성립한다 — 열 개, 스무 개가 되면 이름만으로 화면이 덮인다. 지금 읽는 것이 무엇인지는 목록
* 바로 위의 축 이름과 「전체 보기」 줄이 말한다.
*
* <p>상세는 고른 것만 받는다. 주제마다 미리 받으면 요청 수가 주제 수만큼 늘어나고, 그것이
* 싫어 앞의 몇 개만 받으면 나머지는 다시 탭에 오르지 못한다 — 없애려던 문제로 되돌아간다.
* 목록은 한 번에 오고, 그 목록이 탭 전부다.
*/
export function HomeTopicTabs({
topics,
firstDetail,
}: {
topics: ReadonlyArray<PublicTopic>;
firstDetail: PublicTopicDetail;
}) {
const { publicContent } = useApplication().features.get(TECH_LOG_FEATURE_ID);
const [activeSlug, setActiveSlug] = useState(firstDetail.slug);
const [details, setDetails] = useState<Readonly<Record<string, PublicTopicDetail>>>({
[firstDetail.slug]: firstDetail,
});
const [failedSlug, setFailedSlug] = useState<string | null>(null);
/*
축을 쓰지 않는 주제의 기록.
처음에는 상세의 `featuredCases` 를 썼는데 그것은 작성자가 주제마다 손으로 골라 두는 값이라
대부분 비어 있다 — CPU 가상화에 글을 게시해도 홈 탭은 「아직 공개된 기록이 없습니다」였다.
게다가 그 칸은 Case 만 담아서, 게시한 것이 동작 원리면 애초에 담기지 않는다.
주제 화면이 하는 것과 같이 기록 자체를 읽는다.
*/
const [records, setRecords] = useState<Readonly<Record<string, ReadonlyArray<PublicRecord>>>>({});
const buttons = useRef<Array<HTMLButtonElement | null>>([]);
const slugs = topics.map((topic) => topic.slug);
const active = topics.find((topic) => topic.slug === activeSlug) ?? topics[0];
function select(slug: string, moveKeyboardFocus = false) {
setActiveSlug(slug);
setFailedSlug((failed) => (failed === slug ? null : failed));
if (moveKeyboardFocus) {
requestAnimationFrame(() => {
buttons.current[slugs.indexOf(slug)]?.focus();
});
}
loadRecordsIfNeeded(slug, details[slug]);
if (details[slug]) return;
void publicContent
.getTopicDetail(slug)
.then((detail) => {
if (!detail) {
setFailedSlug(slug);
return;
}
setDetails((loaded) => ({ ...loaded, [slug]: detail }));
loadRecordsIfNeeded(slug, detail);
})
/*
받지 못했다는 사실을 그 자리에 남긴다. 예전에 홈이 두 읽기를 `Promise.all` 로 묶었을 때는
하나가 실패하면 나머지까지 통째로 사라져, 무엇이 잘못됐는지 화면에 흔적이 없었다.
*/
.catch(() => setFailedSlug(slug));
}
/* 견줄 축이 없는 주제만 기록을 따로 받는다. 축이 있으면 축이 곧 목록이다. */
function loadRecordsIfNeeded(slug: string, detail: PublicTopicDetail | undefined) {
if (!detail || detail.variants.length > 1) return;
if (records[slug]) return;
void publicContent
.listRecords({ topic: slug })
.then((found) => setRecords((loaded) => ({ ...loaded, [slug]: found })))
.catch(() => setRecords((loaded) => ({ ...loaded, [slug]: [] })));
}
useEffect(() => {
loadRecordsIfNeeded(firstDetail.slug, firstDetail);
// 첫 주제는 상세가 이미 와 있으므로 여기서 한 번만 본다.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [firstDetail]);
function onKeyDown(event: React.KeyboardEvent<HTMLButtonElement>) {
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
event.preventDefault();
const next = moveFocus(active?.slug ?? "", event.key, slugs);
if (next) select(next, true);
}
if (!active) return null;
const detail = details[active.slug];
/*
축을 쓰는 주제는 축끼리 견주고, 아직 쓰지 않는 주제는 그 주제의 기록을 세운다.
예전에는 축이 둘 이상인 주제만 탭이 됐고 나머지는 목록 아래 한 줄짜리 링크로 갔다. 축은
주제가 자라면서 생기는 것이지 기록이 없다는 뜻이 아니다 — 축이 없다고 이름을 숨길 이유가
없다.
*/
const rows: ReadonlyArray<{ path: string; title: string; line: string }> = detail
? detail.variants.length > 1
? detail.variants.map((variant) => ({
path: variant.path,
title: variant.title,
line: variant.conclusion || variant.summary,
}))
: (records[active.slug] ?? []).map((record) => ({
path: record.path,
title: record.title,
line: record.summary,
}))
: [];
const comparing = (detail?.variants.length ?? 0) > 1;
const axisLabel = comparing
? (detail?.variantLabel ?? active.variantLabel).trim()
: "기록";
const multiple = topics.length > 1;
return (
<>
{/*
탭이 하나뿐이면 고를 것이 없다. 그래도 이름은 보여야 한다 — 아래 목록이 어느 주제의
것인지 말해 주는 자리이기 때문이다. 그래서 이름은 두고, 고르는 일만 없앤다.
*/}
<div
className="home-topic-tabs"
role={multiple ? "tablist" : undefined}
aria-label={multiple ? "주제 고르기" : undefined}
>
{topics.map((topic, index) => {
const selected = topic.slug === active.slug;
return (
<button
key={topic.slug}
ref={(button) => {
buttons.current[index] = button;
}}
id={`home-topic-tab-${topic.slug}`}
type="button"
role={multiple ? "tab" : undefined}
aria-selected={multiple ? selected : undefined}
/*
패널은 하나뿐이라 고른 탭만 그것을 가리킨다. 탭 전부가 같은 패널을 가리키면
고르지 않은 탭이 "내가 저 패널을 연다" 고 말하면서 패널은 다른 탭의 이름을
달고 있게 된다 — 화면 읽기 프로그램에게 서로 어긋난 두 문장이다.
*/
aria-controls={selected ? "home-topic-panel" : undefined}
tabIndex={multiple && !selected ? -1 : 0}
onClick={() => select(topic.slug)}
onKeyDown={onKeyDown}
>
{topic.name}
</button>
);
})}
</div>
{/*
패널은 하나다. 주제마다 하나씩 그려 두려면 상세를 전부 받아 와야 하고, 그러면 주제가
늘 때마다 홈이 보내는 요청이 함께 는다.
*/}
<div
id="home-topic-panel"
className="home-topic-panel"
role={multiple ? "tabpanel" : undefined}
aria-labelledby={multiple ? `home-topic-tab-${active.slug}` : undefined}
aria-busy={detail ? undefined : true}
>
{/*
무엇을 기준으로 나눈 목록인지 한 낱말로 말한다. 이름 칸을 칩이 가져갔으니 축의 이름은
목록 바로 위에 붙어야 짝이 보인다 — 「구조」 넷과 「조회 전략」 셋은 같은 배치로
그려지지만 다른 것을 견준다.
*/}
<div className="home-topic-axis">
<p className="section-kicker">{axisLabel || "비교"}</p>
<Link className="text-link section-action" to={`/topics/${active.slug}`}>
{`${active.name} 전체 보기`}
</Link>
</div>
{detail && rows.length > 0 ? (
<ul>
{rows.map((row) => (
<li key={row.path}>
<Link to={row.path}>
<strong>{row.title}</strong>
{/*
비교표가 읽는 것은 결론이다. 요약은 이것이 무엇인가를 말하고, 결론은 만들어
보고 무엇을 알게 됐는가를 말한다.
*/}
<p>{row.line}</p>
</Link>
</li>
))}
</ul>
) : detail && (comparing || records[active.slug]) ? (
<p className="home-topic-pending">
{`${active.name}에는 아직 공개된 기록이 없습니다.`}
</p>
) : (
<p className="home-topic-pending">
{failedSlug === active.slug
? "이 주제를 지금 불러오지 못했습니다."
: `${active.name}을(를) 여는 중입니다.`}
</p>
)}
</div>
</>
);
}
@@ -1,111 +0,0 @@
import { Link } from "react-router-dom";
import type { PublicRecord } from "../../../application/ports/public-content-queries.ts";
import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
import { byReadingOrder } from "../../shared/record-reading-order.ts";
type TopicRef = Readonly<{ name: string; slug: string }>;
/**
* 이 프로젝트가 무엇을 어디까지 조사했는지를 주제별로 편다.
*
* <p>「주요 주제」는 이름만 있는 목록이었다. 프로젝트를 여는 사람이 알고 싶은 것은 이름이 아니라
* "이 조사가 어느 질문을 붙들고 있고, 그 질문에 대해 지금까지 무엇을 만들어 놨는가"다. 이름만
* 있으면 그 주제 화면까지 한 번 더 들어가야 그것을 알 수 있고, 프로젝트 화면은 목차의 목차가 된다.
*
* <p>그래서 주제마다 이 프로젝트의 기록을 읽는 순서대로 펼친다. 이 화면 하나로 조사의 모양이
* 보이게 하는 것이 목적이다.
*
* <p>기록이 아직 없는 주제도 지우지 않는다. 다루기로 한 주제인데 아직 아무것도 없다는 사실이
* 조사의 상태이고, 지우면 그 사실만 화면에서 사라진다.
*/
export function InvestigationMap({
topics,
records,
headingId,
}: {
topics: ReadonlyArray<TopicRef>;
records: ReadonlyArray<PublicRecord>;
headingId: string;
}) {
const grouped = new Map<string, PublicRecord[]>();
for (const record of records) {
const key = record.topicSlug || "";
const bucket = grouped.get(key);
if (bucket) bucket.push(record);
else grouped.set(key, [record]);
}
/*
고른 주제가 먼저다 — 작성자가 순서까지 정한 값이기 때문이다. 그다음에 기록만 있고 고르지
않은 주제를 붙인다. 붙이지 않으면 그 주제의 기록이 어느 줄에도 속하지 않고 사라진다.
*/
const listed = [...topics];
const known = new Set(listed.map((topic) => topic.slug));
for (const record of records) {
if (record.topicSlug && !known.has(record.topicSlug)) {
known.add(record.topicSlug);
listed.push({ name: record.topic, slug: record.topicSlug });
}
}
const loose = grouped.get("") ?? [];
if (listed.length === 0 && loose.length === 0) return null;
return (
<section className="investigation-map" aria-labelledby={headingId}>
<p className="section-kicker">Investigation</p>
<h2 id={headingId}>주제별로 어디까지 왔나</h2>
<ol>
{listed.map((topic) => {
const inTopic = byReadingOrder(grouped.get(topic.slug) ?? []);
return (
<li key={topic.slug || topic.name}>
<div className="investigation-topic">
{topic.slug ? (
<Link to={`/topics/${topic.slug}`}>{topic.name}</Link>
) : (
<strong>{topic.name}</strong>
)}
<span>{inTopic.length > 0 ? `기록 ${inTopic.length}` : "기록 없음"}</span>
</div>
{inTopic.length > 0 ? (
<ul className="investigation-records">
{inTopic.map((record) => (
<li key={record.path}>
<span className="investigation-kind">
{DOCUMENT_KIND_LABELS[record.kind]}
</span>
<Link to={record.path}>{record.title}</Link>
</li>
))}
</ul>
) : (
<p className="investigation-empty">
다루기로 한 주제인데 아직 공개한 기록이 없습니다.
</p>
)}
</li>
);
})}
{/* 주제에 매이지 않은 기록. 어디에도 속하지 않은 채 사라지지 않게 마지막에 모은다. */}
{loose.length > 0 ? (
<li key="__loose">
<div className="investigation-topic">
<strong>주제 없음</strong>
<span>{`기록 ${loose.length}`}</span>
</div>
<ul className="investigation-records">
{byReadingOrder(loose).map((record) => (
<li key={record.path}>
<span className="investigation-kind">{DOCUMENT_KIND_LABELS[record.kind]}</span>
<Link to={record.path}>{record.title}</Link>
</li>
))}
</ul>
</li>
) : null}
</ol>
</section>
);
}
@@ -0,0 +1,105 @@
import { Link } from "react-router-dom";
import type {
PublicRecord,
PublicTopic,
} from "../../../application/ports/public-content-queries.ts";
type TopicRef = Readonly<{ name: string; slug: string }>;
/**
* 이 프로젝트를 어떤 주제 순서로 파고들었는가.
*
* <p>프로젝트 화면이 답해야 하는 것은 바로 아래 한 계층뿐이다. 예전에는 주제마다 그 안의 기록을
* 전부 펼쳐 놓아서, 프로젝트 화면 하나가 주제 목록이자 기록 목록이었다 — 같은 기록이 이 화면과
* 주제 화면과 기록 목록 화면에 세 번 나왔고, 셋 중 어디서 읽어야 하는지는 아무도 말해 주지
* 않았다.
*
* <p>그래서 여기서는 주제까지만 그린다. 번호와 화살표로 순서를 보이고, 주제마다 그 주제가
* 답하는 질문 한 줄과 이 프로젝트가 그 주제에 남긴 기록 수를 붙인다. 기록 자체는 주제 화면이
* 맡는다.
*
* <p>한 줄 설명은 주제 목록에서 가져온다. 프로젝트가 들고 있는 것은 이름과 slug 뿐이라, 그것만
* 으로는 "이 주제가 무엇을 묻는가" 를 말할 수 없다. 목록에 없는 주제면 줄을 비워 둔다 —
* 지어내지 않는다.
*
* <p>기록이 없는 주제도 지우지 않는다. 다루기로 한 주제인데 아직 아무것도 없다는 사실이 조사의
* 상태이고, 지우면 그 사실만 화면에서 사라진다.
*/
export function ProjectPath({
topics,
records,
catalog,
headingId,
}: {
topics: ReadonlyArray<TopicRef>;
records: ReadonlyArray<PublicRecord>;
/** 공개된 주제 전부. 한 줄 설명을 여기서 찾는다. */
catalog: ReadonlyArray<PublicTopic>;
headingId: string;
}) {
const counts = new Map<string, number>();
for (const record of records) {
const key = record.topicSlug || "";
counts.set(key, (counts.get(key) ?? 0) + 1);
}
/*
고른 주제가 먼저다 — 작성자가 순서까지 정한 값이기 때문이다. 그다음에 기록만 있고 고르지
않은 주제를 붙인다. 붙이지 않으면 그 주제의 기록이 어느 줄에도 속하지 않고 사라진다.
*/
const listed = [...topics];
const known = new Set(listed.map((topic) => topic.slug));
for (const record of records) {
if (record.topicSlug && !known.has(record.topicSlug)) {
known.add(record.topicSlug);
listed.push({ name: record.topic, slug: record.topicSlug });
}
}
const loose = counts.get("") ?? 0;
if (listed.length === 0) return null;
const oneLine = (slug: string): string => {
const entry = catalog.find((topic) => topic.slug === slug);
return (entry?.thesis || entry?.description || "").trim();
};
return (
<section className="project-path" aria-labelledby={headingId}>
<p className="section-kicker">Project path</p>
<h2 id={headingId}>어떤 주제 순서로 파고들었나</h2>
<ol className="context-flow">
{listed.map((topic, index) => {
const count = counts.get(topic.slug) ?? 0;
const line = oneLine(topic.slug);
return (
<li key={topic.slug || topic.name}>
<span className="context-flow__step" aria-hidden="true">
{String(index + 1).padStart(2, "0")}
</span>
<div className="context-flow__copy">
{topic.slug ? (
<Link to={`/topics/${topic.slug}`}>{topic.name}</Link>
) : (
<strong>{topic.name}</strong>
)}
{line ? <p>{line}</p> : null}
<span className="context-flow__meta">
{count > 0 ? `기록 ${count}` : "아직 공개한 기록 없음"}
</span>
</div>
</li>
);
})}
</ol>
{/*
주제에 매이지 않은 기록. 흐름의 한 단계가 아니므로 번호를 주지 않고, 그런 기록이 있다는
사실만 아래에 적는다.
*/}
{loose > 0 ? (
<p className="project-path-loose">{`주제에 매이지 않은 기록 ${loose}개가 있습니다.`}</p>
) : null}
</section>
);
}
@@ -0,0 +1,64 @@
import { Link } from "react-router-dom";
import type {
PublicRecord,
RecordKind,
} 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"];
/** 흐름에 오른 기록. 아래 목록이 같은 편을 다시 그리지 않도록 경로를 함께 준다. */
export function reasoningSteps(records: ReadonlyArray<PublicRecord>) {
return REASONING_ORDER.flatMap((kind) => {
const first = records.find((record) => record.kind === kind);
return first ? [first] : [];
});
}
export function TopicReasoningPath({
records,
headingId,
}: {
records: ReadonlyArray<PublicRecord>;
headingId: string;
}) {
const steps = reasoningSteps(records);
/* 한 칸짜리는 흐름이 아니다. 그때는 아래 목록이 이미 같은 것을 말한다. */
if (steps.length < 2) return null;
return (
<section className="topic-path" aria-labelledby={headingId}>
<p className="section-kicker">Reasoning path</p>
<h2 id={headingId}>어떤 순서로 생각했나</h2>
<ol className="context-flow">
{steps.map((record, index) => (
<li key={record.path}>
<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}
</div>
</li>
))}
</ol>
</section>
);
}
@@ -1,17 +1,11 @@
import { Link } from "react-router-dom";
import type {
PublicContentQueries,
PublicTopicDetail,
} from "../../../application/ports/public-content-queries.ts";
import type { PublicContentQueries } 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";
import { usePublicContent } from "../use-public-content.tsx";
import { FatalErrorState } from "../components/fatal-error-state.tsx";
import { HomeFocus } from "../components/home-focus.tsx";
import { HomeInvestigationPath } from "../components/home-investigation-path.tsx";
import { HomeTopicTabs } from "../components/home-topic-tabs.tsx";
import { HomeNow } from "../components/home-now.tsx";
import {
LatestIndex,
type LatestEntry,
@@ -127,71 +121,35 @@ function dateLabel(isoTimestamp: string): string {
}
/**
* 홈이 비교를 펴 두는 주제들.
* 홈에 세우는 프로젝트 목록.
*
* <p>기록이 많이 쌓인 순으로 세운다 — 앞에 오는 탭이 이 기록의 중심이다. 축을 쓰지 않는
* 주제는 견줄 것이 없으므로 탭이 되지 않고, 주제 목록이 받는다.
* <p>홈이 하는 일은 맥락을 자세히 보여 주는 것이 아니라 어디로 들어갈지 정하게 하는 것이다.
* 그 입구가 프로젝트다 — 이 사이트의 기록은 전부 어느 프로젝트의 조사에서 나온다.
*
* <p>예전에는 첫 주제 하나만 펴 두고 나머지는 아래 한 줄로 보냈다. 그 줄은 비교 목록 밑에
* 작은 글씨로 있어 대개 지나쳤고, 그래서 JPA 주제는 홈에 있으면서도 없는 것과 같았다.
*
* <p>요청은 둘이다 — 목록 하나와 첫 주제의 상세 하나. 나머지 주제의 상세는 탭을 고를 때
* 받는다. 여기서 전부 받으면 주제가 늘 때마다 홈의 요청이 함께 늘고, 그것이 싫어 앞의 몇
* 개만 받으면 나머지는 다시 탭에 오르지 못한다 — 없애려던 문제로 되돌아간다.
* <p>빈 검색어는 "카탈로그 전부" 라는 뜻이라 한 번의 요청으로 끝난다. 프로젝트마다 기록·결정을
* 세어 오던 것은 `/projects` 화면이 할 일이다 — 홈에서 그것까지 하면 요청이 프로젝트 수만큼
* 늘고, 홈이 답해야 할 질문("어디로 들어갈까") 은 그 숫자로 답해지지 않는다.
*/
async function getTopics(publicContent: PublicContentQueries) {
const topics = await publicContent.listTopics();
/*
주제는 전부 탭에 오른다.
한때 축이 둘 이상인 주제만 탭이 되고 나머지는 목록 아래 「다른 주제 N개 보기」 한 줄로
갔다. 그 줄은 없애려던 바로 그 줄이다 — 읽는 사람은 비교표를 다 읽고 나서야 다른 주제가
있다는 것을 알았고, 대개 거기까지 가지 않았다.
기록이 아직 없는 주제도 세운다. 주제를 만든다는 것은 앞으로 그것을 쓰겠다는 선언이고,
그 선언이 홈에 먼저 서 있는 편이 이 사이트가 무엇을 다루는지 말해 준다. 대신 그 탭을
누르면 「아직 공개된 기록이 없습니다」라고 분명히 말한다 — 빈 목록으로 두지 않는다.
순서는 기록이 많은 것부터다. 서버가 주는 순서를 그대로 쓰면 기록 3편짜리가 18편짜리를
제치고 홈의 첫 화면에 오른다.
*/
const ordered = [...topics].sort((left, right) => right.recordCount - left.recordCount);
const first = ordered[0];
const firstDetail = first ? await publicContent.getTopicDetail(first.slug) : undefined;
return {
/** 탭 하나씩. 주제 전부다. */
tabs: ordered,
/** 처음 열려 있을 주제. 이것만 미리 받는다. */
firstDetail,
};
async function getProjects(publicContent: PublicContentQueries) {
const entries = await publicContent.searchPublicContent("");
return entries.filter((entry) => entry.contentType === "PROJECT");
}
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, topics] = await Promise.all([
const [focusItems, latestEntries, projects] = await Promise.all([
queries.getHomeFocusItems(),
getLatestEntries(queries),
getTopics(queries),
getProjects(queries),
]);
return { focusItems, latestEntries, topics };
return { focusItems, latestEntries, projects };
});
if (!view.ready) return view.fallback;
const { focusItems, latestEntries, topics } = view.data;
const { focusItems, latestEntries, projects } = view.data;
const availableFocusItems = requestedState === "focus-empty" ? [] : focusItems;
const normalizedKey = normalizeFocus(
requestedKey,
availableFocusItems.map((item) => item.key),
);
const initialKey =
normalizedKey === "current" ||
normalizedKey === "question" ||
normalizedKey === "decision"
? normalizedKey
: null;
if (requestedState === "site-error") {
return <FatalErrorState traceId="PREVIEW-HOME-500" />;
@@ -210,39 +168,40 @@ export function HomePage() {
</section>
{/*
첫 문장은 태도를 말한다. 처음 온 사람이 알아야 하는 것은 태도가 아니라 길이므로, 실제
기록 하나로 그 길을 보여 준다 — 설명보다 사슬 하나가 빠르다.
홈이 답하는 질문은 하나다 — 지금 무엇을 하고 있는가. 한때 이 자리에 「한 프로젝트의
맥락을 따라 읽습니다」(기록의 사슬), 「지금 집중하는 것」(작업 상태), 「주제별 흐름」
(주제 내부 구조)이 연달아 섰다. 셋은 데이터로는 다른 계층이지만 읽는 사람에게는 전부
"그래서 뭘 읽으라는 거지" 에 답하는 같은 종류의 안내였고, 같은 말을 세 방식으로 반복하는
화면이 됐다.
계층마다 제 자리를 준다. 프로젝트의 주제 흐름은 프로젝트 화면이, 주제의 사고 흐름은
주제 화면이 맡는다. 홈에는 지금 하는 일과 들어갈 입구만 남는다.
*/}
<HomeInvestigationPath entries={latestEntries} />
<HomeNow items={availableFocusItems} />
{initialKey ? (
<section className="shell focus-section" aria-labelledby="focus-label">
<p className="section-kicker" id="focus-label">
지금 집중하는 것
</p>
<HomeFocus
items={availableFocusItems}
initialKey={initialKey}
requestedKey={requestedKey}
/>
</section>
) : null}
{/*
30초 안에 알아야 할 것은 「무엇을 만들었나」가 아니라 「무엇을 견줬고 무엇이 남았나」다.
축마다 만들어 보고 무엇을 알게 됐는지(결론)를 나란히 둔다 — 요약을 쓰면 무엇인가만
말하고 무엇을 알게 됐는지는 말하지 않는다.
제목 자리에는 주제 이름들이 탭으로 선다. 「구조별로 알게 된 것」 한 줄이 서 있던 동안
홈이 펴 두는 주제는 하나였고, 나머지로 가는 길은 목록 밑 작은 글씨 한 줄뿐이었다 —
무엇이 더 있는지는 다 읽고 나서야 알 수 있었다. 이름을 나란히 세우면 목록을 읽기
전에 먼저 보인다.
*/}
{topics.firstDetail ? (
<section className="shell home-comparison" aria-label="주제별로 견준 것">
<HomeTopicTabs topics={topics.tabs} firstDetail={topics.firstDetail} />
</section>
) : null}
<section className="shell home-projects" aria-labelledby="home-projects-title">
<div className="section-heading-row">
<div>
<p className="section-kicker">Projects</p>
<h2 id="home-projects-title">조사가 사는 곳</h2>
</div>
<Link className="text-link" to="/projects">
전체 보기 <span aria-hidden="true">↗</span>
</Link>
</div>
{projects.length > 0 ? (
<ul className="home-project-list">
{projects.map((project) => (
<li key={project.path}>
<Link to={project.path}>{project.title}</Link>
{project.summary.trim() ? <p>{project.summary}</p> : null}
</li>
))}
</ul>
) : (
<p className="public-empty-state">아직 공개된 프로젝트가 없습니다.</p>
)}
</section>
<LatestIndex
entries={requestedState === "latest-empty" ? [] : latestEntries}
@@ -5,35 +5,35 @@ import {
RegisteredNotFoundRoute,
useRouteInput,
} from "../../../../../presentation/routes/route-input.tsx";
import { InvestigationMap } from "../components/investigation-map.tsx";
import { ProjectPageHeader } from "../components/project-page-header.tsx";
import { ProjectPath } from "../components/project-path.tsx";
import { ProseText } from "../../shared/public-render/prose-text.tsx";
import { PublicRecordList } from "../components/public-record-list.tsx";
import { usePublicContent } from "../use-public-content.tsx";
/** 첫 화면에 펴 두는 편 수. 넘으면 목록이 되고, 목록은 이미 `/records` 에 있다. */
const READING_ORDER_SIZE = 4;
export function ProjectOverviewPage() {
const { params } = useRouteInput<"TECH_LOG_PROJECT">();
const slug = typeof params.slug === "string" ? params.slug : "";
const view = usePublicContent(["tech-log", "project", slug, "overview"], async (queries) => {
const project = await queries.getProject(slug);
if (!project) {
return { project: undefined, records: [], decisions: [], activity: [] };
return { project: undefined, records: [], decisions: [], activity: [], topicCatalog: [] };
}
// Three independent reads for one screen: issued together rather than in
// sequence, so the page waits for the slowest instead of their sum.
const [records, decisions, activity] = await Promise.all([
/*
독립적인 읽기는 한꺼번에 낸다 — 화면은 가장 느린 하나만큼 기다리고 합만큼 기다리지 않는다.
주제 목록은 프로젝트가 가진 주제에 한 줄 설명을 붙이려고 읽는다. 프로젝트가 들고 있는 것은
이름과 slug 뿐이다.
*/
const [records, decisions, activity, topicCatalog] = await Promise.all([
queries.getProjectRecords(slug),
queries.getProjectDecisions(slug),
queries.getProjectActivity(slug),
queries.listTopics(),
]);
return { project, records, decisions, activity };
return { project, records, decisions, activity, topicCatalog };
});
if (!view.ready) return view.fallback;
const { project, records, decisions, activity } = view.data;
const { project, records, decisions, activity, topicCatalog } = view.data;
if (!project) return <RegisteredNotFoundRoute />;
/* 고른 것이 있으면 그것, 없으면 기록이 사는 주제. 기록 순서를 그대로 따르고 중복만 없앤다. */
@@ -114,35 +114,24 @@ export function ProjectOverviewPage() {
</div>
</dl>
{/*
숫자 셋(기록 12 · 결정 4 · 활동 9)은 이 프로젝트가 얼마나 큰지는 말해도 어디서부터 읽어야
하는지는 말하지 않는다. 방문자가 실제로 필요한 것은 뒤쪽이므로, 세는 자리를 처음 몇 편으로
바꾼다 — 숫자는 각 목록으로 가는 줄에 남긴다.
기록 목록은 여기 두지 않는다. 이 화면이 답하는 계층은 주제이고, 기록은 주제 화면과
`/records` 가 맡는다 — 예전에는 같은 기록이 「여기서부터 읽으면 됩니다」와 주제별 지도에
두 번 나왔고, 둘 중 어디서 읽어야 하는지는 화면이 말해 주지 않았다.
*/}
<section className="project-overview-section" aria-labelledby="project-scope-title">
<div>
<p className="section-kicker">Reading order</p>
<h2 id="project-scope-title">여기서부터 읽으면 됩니다</h2>
</div>
{records.length > 0 ? (
<PublicRecordList records={records.slice(0, READING_ORDER_SIZE)} />
) : (
<p className="public-empty-state">아직 공개된 기록이 없습니다.</p>
)}
<div className="project-stat-links">
<Link to={`/projects/${slug}/records`}>
<strong>{records.length}</strong>
<span>공개 기록</span>
</Link>
<Link to={`/projects/${slug}/decisions`}>
<strong>{decisions.length}</strong>
<span>설계 결정</span>
</Link>
<Link to={`/projects/${slug}/activity`}>
<strong>{activity.length}</strong>
<span>활동 기록</span>
</Link>
</div>
</section>
<div className="project-stat-links">
<Link to={`/projects/${slug}/records`}>
<strong>{records.length}</strong>
<span>공개 기록</span>
</Link>
<Link to={`/projects/${slug}/decisions`}>
<strong>{decisions.length}</strong>
<span>설계 결정</span>
</Link>
<Link to={`/projects/${slug}/activity`}>
<strong>{activity.length}</strong>
<span>활동 기록</span>
</Link>
</div>
{/*
이 프로젝트가 다루는 주제.
@@ -150,13 +139,14 @@ export function ProjectOverviewPage() {
않았으면 기록에서 뽑는다: 이 프로젝트의 공개 기록이 어느 주제에 사는지가 곧 이 프로젝트가
다루는 주제다.
이름만 나열하던 자리를 조사 지도로 바꾼다. 이름만 있으면 그 주제 화면까지 한 번 더
들어가야 무엇이 있는지 알 수 있었고, 프로젝트 화면이 목차의 목차가 됐다.
번호와 화살표로 순서를 보이고, 주제마다 한 줄 설명과 이 프로젝트가 그 주제에 남긴 기록
수만 붙인다. 기록 자체는 주제 화면이 편다.
*/}
<InvestigationMap
<ProjectPath
topics={topics}
records={records}
headingId="project-investigation-title"
catalog={topicCatalog}
headingId="project-path-title"
/>
</main>
);
@@ -8,50 +8,22 @@ import type {
PublicRecord,
RecordKind,
} from "../../../application/ports/public-content-queries.ts";
import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
import { PublicRecordList } from "../components/public-record-list.tsx";
import { RecordStateSummary } from "../components/record-state-summary.tsx";
import {
reasoningSteps,
TopicReasoningPath,
} from "../components/topic-reasoning-path.tsx";
import { usePublicContent } from "../use-public-content.tsx";
/**
* 읽는 순서.
*
* <p>서버가 주는 대표 기록(`featuredCases`/`featuredReference`)은 작성자가 주제마다 손으로
* 골라 두는 값이라 대부분 비어 있다. 비어 있으면 열린 질문만 남아, 아직 답이 없는 질문 넷을
* 모아 두고 「먼저 읽을 것」이라 부르게 된다 — 처음 온 사람에게 가장 나쁜 첫 화면이다.
*
* <p>그래서 기록 자체에서 순서를 만든다. 원리를 먼저 알고, 그것을 확인한 기록을 보고, 거기서
* 나온 기준을 읽고, 아직 답하지 못한 것을 마지막에 본다.
*
* <p>서버의 대표 값을 쓰지 않는 이유는 그것이 순서가 아니라 통 두 개(대표 Case · 열린 질문)라
* 서다. 통을 이어 붙이면 기준이 통째로 빠지고, 채워져 있는 쪽이 질문뿐일 때는 질문만 남는다.
* 흐름에 오르지 않은 나머지를 세우는 순서. 한 화면에서 순서가 두 번 바뀌면 순서로 읽히지 않는다.
*/
const READING_ORDER: ReadonlyArray<RecordKind> = ["CONCEPT", "CASE", "REFERENCE", "QUESTION"];
const KNOWLEDGE_ORDER: ReadonlyArray<RecordKind> = ["CONCEPT", "CASE", "REFERENCE", "SETUP"];
/**
* 종류마다 한 편씩. 둘씩 담아 봤더니 일곱 줄이 되어 순서가 아니라 또 하나의 목록이 됐다 —
* 여기가 답하는 것은 「무엇이 있나」가 아니라 「어디서부터 읽나」다.
*/
function firstReads(records: ReadonlyArray<PublicRecord>) {
return READING_ORDER.flatMap((kind) => {
const first = records.find((record) => record.kind === kind);
return first
? [
{
label: DOCUMENT_KIND_LABELS[first.kind],
title: first.title,
path: first.path,
summary: first.summary,
},
]
: [];
});
}
/** 나머지 목록도 같은 순서를 따른다 — 한 화면에서 순서가 두 번 바뀌면 순서로 읽히지 않는다. */
function byReadingOrder(records: ReadonlyArray<PublicRecord>) {
function byKnowledgeOrder(records: ReadonlyArray<PublicRecord>) {
return [...records].sort(
(left, right) => READING_ORDER.indexOf(left.kind) - READING_ORDER.indexOf(right.kind),
(left, right) => KNOWLEDGE_ORDER.indexOf(left.kind) - KNOWLEDGE_ORDER.indexOf(right.kind),
);
}
@@ -79,9 +51,15 @@ export function TopicPage() {
if (!topic) return <RegisteredNotFoundRoute />;
const axisLabel = topic.variantLabel.trim() || "접근";
const readingOrder = firstReads(records);
const readingPaths = new Set(readingOrder.map((entry) => entry.path));
const rest = byReadingOrder(records.filter((record) => !readingPaths.has(record.path)));
const stepPaths = new Set(reasoningSteps(records).map((record) => record.path));
/*
아직 답하지 못한 질문은 따로 모은다. 지식과 섞어 두면 "정리해 둔 것" 안에 답이 없는 줄이
끼어들고, 이 주제에 무엇이 남았는지는 다 읽어야만 알 수 있다.
*/
const open = records.filter((record) => record.kind === "QUESTION");
const knowledge = byKnowledgeOrder(
records.filter((record) => record.kind !== "QUESTION" && !stepPaths.has(record.path)),
);
return (
<main id="main-content" className="shell public-index-page topic-hub">
<header className="public-page-header">
@@ -111,14 +89,17 @@ export function TopicPage() {
*/}
<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>
{/*
홈의 비교 구역과 같은 이름을 쓴다. 같은 네 줄을 두 화면이 다른 이름으로 부르고
있었다. 역할은 자리로 갈린다 — 홈은 앞의 몇을 보여 주고 여기가 전체다.
이 표는 어디로 갈지 고르는 자리가 아니라 이 주제가 세운 모델 자체다. 한때 같은 네
줄이 홈에도 「주제별 흐름」이라는 이름으로 서 있었고, 그래서 읽는 사람에게는 또 하나의
길 안내처럼 보였다 — 홈에서 내리고 이름도 내용에 맞게 고친다.
*/}
<h2 id="topic-variants-title">{`${axisLabel}별로 알게 된 것`}</h2>
<h2 id="topic-variants-title">{`이 주제가 세운 ${axisLabel}`}</h2>
{/*
오른쪽 숫자를 더해도 아래 목록의 개수와 맞지 않는다. 한 기록이 여러 축에 걸릴 수
있고, 어느 축에도 걸리지 않은 기록은 공통이기 때문이다 — 그 규칙을 화면이 말하지
@@ -147,21 +128,32 @@ export function TopicPage() {
</section>
) : null}
<PublicDocumentRelations
relations={readingOrder}
kicker="Reading order"
title="먼저 읽을 것"
{/*
흐름에 오른 편은 여기서 뺀다. 예전에는 같은 네 편이 위아래로 두 번 나왔다 — 순서를
정해 준 자리가 목록의 앞부분을 복사한 것처럼 보이면 순서를 정해 준 뜻이 없어진다.
*/}
<div className="public-result-heading">
<h2>정리해 둔 것</h2>
<p>{`${knowledge.length}개`}</p>
</div>
<PublicRecordList
records={knowledge}
emptyMessage="사고 흐름에 오른 기록 외에 정리해 둔 것이 아직 없습니다."
/>
{/*
먼저 읽을 것에 오른 편은 여기서 뺀다. 예전에는 같은 네 편이 위아래로 두 번 나왔다 —
「먼저 읽을 것」이 목록의 앞부분을 복사한 것처럼 보이면 순서를 정해 준 뜻이 없어진다.
아직 답하지 못한 것. 마지막에 두되 지우지 않는다 — 남은 질문이 있다는 사실이 이 주제의
상태이고, 답한 것만 보이면 조사가 끝난 것처럼 읽힌다.
*/}
<div className="public-result-heading">
<h2>나머지 기록</h2>
<p>{`${rest.length}개`}</p>
</div>
<PublicRecordList records={rest} emptyMessage="먼저 읽을 것 외에 남은 기록이 없습니다." />
{open.length > 0 ? (
<>
<div className="public-result-heading">
<h2>아직 답하지 못한 것</h2>
<p>{`${open.length}개`}</p>
</div>
<PublicRecordList records={open} />
</>
) : null}
<PublicDocumentRelations
relations={topic.relatedProjects}
@@ -1,35 +0,0 @@
import type { RecordKind } from "../../application/ports/public-content-queries.ts";
/**
* 기록을 읽는 순서.
*
* <p>원리를 먼저 알고, 그것을 확인한 기록을 보고, 거기서 나온 기준을 읽고, 재현할 환경이 따르고,
* 아직 답하지 못한 것을 마지막에 본다.
*
* <p>한 벌만 둔다. 주제 화면·상태 요약·조사 지도가 각자 자기 목록을 들고 있던 동안 같은 기록이
* 화면마다 다른 자리에 나왔고, 종류를 더할 때 한 곳만 고치면 나머지는 그 종류를 맨 뒤나 맨 앞에
* 조용히 던져 놓았다. `Record<RecordKind, …>` 라 종류가 늘면 컴파일러가 빈 자리를 잡는다.
*/
export const RECORD_READING_ORDER: Record<RecordKind, number> = {
CONCEPT: 1,
CASE: 2,
REFERENCE: 3,
SETUP: 4,
QUESTION: 5,
};
/** 읽는 순서대로 세운 종류 목록. */
export const RECORD_KINDS_IN_READING_ORDER: ReadonlyArray<RecordKind> = Object.freeze(
(Object.keys(RECORD_READING_ORDER) as RecordKind[]).sort(
(left, right) => RECORD_READING_ORDER[left] - RECORD_READING_ORDER[right],
),
);
/** 읽는 순서로 정렬한다. 원본 배열은 건드리지 않는다. */
export function byReadingOrder<T extends { readonly kind: RecordKind }>(
records: ReadonlyArray<T>,
): T[] {
return [...records].sort(
(left, right) => RECORD_READING_ORDER[left.kind] - RECORD_READING_ORDER[right.kind],
);
}
@@ -419,105 +419,39 @@ a {
margin-top: 38px;
}
.focus-section {
/*
홈의 「지금」. 탭 셋이 서로를 가리던 자리를 한 번에 편다 — 세 줄짜리 정보를 고르게 만들
이유가 없다.
*/
.home-now {
padding: 34px 0 44px;
border-top: 1px solid var(--line);
border-bottom: 1px solid var(--line);
}
.focus-tabs-static {
display: flex;
gap: 27px;
margin-top: 18px;
color: var(--faint);
font-size: 14px;
font-weight: 560;
}
.focus-tabs-static span {
position: relative;
display: inline-flex;
min-height: 36px;
align-items: center;
}
.focus-tabs-static .is-active {
color: var(--ink);
}
.focus-tabs-static .is-active::after {
position: absolute;
right: 0;
bottom: 0;
left: 0;
height: 2px;
background: var(--signal);
content: "";
}
.focus-tabs {
display: flex;
gap: 27px;
margin-top: 18px;
}
.focus-tabs button {
position: relative;
display: inline-flex;
min-height: 44px;
align-items: center;
padding: 0;
border: 0;
background: transparent;
color: var(--faint);
cursor: pointer;
font-size: 14px;
font-weight: 560;
}
.focus-tabs button[aria-selected="true"] {
color: var(--ink);
}
.focus-tabs button[aria-selected="true"]::after {
position: absolute;
right: 0;
bottom: 2px;
left: 0;
height: 2px;
background: var(--signal);
content: "";
}
.focus-content {
display: grid;
grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
gap: 90px;
padding-top: 32px;
}
.focus-summary h2 {
.home-now h2 {
max-width: 700px;
margin: 0;
margin: 12px 0 0;
font-size: clamp(29px, 3vw, 38px);
font-weight: 650;
letter-spacing: -0.04em;
line-height: 1.22;
}
.focus-summary > p {
.home-now__summary {
max-width: 620px;
margin: 17px 0 17px;
margin: 17px 0 0;
color: var(--ink-soft);
font-size: 18px;
line-height: 1.72;
}
.focus-details {
margin: 2px 0 0;
.home-now__details {
max-width: 720px;
margin: 24px 0 0;
}
.focus-details div {
.home-now__details > div {
display: grid;
grid-template-columns: 86px 1fr;
gap: 18px;
@@ -525,21 +459,17 @@ a {
border-bottom: 1px solid var(--line);
}
.focus-details div:first-child {
padding-top: 0;
}
.focus-details div:last-child {
.home-now__details > div:last-child {
border-bottom: 0;
}
.focus-details dt {
.home-now__details dt {
color: var(--faint);
font-size: 13px;
font-weight: 540;
}
.focus-details dd {
.home-now__details dd {
margin: 0;
color: var(--ink-soft);
font-size: 14px;
@@ -547,6 +477,165 @@ a {
line-height: 1.55;
}
.home-now__target {
margin-top: 20px;
}
.home-now__items {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 0 52px;
margin: 32px 0 0;
padding: 0;
list-style: none;
border-top: 1px solid var(--line);
}
.home-now__items > li {
padding: 24px 0 0;
}
.home-now__label {
margin: 0 0 9px;
color: var(--faint);
font-size: 12px;
font-weight: 640;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.home-now__items > li > a {
font-size: 17px;
font-weight: 620;
line-height: 1.5;
}
.home-now__items > li > p {
margin: 9px 0 0;
color: var(--ink-soft);
font-size: 14px;
line-height: 1.65;
}
/* 홈의 입구. 조사는 전부 어느 프로젝트에서 나온다. */
.home-projects {
padding-top: 112px;
}
.home-project-list {
margin: 26px 0 0;
padding: 0;
list-style: none;
border-top: 1px solid var(--line);
}
.home-project-list > li {
padding: 22px 0;
border-bottom: 1px solid var(--line);
}
.home-project-list > li > a {
font-size: 19px;
font-weight: 640;
}
.home-project-list > li > p {
margin: 8px 0 0;
color: var(--ink-soft);
font-size: 14px;
line-height: 1.65;
}
/*
계층의 흐름. 프로젝트 화면은 주제의 순서를, 주제 화면은 사고의 순서를 같은 모양으로 그린다 —
같은 일을 하는 자리가 화면마다 다른 모양이면 읽는 사람이 매번 다시 배운다.
*/
.context-flow {
margin: 26px 0 0;
padding: 0;
list-style: none;
}
.context-flow > li {
display: grid;
grid-template-columns: 58px minmax(0, 1fr);
gap: 20px;
padding: 24px 0;
border-top: 1px solid var(--line);
}
.context-flow > li:first-child {
border-top: 0;
padding-top: 4px;
}
.context-flow__step {
color: var(--faint);
font-family: "IBM Plex Mono", monospace;
font-size: 13px;
letter-spacing: 0.06em;
}
/* 사이의 화살표. 마지막 뒤에는 붙이지 않는다 — 더 갈 곳이 있다는 거짓말이 된다. */
.context-flow > li:not(:last-child) .context-flow__step::after {
display: block;
margin-top: 10px;
color: var(--line-strong);
content: "↓";
}
.context-flow__copy > a {
font-size: 18px;
font-weight: 630;
line-height: 1.5;
}
.context-flow__copy > strong {
font-size: 18px;
font-weight: 630;
}
.context-flow__copy > p {
margin: 8px 0 0;
color: var(--ink-soft);
font-size: 14px;
line-height: 1.68;
}
.context-flow__meta {
display: block;
color: var(--faint);
font-size: 12px;
font-weight: 560;
}
.context-flow__copy > .context-flow__meta:first-child {
margin: 0 0 7px;
letter-spacing: 0.05em;
}
.context-flow__copy > .context-flow__meta:last-child {
margin: 11px 0 0;
}
.project-path,
.topic-path {
padding-top: 84px;
}
.project-path h2,
.topic-path h2 {
margin: 10px 0 0;
font-size: 26px;
letter-spacing: -0.03em;
}
.project-path-loose {
margin: 20px 0 0;
color: var(--faint);
font-size: 13px;
}
.latest-section,
.explore-section {
padding-top: 128px;
@@ -1583,10 +1672,6 @@ dialog::backdrop {
width: calc(100% - 64px);
}
.focus-content {
gap: 54px;
}
.latest-row {
grid-template-columns: 140px minmax(0, 1fr) 24px;
}
@@ -1733,50 +1818,6 @@ dialog::backdrop {
margin-top: 27px;
}
.focus-section {
padding-top: 28px;
padding-bottom: 34px;
}
.focus-tabs-static,
.focus-tabs {
gap: 21px;
overflow-x: auto;
font-size: 13px;
white-space: nowrap;
}
.focus-tabs button {
min-height: 44px;
flex: 0 0 auto;
font-size: 13px;
}
.focus-content {
display: block;
padding-top: 27px;
}
.focus-summary h2 {
font-size: 28px;
line-height: 1.28;
}
.focus-summary > p {
margin-top: 13px;
font-size: 16px;
line-height: 1.7;
}
.focus-details {
margin-top: 24px;
}
.focus-details div {
grid-template-columns: 76px 1fr;
gap: 14px;
}
.latest-section,
.explore-section {
padding-top: 92px;
@@ -2248,8 +2289,6 @@ dialog::backdrop {
.project-status-grid > div + div { padding-left: 28px; border-left: 1px solid var(--line); }
.project-status-grid dt { color: var(--faint); font-size: 11px; }
.project-status-grid dd { margin: 5px 0 0; font-size: 14px; font-weight: 590; }
.project-overview-section { display: grid; grid-template-columns: 1fr 1.4fr; gap: 80px; align-items: start; margin-top: 83px; }
.project-overview-section h2,
.project-topics h2 { margin: 11px 0 0; font-size: 28px; font-weight: 650; letter-spacing: -0.035em; }
.project-stat-links { border-top: 1px solid var(--line-strong); }
.project-stat-links > a { display: grid; min-height: 74px; grid-template-columns: 45px 1fr; gap: 18px; align-items: center; border-bottom: 1px solid var(--line); }
@@ -2303,7 +2342,6 @@ dialog::backdrop {
.project-status-grid > div,
.project-status-grid > div + div { padding: 17px 0; border-left: 0; }
.project-status-grid > div + div { border-top: 1px solid var(--line); }
.project-overview-section { display: block; margin-top: 60px; }
.project-stat-links { margin-top: 30px; }
.project-decision-list { margin-top: 55px; }
.project-decision-list h2 { font-size: 27px; }
@@ -2476,7 +2514,6 @@ dialog::backdrop {
*/
.public-record-list p,
.search-results p,
.focus-summary p,
.latest-copy > p:not(.latest-mobile-meta) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.record-context { color: var(--faint); font-size: 11px; }
.public-record-list time { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 10px; text-align: right; }
@@ -2994,153 +3031,6 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
color: var(--signal);
}
/*
홈의 축 비교. 표가 아니라 목록이다 — 축이 둘이든 넷이든 같은 배치로 읽히고, 좁은 화면에서
가로로 밀리지 않는다. 주제 화면의 같은 구역과 규칙을 맞춘다.
*/
.home-comparison {
margin-top: 96px;
}
/*
주제 이름 탭.
한때 구역 제목 급(30px/650)으로 세웠다. 주제가 둘일 때는 그럴듯했지만 열 개, 스무 개가 되면
이름만으로 화면이 덮인다 — 여기서 하려는 말은 「이것이 이 구역의 제목이다」가 아니라 「고를 것이
이만큼 있다」이므로, 급도 그쪽이어야 한다. 지금 무엇을 읽는지는 목록 바로 위의 축 이름과
「전체 보기」 줄이 말한다.
급을 낮추고 나니 이번에는 목록 위에 글자만 떠 있는 것처럼 보였다. 고른 것이 색으로만 달라서
누를 수 있는 것으로 읽히지 않았고, 탭 줄과 목록 사이가 선 없이 30px 비어 있어 두 덩어리로
갈렸다. 그래서 고른 탭에 형태(알약)를 주고, 탭 줄을 아래 묶음의 윗선에 바로 얹는다.
*/
.home-topic-tabs {
display: flex;
flex-wrap: wrap;
gap: 4px;
/* 알약의 좌우 여백만큼 당겨, 첫 탭의 글자가 아래 목록의 왼쪽 끝과 한 줄로 선다. */
margin-left: -13px;
padding-bottom: 12px;
}
.home-topic-tabs button {
display: inline-flex;
min-height: 34px;
align-items: center;
padding: 0 13px;
border: 0;
border-radius: 17px;
background: transparent;
color: var(--faint);
cursor: pointer;
font-family: inherit;
font-size: 14px;
font-weight: 560;
letter-spacing: -0.01em;
text-align: left;
}
.home-topic-tabs button:hover {
background: #f0f0ee;
color: var(--ink);
}
/*
고른 것은 형태로 말한다. 색만 바꾸면 「진한 글자와 연한 글자」로 읽히고, 밑줄을 쓰면 주제가
스무 개일 때 밑줄 설 자리 스무 개가 함께 늘어선다.
*/
.home-topic-tabs button[aria-selected="true"],
.home-topic-tabs button:only-child {
background: #e7e7e3;
color: var(--ink);
}
/*
탭이 얹히는 묶음. 윗선을 목록이 아니라 여기가 갖는다 — 선이 목록에 있으면 축 이름 줄이 선
위로 밀려 나가 탭과 한 덩어리처럼 보이고, 정작 목록은 저 혼자 시작한다.
*/
.home-topic-panel {
border-top: 1px solid var(--line-strong);
padding-top: 16px;
}
/*
축 이름과 주제로 가는 길. 목록 바로 위에 붙어야 「이 넷은 구조다」가 읽힌다 — 탭 옆에 두면
탭을 바꿀 때 무엇이 따라 바뀌는지가 보이지 않는다.
*/
.home-topic-axis {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 24px;
padding-bottom: 6px;
}
.home-topic-axis .section-kicker {
margin: 0;
}
/* 아직 오지 않았거나 오지 못한 주제. 자리를 비워 두면 목록이 사라진 것처럼 보인다. */
.home-topic-pending {
margin: 0;
padding: 20px 2px;
color: var(--muted);
font-size: 14px;
}
.home-comparison ul {
margin: 0;
padding: 0;
list-style: none;
}
.home-comparison li {
border-bottom: 1px solid var(--line);
}
/*
행에만 건다. `.home-comparison a` 였을 때 이 격자가 제목 안의 링크까지 잡아, 제목이 200px
칸에 갇혀 두 줄로 접히고 행용 padding 까지 물어 h2 높이가 199px 이 됐다. 지금은 제목에
링크가 없지만 선택자는 그대로 두면 다음에 무엇을 넣든 같은 일이 난다.
*/
.home-comparison li > a {
display: grid;
grid-template-columns: 200px minmax(0, 1fr);
gap: 24px;
align-items: baseline;
padding: 27px 2px 28px;
}
.home-comparison li strong {
color: var(--ink);
font-size: 16px;
font-weight: 620;
line-height: 1.5;
}
/* 행 안의 설명만이다. 구역 전체에 걸면 머리말의 kicker 문단까지 이 크기·색으로 덮인다. */
.home-comparison li p {
margin: 0;
color: var(--muted);
font-size: 14px;
line-height: 1.65;
}
.home-comparison li > a:hover strong {
color: var(--signal);
}
@media (max-width: 720px) {
.home-comparison li > a {
grid-template-columns: minmax(0, 1fr);
gap: 8px;
}
.home-topic-tabs {
gap: 2px 18px;
}
}
.topic-variants-note {
margin: -8px 0 18px;
color: var(--faint);
@@ -3165,28 +3055,6 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
word-break: break-word;
}
/*
홈의 「다른 주제」 한 줄. 축을 쓰는 주제는 전부 탭에 올라오므로, 이 줄이 받는 것은 축이 없어
견줄 것이 없는 주제뿐이다. 탭에 다 있으면 이 줄은 나오지 않는다.
*/
.home-other-topics {
display: flex;
flex-wrap: wrap;
gap: 6px 18px;
margin: 22px 0 0;
color: var(--faint);
font-size: 13px;
}
.home-other-topics a {
color: var(--muted);
}
.home-other-topics a:hover {
color: var(--signal);
}
/*
주제 목록. 기록 목록과 같은 배치를 쓰되 칸이 셋이다 — 이름, 고를 근거, 규모.
*/
@@ -3451,100 +3319,6 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
font-size: 15px;
}
/* 조사 지도 — 주제별로 어디까지 왔나 */
.investigation-map {
padding-block: 40px 8px;
}
.investigation-map h2 {
margin: 6px 0 0;
font-size: 25px;
font-weight: 640;
letter-spacing: -0.028em;
}
.investigation-map > ol {
margin: 26px 0 0;
padding: 0;
list-style: none;
}
.investigation-map > ol > li {
padding-block: 21px;
border-top: 1px solid var(--line);
}
.investigation-topic {
display: flex;
flex-wrap: wrap;
gap: 8px 16px;
align-items: baseline;
justify-content: space-between;
}
.investigation-topic a,
.investigation-topic strong {
color: var(--ink);
font-size: 18px;
font-weight: 640;
letter-spacing: -0.018em;
}
.investigation-topic a:hover {
color: var(--signal);
}
.investigation-topic > span {
color: var(--faint);
font-family: "IBM Plex Mono", monospace;
font-size: 12px;
}
.investigation-records {
margin: 13px 0 0;
padding: 0;
list-style: none;
}
.investigation-records > li {
display: grid;
grid-template-columns: 96px minmax(0, 1fr);
gap: 16px;
padding-block: 6px;
}
.investigation-kind {
color: var(--faint);
font-size: 12px;
font-weight: 620;
line-height: 1.75;
}
.investigation-records a {
color: var(--ink-soft);
font-size: 16px;
line-height: 1.6;
}
.investigation-records a:hover {
color: var(--signal);
}
/* 다루기로 했지만 아직 비어 있는 주제. 지우지 않는다 — 그 사실이 조사의 상태다. */
.investigation-empty {
margin: 11px 0 0;
color: var(--muted);
font-size: 14px;
}
@media (max-width: 767px) {
.investigation-records > li {
grid-template-columns: minmax(0, 1fr);
gap: 2px;
}
}
/* 결정이 없는 프로젝트. 빈 종이 대신 조사의 상태를 말한다. */
.project-empty-decisions {
@@ -3607,92 +3381,6 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
color: var(--signal);
}
/* 홈 — 이렇게 이어집니다 */
.home-path {
padding-block: 4px 44px;
}
.home-path-trail {
display: flex;
flex-wrap: wrap;
gap: 8px 28px;
margin: 15px 0 0;
padding: 0;
list-style: none;
}
.home-path-trail li {
display: flex;
gap: 9px;
align-items: baseline;
}
.home-path-trail span {
color: var(--faint);
font-size: 12px;
font-weight: 620;
}
.home-path-trail strong {
color: var(--ink);
font-size: 16px;
font-weight: 640;
}
.home-path-records {
margin: 16px 0 0;
padding: 0 0 0 17px;
border-left: 2px solid var(--line-strong);
list-style: none;
}
.home-path-records li {
display: grid;
/* 종류와 주제를 함께 적으므로 첫 칸이 넓어야 한다. */
grid-template-columns: 190px minmax(0, 1fr);
gap: 4px 16px;
padding-block: 9px;
}
.home-path-records li > div > p {
margin: 4px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.6;
}
/* 단계 사이의 화살표. 마지막 뒤에는 그리지 않는다. */
.home-path-arrow {
grid-column: 2;
color: var(--line-strong);
font-size: 12px;
}
.home-path-records span {
color: var(--faint);
font-size: 12px;
font-weight: 620;
line-height: 1.7;
}
.home-path-records a {
color: var(--ink-soft);
font-size: 16px;
line-height: 1.55;
}
.home-path-records a:hover {
color: var(--signal);
}
@media (max-width: 767px) {
.home-path-records li {
grid-template-columns: minmax(0, 1fr);
gap: 2px;
}
}
/* 실험 조건 — 재현하려는 사람에게 필요하고, 처음 읽는 사람에게는 벽이다 */
.case-meta-details {
@@ -4145,141 +3833,6 @@ summary {
color: var(--signal);
}
.home-path {
padding-block: 50px 68px;
border-top: 1px solid var(--line-strong);
}
.home-path__intro {
display: grid;
grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.72fr);
gap: 72px;
align-items: end;
}
.home-path__intro h2 {
max-width: 620px;
margin: 10px 0 0;
font-size: clamp(28px, 3vw, 38px);
font-weight: 660;
letter-spacing: -0.045em;
line-height: 1.22;
}
.home-path__intro > p {
margin: 0;
color: var(--muted);
font-size: 15px;
line-height: 1.75;
}
.home-path__project {
display: flex;
gap: 14px;
align-items: baseline;
margin-top: 44px;
padding-bottom: 16px;
border-bottom: 1px solid var(--line-strong);
}
.home-path__project span {
color: var(--faint);
font-size: 11px;
font-weight: 650;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.home-path__project strong {
font-size: 17px;
font-weight: 650;
}
.home-path-records {
margin: 0;
padding: 0;
border-left: 0;
list-style: none;
counter-reset: none;
}
.home-path-records li {
display: grid;
grid-template-columns: 76px minmax(0, 1fr);
gap: 0 28px;
padding: 26px 0 28px;
border-bottom: 1px solid var(--line);
}
.home-path-step {
position: relative;
min-height: 100%;
}
.home-path-step::after {
position: absolute;
top: 31px;
bottom: -29px;
left: 12px;
width: 1px;
background: var(--line-strong);
content: "";
}
.home-path-records li:last-child .home-path-step::after {
display: none;
}
.home-path-step > span {
display: inline-grid;
width: 25px;
height: 25px;
place-items: center;
border: 1px solid var(--line-strong);
border-radius: 50%;
background: var(--canvas);
color: var(--muted);
font-family: "IBM Plex Mono", monospace;
font-size: 9px;
font-weight: 650;
line-height: 1;
}
.home-path-copy {
min-width: 0;
}
.home-path-records .home-path-meta {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin: 0 0 5px;
color: var(--faint);
font-size: 11px;
font-weight: 650;
letter-spacing: 0.02em;
}
.home-path-records .home-path-copy > a {
color: var(--ink);
font-size: 19px;
font-weight: 630;
letter-spacing: -0.025em;
line-height: 1.45;
}
.home-path-records .home-path-copy > a:hover {
color: var(--signal);
}
.home-path-records .home-path-copy > p:last-child {
max-width: 760px;
margin: 7px 0 0;
color: var(--muted);
font-size: 14px;
line-height: 1.65;
}
/* Desktop reading chrome. Context no longer interrupts the article body. */
.context-navigator-wrap {
display: none;
@@ -4602,11 +4155,6 @@ summary {
margin-top: 62px;
}
.project-overview-section {
gap: 56px;
margin-top: 68px;
}
/* Mobile keeps context, but as a compact disclosure above the body. */
@media (max-width: 1179px) {
:root {
@@ -4660,11 +4208,6 @@ summary {
.public-document-page > .shell.context-navigator-wrap {
width: min(var(--body-copy), calc(100% - 64px));
}
.home-path__intro {
grid-template-columns: 1fr;
gap: 18px;
}
}
@media (max-width: 767px) {
@@ -4690,33 +4233,6 @@ summary {
margin-top: 24px;
}
.home-path {
padding-block: 38px 48px;
}
.home-path__intro h2 {
font-size: 28px;
}
.home-path__project {
margin-top: 32px;
}
.home-path-records li {
grid-template-columns: 42px minmax(0, 1fr);
gap: 0 12px;
padding-block: 21px 23px;
}
.home-path-step::after {
left: 11px;
bottom: -24px;
}
.home-path-records .home-path-copy > a {
font-size: 17px;
}
.case-header,
.public-index-page,
.public-document-page,
@@ -4849,7 +4365,6 @@ summary {
}
}
/* Reference sections share one divider. Purpose used to end with a border and
applicability immediately started with another one, producing two horizontal
rules around a strip of whitespace. Keep the transition owned by the next
@@ -30,7 +30,11 @@ export const TECH_LOG_ROUTE_CODECS = Object.freeze({
.strict(),
TechLogHomeSearch: z
.object({
focus: optionalString,
/*
홈의 「지금 하는 것」이 탭이던 시절, 고른 탭을 주소에 남기려고 `focus` 를 받았다. 셋을
한 번에 펴면서 고를 것이 없어졌으므로 받지 않는다 — 읽지 않는 열쇠를 계약에 남겨 두면
다음 사람이 그것이 동작한다고 읽는다.
*/
state: optionalString,
})
.strip(),
@@ -1,246 +0,0 @@
// @vitest-environment jsdom
import { render, screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, expect, it, vi } from "vitest";
import { MemoryRouter } from "react-router-dom";
import { createTechLogFeatureInstalledInput } from "../../../src/features/tech-log/adapters/create-tech-log-feature-input.ts";
import type {
PublicTopic,
PublicTopicDetail,
} from "../../../src/features/tech-log/application/ports/public-content-queries.ts";
import { HomeTopicTabs } from "../../../src/features/tech-log/presentation/public/components/home-topic-tabs.tsx";
import { ApplicationProvider } from "../../../src/presentation/providers/application-provider.tsx";
import { createTestApplication } from "../../helpers/create-test-application.ts";
import { renderWithQueryProviders } from "../../helpers/query-providers.tsx";
import { MOCK_STUDIO_INSTALL_CONTEXT } from "../../helpers/studio-install-context.ts";
/**
* 홈이 주제 하나만 펴 두던 동안, 나머지로 가는 길은 비교 목록 밑의 작은 글씨 한 줄뿐이었다 —
* 다 읽고 나서야 만나는 자리라 대개 지나쳤다. 탭이 하는 일은 「무엇이 더 있는지」를 목록보다
* 먼저 보이게 하는 것이므로, 검사도 그것을 본다.
*/
function topic(
slug: string,
name: string,
variantLabel: string,
variants: ReadonlyArray<[string, string, string]>,
): PublicTopicDetail {
return {
name,
slug,
description: "",
thesis: "",
variantLabel,
variants: variants.map(([variantSlug, title, conclusion]) => ({
slug: variantSlug,
title,
path: `/topics/${slug}/${variantSlug}`,
summary: `${title} 요약`,
conclusion,
recordCount: 2,
})),
featuredCases: [],
activeQuestions: [],
relatedProjects: [],
};
}
const AUTH = topic("oauth-oidc-auth-boundary", "OAuth/OIDC 인증 경계", "구조", [
["spa", "SPA", "브라우저가 token 을 들고 있다"],
["mediator", "Mediator", "교환만 서버가 맡는다"],
["bff", "BFF", "서버가 세션을 갖는다"],
["forward-auth", "Forward-Auth", "게이트웨이가 신원을 붙인다"],
]);
const JPA = topic("jpa-feed-query-performance", "JPA 피드 조회 성능", "조회 전략", [
["fetch-join", "Fetch Join", "행이 곱해진다"],
["derived-query", "Derived Query", "쿼리가 나뉜다"],
]);
/** 목록이 주는 만큼. 탭은 상세 없이 이것만으로 그려져야 한다. */
function listItem(detail: PublicTopicDetail, recordCount: number): PublicTopic {
return {
name: detail.name,
slug: detail.slug,
thesis: "",
description: "",
variantLabel: detail.variantLabel,
variantCount: detail.variants.length,
recordCount,
};
}
function renderTabs(
topics: ReadonlyArray<PublicTopic>,
firstDetail: PublicTopicDetail,
getTopicDetail = vi.fn(async (slug: string) =>
[AUTH, JPA].find((detail) => detail.slug === slug),
),
) {
const techLog = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input;
const application = createTestApplication({
featureInputs: {
"tech-log": {
...techLog,
publicContent: { ...techLog.publicContent, getTopicDetail },
},
},
});
render(
renderWithQueryProviders(
<ApplicationProvider application={application}>
<MemoryRouter>
<HomeTopicTabs topics={topics} firstDetail={firstDetail} />
</MemoryRouter>
</ApplicationProvider>,
),
);
return { getTopicDetail };
}
const TABS = [listItem(AUTH, 18), listItem(JPA, 3)];
describe("홈의 주제 탭", () => {
/*
이 검사가 답하는 것: 주제를 새로 만들면 코드를 고쳐야 탭이 느는가.
화면에는 주제 이름도, 개수도, 상한도 적혀 있지 않다. 탭은 목록이 준 것을 그대로 세우므로
서버가 셋을 주면 셋이 선다. 예전에 주제 화면이 주제 셋을 코드에 적어 두고 그 셋만 열던
때가 있었고, 새 주제를 만들어도 화면에는 나오지 않았다.
*/
it("주제가 늘면 코드를 고치지 않아도 탭이 는다", () => {
const REDIS = topic("redis-adapter-ttl", "Redis 어댑터 TTL", "만료 전략", [
["ttl", "TTL", "만료를 저장소가 맡는다"],
["sweep", "Sweep", "만료를 배치가 맡는다"],
]);
renderTabs([...TABS, listItem(REDIS, 5)], AUTH);
expect(screen.getAllByRole("tab").map((tab) => tab.textContent)).toEqual([
"OAuth/OIDC 인증 경계",
"JPA 피드 조회 성능",
"Redis 어댑터 TTL",
]);
});
it("주제가 스무 개여도 전부 서고, 처음 여는 요청은 그대로 하나다", () => {
const many = Array.from({ length: 20 }, (_, index) =>
listItem(
topic(`topic-${index}`, `주제 ${index}`, "축", [
["a", "A", ""],
["b", "B", ""],
]),
index,
),
);
const { getTopicDetail } = renderTabs([listItem(AUTH, 99), ...many], AUTH);
expect(screen.getAllByRole("tab")).toHaveLength(21);
expect(getTopicDetail).not.toHaveBeenCalled();
});
it("주제 이름이 목록보다 먼저 전부 보인다", () => {
renderTabs(TABS, AUTH);
expect(screen.getAllByRole("tab").map((tab) => tab.textContent)).toEqual([
"OAuth/OIDC 인증 경계",
"JPA 피드 조회 성능",
]);
});
it("첫 주제의 축은 미리 받아 둔 것으로 곧바로 열린다", () => {
const { getTopicDetail } = renderTabs(TABS, AUTH);
expect(getTopicDetail).not.toHaveBeenCalled();
const open = screen.getByRole("tabpanel");
expect(within(open).getAllByRole("link").map((link) => link.textContent)).toEqual([
"OAuth/OIDC 인증 경계 전체 보기",
"SPA브라우저가 token 을 들고 있다",
"Mediator교환만 서버가 맡는다",
"BFF서버가 세션을 갖는다",
"Forward-Auth게이트웨이가 신원을 붙인다",
]);
expect(within(open).getByText("구조")).toBeTruthy();
});
it("고른 주제의 상세만 그때 받는다", async () => {
const user = userEvent.setup();
const { getTopicDetail } = renderTabs(TABS, AUTH);
await user.click(screen.getByRole("tab", { name: "JPA 피드 조회 성능" }));
expect(getTopicDetail).toHaveBeenCalledExactlyOnceWith("jpa-feed-query-performance");
const open = screen.getByRole("tabpanel");
expect(within(open).getByText("조회 전략")).toBeTruthy();
await waitFor(() =>
expect(
within(open)
.getAllByRole("link")
.map((link) => link.getAttribute("href")),
).toEqual([
"/topics/jpa-feed-query-performance",
"/topics/jpa-feed-query-performance/fetch-join",
"/topics/jpa-feed-query-performance/derived-query",
]),
);
});
it("한 번 받은 주제는 다시 받지 않는다", async () => {
const user = userEvent.setup();
const { getTopicDetail } = renderTabs(TABS, AUTH);
await user.click(screen.getByRole("tab", { name: "JPA 피드 조회 성능" }));
await screen.findByText("조회 전략");
await user.click(screen.getByRole("tab", { name: "OAuth/OIDC 인증 경계" }));
await user.click(screen.getByRole("tab", { name: "JPA 피드 조회 성능" }));
expect(getTopicDetail).toHaveBeenCalledOnce();
});
it("받지 못하면 그 자리에 남긴다 — 목록만 사라지지 않는다", async () => {
const user = userEvent.setup();
renderTabs(
TABS,
AUTH,
vi.fn(async () => {
throw new Error("불통");
}),
);
await user.click(screen.getByRole("tab", { name: "JPA 피드 조회 성능" }));
expect(await screen.findByText("이 주제를 지금 불러오지 못했습니다.")).toBeTruthy();
expect(screen.getAllByRole("tab")).toHaveLength(2);
});
it("방향키로 탭을 옮긴다", async () => {
const user = userEvent.setup();
renderTabs(TABS, AUTH);
await user.tab();
await user.keyboard("{ArrowRight}");
expect(screen.getByRole("tab", { selected: true }).textContent).toBe(
"JPA 피드 조회 성능",
);
});
it("주제가 하나면 고를 것이 없지만 목록은 그대로 나온다", () => {
renderTabs([listItem(AUTH, 18)], AUTH);
expect(screen.queryAllByRole("tab")).toHaveLength(0);
expect(screen.getByRole("button").textContent).toBe("OAuth/OIDC 인증 경계");
expect(
screen.getAllByRole("link").map((link) => link.getAttribute("href")),
).toEqual([
"/topics/oauth-oidc-auth-boundary",
"/topics/oauth-oidc-auth-boundary/spa",
"/topics/oauth-oidc-auth-boundary/mediator",
"/topics/oauth-oidc-auth-boundary/bff",
"/topics/oauth-oidc-auth-boundary/forward-auth",
]);
});
});
@@ -18,11 +18,6 @@ import {
TECH_LOG_ROUTE_RUNTIME_CONTRACT,
type TechLogRouteId,
} from "../../../src/features/tech-log/contracts/tech-log-route-contract.ts";
import {
moveFocus,
normalizeFocus,
shouldNormalizeFocusUrl,
} from "../../../src/features/tech-log/domain/public/focus-state.ts";
import { PublicShell } from "../../../src/features/tech-log/presentation/public/public-shell.tsx";
import { ExploreKindPage } from "../../../src/features/tech-log/presentation/public/pages/explore-kind-page.tsx";
import { ExplorePage } from "../../../src/features/tech-log/presentation/public/pages/explore-page.tsx";
@@ -130,11 +125,8 @@ afterEach(() => {
});
describe("TechLog home discovery", () => {
it("renders the exact identity, focus, latest ordering, and explore choices", async () => {
const { router } = await renderDiscoveryRoute(
"TECH_LOG_HOME",
"/?focus=invalid&focus=question",
);
it("renders the exact identity, now block, latest ordering, and explore choices", async () => {
await renderDiscoveryRoute("TECH_LOG_HOME", "/");
expect(screen.getByRole("heading", { level: 1, name: "TechLog" })).toBeVisible();
expect(
@@ -142,39 +134,26 @@ describe("TechLog home discovery", () => {
"문제를 한 편의 글로 끝내지 않고, 질문에서 검증과 결정까지 이어서 기록합니다.",
),
).toHaveClass("identity-statement");
expect(screen.getByText("지금 집중하는 것")).toHaveClass("section-kicker");
await waitFor(() => {
expect(router.state.location.search).toBe("?focus=current");
});
expect(screen.getByRole("tab", { name: "현재 작업" })).toHaveAttribute(
"aria-selected",
"true",
);
/*
패널은 묶음마다 하나뿐이라 고른 탭만 그것을 가리킨다. 탭 전부가 같은 패널을 가리키면
고르지 않은 탭이 "내가 저 패널을 연다" 고 말하면서 패널은 다른 탭의 이름을 달게 된다.
그래서 검사도 고른 탭에만 건다.
셋이 한 번에 서 있어야 한다. 탭이던 시절에는 고른 하나만 보였고 나머지 둘은 이름으로만
존재했다 — 홈이 답해야 하는 "지금 무엇을 하고 있는가" 는 그 셋을 함께 읽어야 답이 된다.
탭이 사라졌으므로 화면 어디에도 탭이 없어야 한다.
*/
/*
두 탭 묶음이 서로 다른 모양을 쓴다. 「지금 집중하는 것」은 탭마다 패널이 하나씩이고,
주제 탭은 패널이 하나뿐이라 고른 탭만 그것을 가리킨다 — 전부가 같은 패널을 가리키면
고르지 않은 탭이 "내가 저 패널을 연다" 고 말하면서 패널은 다른 탭의 이름을 달게 된다.
expect(screen.getByText("Now")).toHaveClass("section-kicker");
expect(screen.queryAllByRole("tab")).toHaveLength(0);
expect(screen.queryAllByRole("tabpanel")).toHaveLength(0);
const now = screen.getByRole("region", { name: /Backend Skeleton|백엔드/ });
expect(within(now).getByText("열린 질문")).toBeVisible();
expect(within(now).getByText("최근 결정")).toBeVisible();
expect(within(now).getByRole("link", { name: /Filesystem과 Object Storage/ })).toBeVisible();
두 모양에 다 성립하는 것은 이것이다: 가리키는 패널이 있으면 그 패널은 실제로 있고
자기를 가리킨 탭의 이름을 달고 있다.
/*
홈의 입구는 프로젝트다. 맥락을 자세히 그리는 일은 프로젝트·주제 화면이 맡고, 홈은 어디로
들어갈지 정하게 한다.
*/
for (const tab of screen.getAllByRole("tab")) {
const panelId = tab.getAttribute("aria-controls");
if (!panelId) {
expect(tab.getAttribute("aria-selected")).toBe("false");
continue;
}
expect(document.getElementById(panelId)).toHaveAttribute(
"aria-labelledby",
tab.id,
);
}
const projects = screen.getByRole("region", { name: "조사가 사는 곳" });
expect(within(projects).getAllByRole("listitem").length).toBeGreaterThan(0);
/*
홈은 앞의 몇 편만 편다. 주제 허브가 생긴 지금 홈이 할 일은 목록을 통째로 펴 두는 것이
@@ -215,92 +194,6 @@ describe("TechLog home discovery", () => {
).toHaveAttribute("href", "/explore/questions");
});
it("moves linked tabs with arrows, Home, and End while synchronizing the URL", async () => {
const user = userEvent.setup();
const { router } = await renderDiscoveryRoute("TECH_LOG_HOME", "/?focus=question");
const question = screen.getByRole("tab", { name: "열린 질문" });
question.focus();
await user.keyboard("{ArrowRight}");
expect(screen.getByRole("tab", { name: "최근 결정" })).toHaveFocus();
expect(router.state.location.search).toBe("?focus=decision");
expect(screen.getByRole("heading", { name: /Filesystem과 Object Storage/ })).toBeVisible();
await user.keyboard("{ArrowRight}");
expect(screen.getByRole("tab", { name: "현재 작업" })).toHaveFocus();
expect(router.state.location.search).toBe("?focus=current");
await user.keyboard("{End}");
expect(screen.getByRole("tab", { name: "최근 결정" })).toHaveFocus();
await user.keyboard("{Home}");
expect(screen.getByRole("tab", { name: "현재 작업" })).toHaveFocus();
/*
탭 묶음이 둘이다 — 「지금 집중하는 것」과 주제 탭. 각 묶음은 패널을 하나만 펴 두므로
화면 전체에서 둘이다. 주제 탭이 생기기 전에는 하나였다.
*/
expect(screen.getAllByRole("tabpanel")).toHaveLength(2);
});
it("treats external focus URL changes as authoritative without stealing focus", async () => {
const { router } = await renderDiscoveryRoute(
"TECH_LOG_HOME",
"/?focus=current&state=latest-empty#latest",
);
const current = screen.getByRole("tab", { name: "현재 작업" });
current.focus();
await router.navigate("/?focus=question&state=latest-empty#latest");
await waitFor(() => {
expect(screen.getByRole("tab", { name: "열린 질문" })).toHaveAttribute(
"aria-selected",
"true",
);
});
expect(router.state.location).toMatchObject({
pathname: "/",
search: "?focus=question&state=latest-empty",
hash: "#latest",
});
expect(screen.getByRole("tab", { name: "열린 질문" })).toHaveAttribute(
"tabindex",
"0",
);
expect(current).toHaveAttribute("aria-selected", "false");
expect(current).toHaveAttribute("tabindex", "-1");
expect(current).toHaveFocus();
expect(
screen.getByRole("tabpanel", { name: "열린 질문" }),
).toBeVisible();
expect(document.getElementById("focus-panel-current")).toHaveAttribute(
"hidden",
);
await router.navigate("/?focus=decision&state=latest-empty#latest");
await waitFor(() => {
expect(screen.getByRole("tab", { name: "최근 결정" })).toHaveAttribute(
"aria-selected",
"true",
);
});
expect(router.state.location).toMatchObject({
pathname: "/",
search: "?focus=decision&state=latest-empty",
hash: "#latest",
});
expect(screen.getByRole("tab", { name: "최근 결정" })).toHaveAttribute(
"tabindex",
"0",
);
expect(screen.getByRole("tabpanel", { name: "최근 결정" })).toBeVisible();
/*
탭 묶음이 둘이다 — 「지금 집중하는 것」과 주제 탭. 각 묶음은 패널을 하나만 펴 두므로
화면 전체에서 둘이다. 주제 탭이 생기기 전에는 하나였다.
*/
expect(screen.getAllByRole("tabpanel")).toHaveLength(2);
});
it("preserves the source home empty and error states", async () => {
const emptyView = await renderDiscoveryRoute("TECH_LOG_HOME", "/?state=latest-empty");
expect(screen.getByText("아직 공개된 기록이 없습니다.")).toHaveClass(
@@ -329,7 +222,7 @@ describe("TechLog home discovery", () => {
errorView.unmount();
await renderDiscoveryRoute("TECH_LOG_HOME", "/?state=focus-empty");
expect(screen.queryByText("지금 집중하는 것")).not.toBeInTheDocument();
expect(screen.queryByText("Now")).not.toBeInTheDocument();
});
});
@@ -625,20 +518,3 @@ describe("TechLog search discovery", () => {
expect(within(screen.getByRole("main")).queryByRole("list")).toBeNull();
});
});
describe("home focus domain", () => {
it("normalizes selection and wraps all supported keyboard movements", async () => {
const keys = ["current", "question", "decision"] as const;
expect(normalizeFocus(undefined, keys)).toBe("current");
expect(normalizeFocus("missing", keys)).toBe("current");
expect(normalizeFocus("question", keys)).toBe("question");
expect(normalizeFocus("question", [])).toBeNull();
expect(shouldNormalizeFocusUrl(undefined, "current")).toBe(false);
expect(shouldNormalizeFocusUrl("", "current")).toBe(true);
expect(moveFocus("current", "ArrowLeft", keys)).toBe("decision");
expect(moveFocus("decision", "ArrowRight", keys)).toBe("current");
expect(moveFocus("question", "Home", keys)).toBe("current");
expect(moveFocus("question", "End", keys)).toBe("decision");
});
});
@@ -349,37 +349,36 @@ 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();
});
/*
서버가 주는 대표 기록은 작성자가 주제마다 손으로 골라 두는 값이라 대부분 비어 있다. 비면
열린 질문만 남아, 아직 답이 없는 질문을 모아 두고 「먼저 읽을 것」이라 부르게 된다 —
처음 온 사람에게 가장 나쁜 첫 화면이다. 그래서 기록에서 순서를 만든다:
원리 → 확인한 기록 → 기준 → 아직 모르는 것.
주제 화면이 답하는 것은 "어떤 순서로 생각해서 여기까지 왔나" 다. 서버가 주는 대표 기록은
작성자가 주제마다 손으로 골라 두는 값이라 대부분 비어 있고, 비면 열린 질문만 남는다 —
아직 답이 없는 질문 넷을 모아 두고 흐름이라 부르는 것이 처음 온 사람에게 가장 나쁜 첫
화면이다. 그래서 기록에서 순서를 만든다: 원리 → 확인한 기록 → 기준.
아직 답하지 못한 질문은 흐름에 넣지 않는다. 마지막 칸에 두면 이 주제가 질문으로 끝난 것처럼
읽히고, 그것은 사고의 결과가 아니라 다음 할 일이다.
*/
it("orders the first reads by kind and does not repeat them below", async () => {
it("orders the reasoning path by kind and does not repeat it below", async () => {
const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/jpa");
const firstReads = [
...(container.querySelectorAll(".document-relations")[0]?.querySelectorAll("li a") ?? []),
].map((link) => ({
label: link.querySelector("span")?.textContent,
href: link.getAttribute("href"),
const steps = [...container.querySelectorAll(".context-flow__copy")].map((copy) => ({
label: copy.querySelector(".context-flow__meta")?.textContent,
href: copy.querySelector("a")?.getAttribute("href"),
}));
expect(firstReads.map((entry) => entry.label)).toEqual([
"검증 기록",
"적용 기준",
"열린 질문",
]);
expect(steps.map((entry) => entry.label)).toEqual(["검증 기록", "적용 기준"]);
// 위에 오른 편은 아래 목록에서 빠진다 — 같은 편이 두 번 나오면 순서를 정해 준 뜻이 없다.
// 흐름에 오른 편은 아래 목록에서 빠진다 — 같은 편이 두 번 나오면 순서를 정해 준 뜻이 없다.
const rest = [...container.querySelectorAll(".public-record-list > li > a")].map((link) =>
link.getAttribute("href"),
);
for (const entry of firstReads) {
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();
});
/*
@@ -396,19 +395,18 @@ describe("TechLog topics and Public not-found routing", () => {
).not.toBeInTheDocument();
});
it("keeps JPA topic records in canonical published order", async () => {
it("keeps JPA topic records in canonical reasoning order", async () => {
const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/jpa");
// 픽스처의 JPA 주제는 종류마다 한 편씩이라 셋 다 「먼저 읽을 것」으로 올라가고 아래는 빈다.
// 픽스처의 JPA 주제는 종류마다 한 편씩이다. 원리가 없으므로 흐름은 확인 → 기준 둘이다.
expect(
Array.from(
container.querySelectorAll(".document-relations")[0]!.querySelectorAll("li a"),
container.querySelectorAll(".context-flow__copy > a"),
(link) => link.getAttribute("href"),
),
).toEqual([
"/cases/collection-fetch-join-pagination",
"/references/jpa-list-fetch-strategy",
"/questions/collection-fetch-join-with-pagination",
]);
});
@@ -170,12 +170,12 @@ describe("TechLog project screens", () => {
Array.from(container.querySelectorAll(".project-stat-links a"), (link) => link.textContent),
).toEqual(stats);
/*
주제는 이제 이름만 나열하지 않고 주제별 조사 지도로 편다. 확인하는 것은 그대로다 —
이 프로젝트가 다루는 주제가 빠짐없이, 정한 순서대로 나오는가.
프로젝트 화면이 답하는 계층은 주제다. 확인하는 것은 그대로다 — 이 프로젝트가 다루는 주제가
빠짐없이, 정한 순서대로 나오는가. 기록은 여기 그리지 않는다.
*/
expect(
Array.from(
container.querySelectorAll(".investigation-topic > a, .investigation-topic > strong"),
container.querySelectorAll(".context-flow__copy > a, .context-flow__copy > strong"),
(item) => item.textContent,
),
).toEqual(topics);
@@ -193,10 +193,11 @@ describe("TechLog route boundary contract", () => {
).toEqual({ type: "CASE", topic: "JPA", project: "tech-log" });
expect(
TECH_LOG_ROUTE_CODECS.TechLogHomeSearch.parse({
// 탭이 사라지면서 `focus` 도 계약에서 내렸다. 남아 있으면 조용히 버려진다.
focus: ["architecture", "delivery"],
state: ["latest-empty", "site-error"],
}),
).toEqual({ focus: "architecture", state: "latest-empty" });
).toEqual({ state: "latest-empty" });
expect(
TECH_LOG_ROUTE_CODECS.TechLogSearchQuery.parse({ q: [" gateway ", "ignored"] }),
).toEqual({ q: "gateway" });