feat: 주제 목록 화면을 만들어 주 내비에 넣는다

주제로 가는 길이 기록의 breadcrumb 과 탐색의 묶음 제목뿐이었다. 주제가 이 기록의 뼈대인데
그 목록을 정면으로 보여 주는 자리가 없었고, 홈이 한 주제만 펼치던 동안 나머지는 최근
기록에 우연히 걸릴 때만 보였다.

목록의 각 줄은 이름·논지·축·기록 수를 싣는다. 이름은 무엇에 대한 것인지만 말하므로,
들어갈지 말지를 정하려면 그 주제가 무엇에 답하는지가 함께 있어야 한다. 그래서 계약의
`TopicListItem` 에 논지와 축을 더한다 — 그동안 이름과 개수뿐이었다.

홈의 「다른 주제」 줄은 목록으로 가는 한 줄로 줄인다. 주제가 늘면 옆으로 길어지던 자리다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ
This commit is contained in:
DongHyeonka
2026-09-02 00:43:58 +09:00
co-authored by Claude Opus 5
parent 69eabc7d6c
commit aca4f189d1
20 changed files with 206 additions and 28 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

+5 -5
View File
@@ -38,28 +38,28 @@
},
"contractSet": {
"setAlgorithm": "CA_CONTRACT_SET_V1",
"setDigest": "sha256:cb8c02d87ac373d46de335091e435400ae1374002da9a446ee203b02c1dd58ec",
"setDigest": "sha256:aa41ae707608d877c99542aa839b88a3dda60169402b7bacdff5176913a973f0",
"packages": [
{
"packageId": "@tech-log/management-contract",
"version": "1.0.0",
"digest": "sha256:61f8360cfb2e638c5d8c5557434b564e39cea517464c33cedcd1c5bf39a58aa8",
"runtimeProtocolVersion": 1,
"sourceRevision": "b93d62a"
"sourceRevision": "559d04f"
},
{
"packageId": "@tech-log/public-contract",
"version": "2.1.0",
"digest": "sha256:10b922715a4149f2dcf4d5925fb1d3e3e820a6d14d9e4a91d7a325027684280d",
"digest": "sha256:babb24ab85c5b92b2d8b9ad9aa10151430fd15aae84ca5318564468b3c9278ca",
"runtimeProtocolVersion": 1,
"sourceRevision": "b93d62a"
"sourceRevision": "559d04f"
},
{
"packageId": "@tech-log/studio-contract",
"version": "3.1.0",
"digest": "sha256:d2bfbe0a12136f131ccb8c42f8868108ba8d0f0182b347f9b815316c343a970c",
"runtimeProtocolVersion": 1,
"sourceRevision": "b93d62a"
"sourceRevision": "559d04f"
}
]
}
@@ -448,6 +448,10 @@ export function createHttpPublicContentGateway(
Object.freeze({
name: String(item.name ?? ""),
slug: String(item.slug ?? ""),
thesis: String(item.thesis ?? ""),
description: String(item.description ?? ""),
variantLabel: String(item.variantLabel ?? ""),
variantCount: Number(item.variantCount ?? 0),
recordCount: Number(item.recordCount ?? 0),
}),
);
@@ -127,12 +127,27 @@ export function getProjectActivity(projectSlug: string): ProjectActivity[] {
* 그린다)에도 맞는다.
*/
export function listTopics(): PublicTopic[] {
const counts = new Map<string, { name: string; slug: string; recordCount: number }>();
const counts = new Map<string, PublicTopic>();
for (const record of listRecords()) {
if (!record.topic) continue;
const existing = counts.get(record.topicSlug);
if (existing) existing.recordCount += 1;
else counts.set(record.topicSlug, { name: record.topic, slug: record.topicSlug, recordCount: 1 });
if (existing) {
counts.set(record.topicSlug, { ...existing, recordCount: existing.recordCount + 1 });
continue;
}
/*
정적 자료에는 논지도 축도 없다 — 사람이 Studio 에서 쓰는 글이라 픽스처가 지어낼 수 없다.
화면은 비면 그 줄을 그리지 않는다.
*/
counts.set(record.topicSlug, {
name: record.topic,
slug: record.topicSlug,
thesis: "",
description: "",
variantLabel: "",
variantCount: 0,
recordCount: 1,
});
}
return [...counts.values()]
.sort((left, right) => right.recordCount - left.recordCount || (left.name < right.name ? -1 : 1))
@@ -191,10 +191,16 @@ export type Release = {
related: ReadonlyArray<{ title: string; path: string }>;
};
/** 계약 `TopicSummary`. 목록에 필요한 만큼만 옮긴다. */
/** 계약 `TopicListItem`. 목록 화면이 쓰는 만큼만 옮긴다. */
export type PublicTopic = {
name: string;
slug: string;
/** 이 주제가 답하는 질문. 이름은 무엇에 대한 것인지만 말하고 무엇에 답하는지는 말하지 않는다. */
thesis: string;
description: string;
/** 축의 이름. 비면 이 주제는 축을 쓰지 않는다. */
variantLabel: string;
variantCount: number;
recordCount: number;
};
@@ -2,7 +2,7 @@
"packageId": "@tech-log/management-contract",
"version": "1.0.0",
"digest": "sha256:61f8360cfb2e638c5d8c5557434b564e39cea517464c33cedcd1c5bf39a58aa8",
"sourceRevision": "b93d62a",
"sourceRevision": "559d04f",
"operationIds": [
"createCaseDraft",
"getCaseForEdit",
@@ -1,8 +1,8 @@
{
"packageId": "@tech-log/public-contract",
"version": "2.1.0",
"digest": "sha256:10b922715a4149f2dcf4d5925fb1d3e3e820a6d14d9e4a91d7a325027684280d",
"sourceRevision": "b93d62a",
"digest": "sha256:babb24ab85c5b92b2d8b9ad9aa10151430fd15aae84ca5318564468b3c9278ca",
"sourceRevision": "559d04f",
"operationIds": [
"getPublicSite",
"getPublicHome",
@@ -539,6 +539,15 @@ export interface components {
name: string;
slug: string;
description: string;
/** @description 이 주제가 답하는 질문. 목록이 이름과 개수만 싣던 동안 독자는 주제 이름만 보고
* 들어갈지 말지를 정해야 했다 — 이름은 무엇에 대한 것인지만 말하고 무엇에 답하는지는
* 말하지 않는다.
* */
thesis?: string;
/** @description 축의 이름. 비면 이 주제는 축을 쓰지 않는다. */
variantLabel?: string;
/** @description 이 주제가 견주는 접근의 수. 축을 쓰지 않으면 0 이다. */
variantCount?: number;
recordCount?: number;
};
TopicListResponse: {
@@ -1228,6 +1228,19 @@ components:
type: string
description:
type: string
thesis:
type: string
description: |
이 주제가 답하는 질문. 목록이 이름과 개수만 싣던 동안 독자는 주제 이름만 보고
들어갈지 말지를 정해야 했다 — 이름은 무엇에 대한 것인지만 말하고 무엇에 답하는지는
말하지 않는다.
variantLabel:
type: string
description: 축의 이름. 비면 이 주제는 축을 쓰지 않는다.
variantCount:
type: integer
minimum: 0
description: 이 주제가 견주는 접근의 수. 축을 쓰지 않으면 0 이다.
recordCount:
type: integer
TopicListResponse:
@@ -2,7 +2,7 @@
"packageId": "@tech-log/studio-contract",
"version": "3.1.0",
"digest": "sha256:d2bfbe0a12136f131ccb8c42f8868108ba8d0f0182b347f9b815316c343a970c",
"sourceRevision": "b93d62a",
"sourceRevision": "559d04f",
"operationIds": [
"getStudioSession",
"getStudioDashboard",
@@ -29,6 +29,7 @@ const TECH_LOG_ROUTE_SPECS = [
defineSpec({ routeId: "TECH_LOG_REFERENCE", path: "/references/:slug", layoutGroup: "PUBLIC", paramsSchema: "TechLogSlugParams", searchSchema: null, title: "Reference", navigationLabel: null, navigationOrder: null }),
defineSpec({ routeId: "TECH_LOG_CONCEPT", path: "/concepts/:slug", layoutGroup: "PUBLIC", paramsSchema: "TechLogSlugParams", searchSchema: null, title: "개념", navigationLabel: null, navigationOrder: null }),
defineSpec({ routeId: "TECH_LOG_QUESTION", path: "/questions/:slug", layoutGroup: "PUBLIC", paramsSchema: "TechLogSlugParams", searchSchema: null, title: "Open Question", navigationLabel: null, navigationOrder: null }),
defineSpec({ routeId: "TECH_LOG_TOPICS", path: "/topics", layoutGroup: "PUBLIC", paramsSchema: null, searchSchema: null, title: "주제", navigationLabel: "주제", navigationOrder: 15 }),
defineSpec({ routeId: "TECH_LOG_TOPIC", path: "/topics/:slug", layoutGroup: "PUBLIC", paramsSchema: "TechLogSlugParams", searchSchema: null, title: "Topic", navigationLabel: null, navigationOrder: null }),
defineSpec({ routeId: "TECH_LOG_TOPIC_VARIANT", path: "/topics/:slug/:variant", layoutGroup: "PUBLIC", paramsSchema: "TechLogTopicVariantParams", searchSchema: null, title: "Topic", navigationLabel: null, navigationOrder: null }),
defineSpec({ routeId: "TECH_LOG_PROJECTS", path: "/projects", layoutGroup: "PUBLIC", paramsSchema: null, searchSchema: null, title: "프로젝트", navigationLabel: "프로젝트", navigationOrder: 20 }),
@@ -255,18 +255,13 @@ export function HomePage() {
</ul>
{/*
나머지 주제. 하나만 펼쳐 두면 그 주제가 이 기록의 전부인 것처럼 보인다 — 실제로
JPA 주제는 최근 기록에 우연히 걸릴 때만 보였고, 무엇을 견줬는지는 홈 어디에서도
닿을 수 없었다. 펼치지는 않는다; 견주는 자리는 한 번에 하나여야 읽힌다.
나머지 주제로 가는 길. 하나만 펼쳐 두면 그 주제가 이 기록의 전부인 것처럼 보인다 —
실제로 JPA 주제는 최근 기록에 우연히 걸릴 때만 보였다. 여기서 펼치지는 않는다;
견주는 자리는 한 번에 하나여야 읽히고, 나머지는 주제 목록이 받는다.
*/}
{topics.others.length > 0 ? (
<p className="home-other-topics">
<span>다른 주제</span>
{topics.others.map((topic) => (
<Link key={topic.slug} to={`/topics/${topic.slug}`}>
{`${topic.name} (${topic.recordCount})`}
</Link>
))}
<Link to="/topics">{`다른 주제 ${topics.others.length}개 보기`}</Link>
</p>
) : null}
</section>
@@ -0,0 +1,67 @@
import { Link } from "react-router-dom";
import { usePublicContent } from "../use-public-content.tsx";
/**
* 주제 목록.
*
* <p>주제로 가는 길이 기록의 breadcrumb 과 탐색의 묶음 제목뿐이었다. 주제가 이 기록의 뼈대인데
* 그 목록을 정면으로 보여 주는 자리가 없었고, 홈이 한 주제만 펼치던 동안 나머지는 최근 기록에
* 우연히 걸릴 때만 보였다.
*
* <p>줄마다 이름·논지·축·기록 수를 싣는다. 이름은 무엇에 대한 것인지만 말하므로, 들어갈지
* 말지를 정하려면 그 주제가 무엇에 답하는지가 함께 있어야 한다.
*/
export function TopicsPage() {
const view = usePublicContent(["tech-log", "topics"], async (queries) => ({
topics: await queries.listTopics(),
}));
if (!view.ready) return view.fallback;
const { topics } = view.data;
return (
<main id="main-content" className="shell public-index-page">
<header className="public-page-header">
<p className="section-kicker">Topics</p>
<h1>주제</h1>
<p>같은 질문에 답하려고 모은 기록들입니다. 주제 안에서 접근을 나눠 견줍니다.</p>
</header>
<div className="public-result-heading">
<h2>전체 주제</h2>
<p>{`${topics.length}개`}</p>
</div>
{topics.length === 0 ? (
<p className="public-empty-state">아직 공개된 주제가 없습니다.</p>
) : (
<ul className="topic-index-list">
{topics.map((topic) => (
<li key={topic.slug}>
<Link to={`/topics/${topic.slug}`}>
<strong>{topic.name}</strong>
{/*
논지가 있으면 그것이 이 주제를 고르는 근거다. 아직 쓰지 않았으면 설명으로
물러서고, 둘 다 없으면 그 줄을 그리지 않는다 — 빈 문단은 아무것도 말하지 않는다.
*/}
{topic.thesis || topic.description ? (
<p>{firstLine(topic.thesis || topic.description)}</p>
) : null}
<span className="topic-index-meta">
{topic.variantCount > 0
? `${topic.variantLabel || "접근"} ${topic.variantCount} · 기록 ${topic.recordCount}`
: `기록 ${topic.recordCount}`}
</span>
</Link>
</li>
))}
</ul>
)}
</main>
);
}
/** 논지는 여러 문단이다. 목록에는 첫 문단만 — 목록에서 필요한 것은 고를 근거 한 줄이다. */
function firstLine(text: string): string {
return text.split(/\n{2,}/u)[0]?.trim() ?? "";
}
@@ -3056,10 +3056,6 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
font-size: 13px;
}
.home-other-topics > span {
font-weight: 600;
}
.home-other-topics a {
color: var(--muted);
}
@@ -3067,3 +3063,62 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
.home-other-topics a:hover {
color: var(--signal);
}
/*
주제 목록. 기록 목록과 같은 배치를 쓰되 칸이 셋이다 — 이름, 고를 근거, 규모.
*/
.topic-index-list {
margin: 0;
padding: 0;
list-style: none;
border-top: 1px solid var(--line-strong);
}
.topic-index-list li {
border-bottom: 1px solid var(--line);
}
.topic-index-list li > a {
display: grid;
grid-template-columns: 220px minmax(0, 1fr) 160px;
gap: 24px;
align-items: baseline;
padding: 30px 2px 32px;
}
.topic-index-list strong {
color: var(--ink);
font-size: 18px;
font-weight: 630;
letter-spacing: -0.02em;
line-height: 1.4;
}
.topic-index-list p {
max-width: 700px;
margin: 0;
color: var(--muted);
font-size: 14px;
line-height: 1.65;
}
.topic-index-meta {
color: var(--faint);
font-size: 12px;
text-align: right;
}
.topic-index-list li > a:hover strong {
color: var(--signal);
}
@media (max-width: 720px) {
.topic-index-list li > a {
grid-template-columns: minmax(0, 1fr);
gap: 8px;
}
.topic-index-meta {
text-align: left;
}
}
@@ -82,6 +82,13 @@ export const TECH_LOG_ROUTE_RUNTIME = Object.freeze({
"QuestionPage",
),
),
TECH_LOG_TOPICS: runtime(
"TECH_LOG_TOPICS",
routeModule(
() => import("./public/pages/topics-page.tsx"),
"TopicsPage",
),
),
TECH_LOG_TOPIC: runtime(
"TECH_LOG_TOPIC",
routeModule(() => import("./public/pages/topic-page.tsx"), "TopicPage"),
@@ -15,6 +15,7 @@ describe("TechLog navigation derivation", () => {
techLogNavigation("PUBLIC").map((entry) => [entry.label, entry.path]),
).toEqual([
["탐색", "/explore"],
["주제", "/topics"],
["프로젝트", "/projects"],
["프로필", "/profile"],
]);
@@ -102,6 +102,7 @@ describe("TechLog Public shell", () => {
).toBeInTheDocument();
const expectedNavigation = [
["탐색", "/explore"],
["주제", "/topics"],
["프로젝트", "/projects"],
["프로필", "/profile"],
];
@@ -19,6 +19,7 @@ const expectedRoutes = [
["TECH_LOG_REFERENCE", "/references/:slug", "PUBLIC", "TechLogSlugParams", null],
["TECH_LOG_CONCEPT", "/concepts/:slug", "PUBLIC", "TechLogSlugParams", null],
["TECH_LOG_QUESTION", "/questions/:slug", "PUBLIC", "TechLogSlugParams", null],
["TECH_LOG_TOPICS", "/topics", "PUBLIC", null, null],
["TECH_LOG_TOPIC", "/topics/:slug", "PUBLIC", "TechLogSlugParams", null],
[
"TECH_LOG_TOPIC_VARIANT",
@@ -63,6 +64,7 @@ const expectedTitles = {
TECH_LOG_CONCEPT: "개념",
TECH_LOG_REFERENCE: "Reference",
TECH_LOG_QUESTION: "Open Question",
TECH_LOG_TOPICS: "주제",
TECH_LOG_TOPIC: "Topic",
TECH_LOG_TOPIC_VARIANT: "Topic",
TECH_LOG_PROJECTS: "프로젝트",
@@ -94,7 +96,7 @@ const expectedTitles = {
} as const;
describe("TechLog route boundary contract", () => {
it("freezes the standalone 33-route inventory before runtime installation", () => {
it("freezes the standalone 34-route inventory before runtime installation", () => {
expect(
Object.values(TECH_LOG_ROUTE_REGISTRY).map((definition) => [
definition.routeId,
@@ -156,6 +158,7 @@ describe("TechLog route boundary contract", () => {
]),
).toEqual([
["TECH_LOG_EXPLORE", "PUBLIC", "탐색", 10],
["TECH_LOG_TOPICS", "PUBLIC", "주제", 15],
["TECH_LOG_PROJECTS", "PUBLIC", "프로젝트", 20],
["TECH_LOG_PROFILE", "PUBLIC", "프로필", 40],
["TECH_LOG_STUDIO_DOCUMENTS", "STUDIO", "작업본", 10],
@@ -168,7 +171,7 @@ describe("TechLog route boundary contract", () => {
for (const locale of ["ko-KR", "en-US"] as const) {
const catalog: Readonly<Record<string, string>> =
TECH_LOG_MESSAGE_CATALOGS[locale];
expect(Object.keys(catalog)).toHaveLength(70);
expect(Object.keys(catalog)).toHaveLength(72);
for (const [routeId, title] of Object.entries(expectedTitles)) {
expect(catalog[`route.${routeId}.title`]).toBe(title);
expect(catalog[`route.${routeId}.navigation`]).toBe(title);
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

+1
View File
@@ -12,6 +12,7 @@ const techLogRouteChunks = Object.freeze({
"/public/pages/reference-page.tsx": "route-tech-log-reference",
"/public/pages/concept-page.tsx": "route-tech-log-concept",
"/public/pages/question-page.tsx": "route-tech-log-question",
"/public/pages/topics-page.tsx": "route-tech-log-topics",
"/public/pages/topic-page.tsx": "route-tech-log-topic",
"/public/pages/topic-variant-page.tsx": "route-tech-log-topic-variant",
"/public/pages/projects-page.tsx": "route-tech-log-projects",