feat: 축에 자기 화면을 준다

주제 화면의 네 줄(SPA·Mediator·BFF·Forward-Auth)은 링크인데 눌러도 아무 일이 없었다.
축의 주소를 주제 화면 안의 앵커로 잡아 두어서, 정작 주제 화면에서는 그 링크가 자기 자신을
가리켰다 — 주소만 바뀌고 화면은 그대로였다.

축에 화면을 준다. 결론을 먼저 두고 그 아래 그 축에 걸린 기록만 모은다. 목록 조회에
`variant` 필터를 더해 `record_variant` 로 거른다 — 축 slug 는 주제 안에서만 유일하므로
주제까지 함께 맞춘다.

정적 어댑터는 축으로 거르면 빈 목록을 준다. 축은 사람이 Studio 에서 거는 값이라 픽스처가
지어낼 수 없고, 없는 것을 있는 척하면 이 어댑터로 그린 화면이 서버로 바꿨을 때 달라진다.

`RecordFilters` 가 포트와 정적 어댑터에 따로 있어, 포트에 필터가 늘어도 이쪽은 모르는
상태가 됐다 — 메서드 매개변수가 bivariant 라 `satisfies` 가 잡지 못한다. 하나로 합친다.

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-01 20:36:53 +09:00
co-authored by Claude Opus 5
parent 344dadb17a
commit 67a549173d
20 changed files with 161 additions and 26 deletions
+1
View File
@@ -5,6 +5,7 @@ export type RouteCodecId =
| "ReferenceResourceListQuery"
| "TechLogExploreKindParams"
| "TechLogSlugParams"
| "TechLogTopicVariantParams"
| "TechLogVersionParams"
| "TechLogDocumentIdParams"
| "TechLogPublicationEventIdParams"
@@ -141,6 +141,7 @@ export function createHttpPublicContentGateway(
const wantsKnowledge = !filters.kind || filters.kind !== "QUESTION";
const query = {
...(filters.topic ? { topic: filters.topic } : {}),
...(filters.variant ? { variant: filters.variant } : {}),
...(filters.project ? { project: filters.project } : {}),
};
const [knowledge, questions] = await Promise.all([
@@ -15,14 +15,14 @@ import type {
PublicContentQueries,
PublicTopic,
PublicTopicDetail,
RecordFilters,
} from "../../application/ports/public-content-queries.ts";
export type RecordFilters = {
kind?: RecordKind;
topic?: string;
project?: string;
openQuestionsOnly?: boolean;
};
/*
포트의 것을 그대로 쓴다. 여기 따로 적어 두었더니 포트에 필터가 하나 늘 때 이쪽만 모르는
상태가 됐고, `satisfies` 는 메서드 매개변수가 bivariant 라 그것을 잡지 못했다.
*/
export type { RecordFilters };
export type SearchablePublicEntity = {
contentType: RecordKind | "PROJECT" | "RELEASE";
@@ -62,6 +62,12 @@ export function listRecords(filters: RecordFilters = {}): PublicRecord[] {
.toLocaleLowerCase("ko-KR");
return publicRecords
/*
정적 자료에는 축이 없다 — 사람이 Studio 에서 거는 값이라 픽스처가 지어낼 수 없다. 축으로
걸러 달라는 요청은 아무것도 고르지 않는 것으로 답한다. 없는 것을 있는 척하면 이 어댑터로
그린 화면이 서버로 바꿨을 때 달라진다.
*/
.filter(() => !filters.variant)
.filter((record) => !filters.kind || record.kind === filters.kind)
.filter(
(record) =>
@@ -267,6 +267,8 @@ export type HomeFocusItem = {
export type RecordFilters = {
kind?: RecordKind;
topic?: string;
/** 주제 안의 축. 주제 안에서만 유일하므로 `topic` 과 함께 준다. */
variant?: string;
project?: string;
openQuestionsOnly?: boolean;
};
@@ -2,7 +2,7 @@
"packageId": "@tech-log/management-contract",
"version": "1.0.0",
"digest": "sha256:61f8360cfb2e638c5d8c5557434b564e39cea517464c33cedcd1c5bf39a58aa8",
"sourceRevision": "a58ad30",
"sourceRevision": "b93d62a",
"operationIds": [
"createCaseDraft",
"getCaseForEdit",
@@ -1,8 +1,8 @@
{
"packageId": "@tech-log/public-contract",
"version": "2.1.0",
"digest": "sha256:a964914040740a1223c33b5aeaf7724a8a0c78d91063bf3f1b7d7594c314a395",
"sourceRevision": "a58ad30",
"digest": "sha256:10b922715a4149f2dcf4d5925fb1d3e3e820a6d14d9e4a91d7a325027684280d",
"sourceRevision": "b93d62a",
"operationIds": [
"getPublicSite",
"getPublicHome",
@@ -564,8 +564,9 @@ export interface components {
TopicVariantSummary: {
slug: string;
title: string;
/** @description 이 축이 주제 화면에서 사는 자리(`/topics/{주제}#{축}`). 축은 주제 화면 안의 한 줄이지
* 따로 선 화면이 아니다 — 자기 화면을 갖게 되면 그때 이 값이 바뀐다.
/** @description 이 축의 공개 주소(`/topics/{주제}/{축}`). 그 축에 걸린 기록만 모아 보여 준다.
* 한동안 주제 화면 안의 앵커였는데, 주제 화면에서는 그 링크가 자기 자신을 가리켜
* 눌러도 아무 일이 없었다.
* */
path: string;
summary?: string;
@@ -1108,6 +1109,10 @@ export interface operations {
query?: {
type?: "CASE" | "REFERENCE" | "CONCEPT";
topic?: string;
/** @description 주제 안의 축 slug. 그 축에 걸린 기록만 남긴다. `topic` 과 함께 준다 — 축 slug 는
* 주제 안에서만 유일하다.
* */
variant?: string;
project?: string;
tag?: string;
year?: number;
@@ -1155,6 +1160,10 @@ export interface operations {
query?: {
status?: "OPEN" | "INVESTIGATING" | "PAUSED" | "RESOLVED";
topic?: string;
/** @description 주제 안의 축 slug. 그 축에 걸린 기록만 남긴다. `topic` 과 함께 준다 — 축 slug 는
* 주제 안에서만 유일하다.
* */
variant?: string;
project?: string;
tag?: string;
sort?: "UPDATED_DESC" | "OPENED_DESC" | "RESOLVED_DESC";
@@ -119,6 +119,13 @@ paths:
in: query
schema:
type: string
- name: variant
in: query
description: |
주제 안의 축 slug. 그 축에 걸린 기록만 남긴다. `topic` 과 함께 준다 — 축 slug 는
주제 안에서만 유일하다.
schema:
type: string
- name: project
in: query
schema:
@@ -200,6 +207,13 @@ paths:
in: query
schema:
type: string
- name: variant
in: query
description: |
주제 안의 축 slug. 그 축에 걸린 기록만 남긴다. `topic` 과 함께 준다 — 축 slug 는
주제 안에서만 유일하다.
schema:
type: string
- name: project
in: query
schema:
@@ -1291,8 +1305,9 @@ components:
path:
type: string
description: |
이 축이 주제 화면에서 사는 자리(`/topics/{주제}#{축}`). 축은 주제 화면 안의 한 줄이지
따로 선 화면이 아니다 — 자기 화면을 갖게 되면 그때 이 값이 바뀐다.
이 축의 공개 주소(`/topics/{주제}/{축}`). 그 축에 걸린 기록만 모아 보여 준다.
한동안 주제 화면 안의 앵커였는데, 주제 화면에서는 그 링크가 자기 자신을 가리켜
눌러도 아무 일이 없었다.
summary:
type: string
conclusion:
@@ -2,7 +2,7 @@
"packageId": "@tech-log/studio-contract",
"version": "3.1.0",
"digest": "sha256:d2bfbe0a12136f131ccb8c42f8868108ba8d0f0182b347f9b815316c343a970c",
"sourceRevision": "a58ad30",
"sourceRevision": "b93d62a",
"operationIds": [
"getStudioSession",
"getStudioDashboard",
@@ -98,6 +98,7 @@ const HTTP_CONTRACTS = Object.freeze([
const value = input as unknown as Readonly<{
type?: string;
topic?: string;
variant?: string;
project?: string;
page?: number;
size?: number;
@@ -108,6 +109,7 @@ const HTTP_CONTRACTS = Object.freeze([
const value = input as unknown as Readonly<{
status?: string;
topic?: string;
variant?: string;
project?: string;
page?: number;
size?: number;
@@ -30,6 +30,7 @@ const TECH_LOG_ROUTE_SPECS = [
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_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 }),
defineSpec({ routeId: "TECH_LOG_PROJECT", path: "/projects/:slug", layoutGroup: "PUBLIC", paramsSchema: "TechLogSlugParams", searchSchema: null, title: "프로젝트", navigationLabel: null, navigationOrder: null }),
defineSpec({ routeId: "TECH_LOG_PROJECT_RECORDS", path: "/projects/:slug/records", layoutGroup: "PUBLIC", paramsSchema: "TechLogSlugParams", searchSchema: null, title: "프로젝트 기록", navigationLabel: null, navigationOrder: null }),
@@ -111,11 +111,7 @@ export function TopicPage() {
</p>
<ul>
{topic.variants.map((variant) => (
/*
축의 주소(`/topics/{주제}#{축}`)가 실제로 가리키는 자리다. 다른 화면에서 이
축을 걸면 여기로 온다 — 앵커가 없으면 그 링크는 주제 화면 맨 위에 떨어진다.
*/
<li key={variant.slug} id={variant.slug}>
<li key={variant.slug}>
<a href={variant.path}>
<strong>{variant.title}</strong>
{/*
@@ -0,0 +1,82 @@
import { Link } from "react-router-dom";
import type { PublicRecord } from "../../../application/ports/public-content-queries.ts";
import {
RegisteredNotFoundRoute,
useRouteInput,
} from "../../../../../presentation/routes/route-input.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";
/** 나열 순서. 주제 화면과 같다 — 원리 → 확인한 기록 → 기준 → 아직 모르는 것. */
const READING_ORDER: ReadonlyArray<PublicRecord["kind"]> = [
"CONCEPT",
"CASE",
"REFERENCE",
"QUESTION",
];
/**
* 주제 안의 축 하나.
*
* <p>축은 한동안 주소가 주제 화면 안의 앵커였다. 그래서 주제 화면에서는 그 링크가 자기 자신을
* 가리켰고, 눌러도 아무 일이 없었다 — 주소는 바뀌는데 화면은 그대로였다.
*
* <p>이 화면이 답하는 것은 「이 접근에서 무엇을 알게 됐고, 그 근거가 어디 있나」다. 결론을 먼저
* 두고 그 아래 그 축에 걸린 기록만 모은다.
*/
export function TopicVariantPage() {
const { params } = useRouteInput<"TECH_LOG_TOPIC_VARIANT">();
const topicSlug = typeof params.slug === "string" ? params.slug : "";
const variantSlug = typeof params.variant === "string" ? params.variant : "";
const view = usePublicContent(
["tech-log", "topic", topicSlug, "variant", variantSlug],
async (queries) => ({
topic: await queries.getTopicDetail(topicSlug),
records: await queries.listRecords({ topic: topicSlug, variant: variantSlug }),
}),
);
if (!view.ready) return view.fallback;
const { topic, records } = view.data;
const variant = topic?.variants.find((entry) => entry.slug === variantSlug);
if (!topic || !variant) return <RegisteredNotFoundRoute />;
const axisLabel = topic.variantLabel.trim() || "접근";
const ordered = [...records].sort(
(left, right) => READING_ORDER.indexOf(left.kind) - READING_ORDER.indexOf(right.kind),
);
return (
<main id="main-content" className="shell public-index-page topic-hub">
<header className="public-page-header">
<nav aria-label="문서 경로">
<Link to="/explore">탐색</Link>
<span aria-hidden="true">/</span>
<Link to={`/topics/${topic.slug}`}>{topic.name}</Link>
</nav>
<p className="section-kicker">{axisLabel}</p>
<h1>{variant.title}</h1>
{/*
결론이 이 축의 값어치다. 요약은 이것이 무엇인가만 말하므로, 결론이 있으면 그쪽을 먼저
보이고 요약은 그 아래 한 줄로 남긴다.
*/}
<ProseText text={variant.conclusion || variant.summary} />
</header>
{variant.conclusion && variant.summary ? (
<p className="topic-variants-note">{variant.summary}</p>
) : null}
<div className="public-result-heading">
<h2>{`이 ${axisLabel}의 기록`}</h2>
<p>{`${ordered.length}개`}</p>
</div>
<PublicRecordList
records={ordered}
emptyMessage={`아직 이 ${axisLabel}에 걸린 기록이 없습니다.`}
/>
</main>
);
}
@@ -18,6 +18,10 @@ const nonEmptyParams = <Key extends string>(key: Key) =>
export const TECH_LOG_ROUTE_CODECS = Object.freeze({
TechLogExploreKindParams: nonEmptyParams("kind"),
TechLogSlugParams: nonEmptyParams("slug"),
/* 축은 주제 안에서만 유일하다 — 주소도 주제를 앞에 달고 다닌다. */
TechLogTopicVariantParams: z
.object({ slug: z.string().min(1), variant: z.string().min(1) })
.strict(),
TechLogVersionParams: nonEmptyParams("version"),
TechLogDocumentIdParams: nonEmptyParams("id"),
TechLogPublicationEventIdParams: nonEmptyParams("publicationEventId"),
@@ -86,6 +86,13 @@ export const TECH_LOG_ROUTE_RUNTIME = Object.freeze({
"TECH_LOG_TOPIC",
routeModule(() => import("./public/pages/topic-page.tsx"), "TopicPage"),
),
TECH_LOG_TOPIC_VARIANT: runtime(
"TECH_LOG_TOPIC_VARIANT",
routeModule(
() => import("./public/pages/topic-variant-page.tsx"),
"TopicVariantPage",
),
),
TECH_LOG_PROJECTS: runtime(
"TECH_LOG_PROJECTS",
routeModule(