fix: 관계 목록이 사람이 읽는 이름과 요약을 보여 준다

Reference 화면에 `supportingCases` 가 한글 라벨 없이 네 번 반복해서 나왔다.
라벨 표의 키가 계약이 실제로 주는 이름과 어긋나 있었기 때문이다 —
`originCases`·`projectDecisions` 로 적혀 있었고 계약은 `supportingCases`·
`relatedDecisions` 를 준다. 표에 없는 키는 그대로 화면에 나온다.

Question 은 같은 결함을 이미 겪고 고친 자리다(주석에 남아 있다). 이번에는
표를 상수로 빼서 계약이 주는 이름 전부가 등록됐는지 확인할 수 있게 한다.

계약은 관계마다 요약도 함께 주는데 평탄화가 그것을 버렸다. 독자가 목록에서
보는 것이 제목뿐이라, 왜 이 기록이 걸려 있는지는 눌러 봐야 알 수 있었다.
요약을 흘려보내 제목 아래 두 줄로 보여 준다.

요약은 링크의 이름에서 뺀다 — 이름에 들어가면 관계 목록을 훑을 때 링크
하나하나가 문단이 되어 목록으로서 쓸모가 없어진다.

`cardSummary` 를 domain 으로 옮긴다. 어댑터가 presentation 을 import 하는
것을 아키텍처 규칙이 막았고, 그 지적이 옳다 — 이 함수는 화면이 아니라
글을 다루는 규칙이다.

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-08-31 11:04:42 +09:00
co-authored by Claude Opus 5
parent 6429aee74e
commit 642afa878c
13 changed files with 89 additions and 28 deletions
@@ -9,7 +9,7 @@ import {
moveFocus,
shouldNormalizeFocusUrl,
} from "../../../domain/public/focus-state.ts";
import { cardSummary } from "../../shared/card-summary.ts";
import { cardSummary } from "../../../domain/content-format/card-summary.ts";
type HomeFocusProps = {
items: ReadonlyArray<HomeFocusItem>;
@@ -1,5 +1,5 @@
import { Link } from "react-router-dom";
import { cardSummary } from "../../shared/card-summary.ts";
import { cardSummary } from "../../../domain/content-format/card-summary.ts";
export type LatestEntry = {
id: string;
@@ -2,7 +2,7 @@ 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 { cardSummary } from "../../shared/card-summary.ts";
import { cardSummary } from "../../../domain/content-format/card-summary.ts";
export function PublicRecordList({
records,
@@ -3,7 +3,7 @@ import { Link } from "react-router-dom";
import { usePublicContent } from "../use-public-content.tsx";
import { HighlightMatch } from "../../shared/highlight-match.tsx";
import { cardSummary } from "../../shared/card-summary.ts";
import { cardSummary } from "../../../domain/content-format/card-summary.ts";
type SearchDialogProps = {
className?: string;
@@ -1,15 +0,0 @@
/**
* 목록·검색 카드에 실을 요약을 평문으로 만든다.
*
* <p>카드는 본문 요약을 그대로 가져다 세 줄로 자른다. 그 요약은 Markdown 으로 쓰였으므로
* 작성자가 코드 표시로 쓴 백틱이 카드에도 그대로 나왔다 — 문서 본문에서는 `<code>` 가 되지만
* 카드에서는 그냥 문자다. 홈·탐색·검색이 같은 텍스트를 쓰므로 세 곳에서 같이 보였다.
*
* <p>카드에서 코드 스타일을 살리지 않는 이유는 카드가 훑어보는 자리이기 때문이다. 한 줄 안에
* 배경색 조각이 여럿 끼면 제목보다 그쪽이 먼저 눈에 든다. 문단 줄바꿈도 공백으로 접는다 —
* 어차피 세 줄에서 잘리므로 줄을 지켜 봐야 잘리는 위치만 어긋난다.
*/
export function cardSummary(text: string | null | undefined): string {
if (!text) return "";
return text.replace(/`/gu, "").replace(/\s+/gu, " ").trim();
}
@@ -1,9 +1,12 @@
import { Link } from "react-router-dom";
export type PublicRelation = Readonly<{
/** 왜 걸려 있는지 — 관계 묶음의 사람이 읽는 이름. */
reason: string;
title: string;
path: string;
/** 대상 문서의 요약. 눌러 보지 않고도 무엇인지 알게 한다. */
summary?: string;
}>;
export function PublicDocumentRelations({
@@ -26,7 +29,19 @@ export function PublicDocumentRelations({
<li key={relation.path}>
<Link to={relation.path}>
<span>{relation.reason}</span>
<strong>{relation.title}</strong>
<div>
<strong>{relation.title}</strong>
{/*
계약은 관계마다 요약을 함께 준다. 예전에는 그것을 버려서 목록에 제목만 남았고,
독자는 왜 이 기록이 걸려 있는지 눌러 봐야 알 수 있었다.
*/}
{/*
링크의 이름은 「관계 이름 + 제목」으로 둔다. 요약까지 이름에 들어가면 관계
목록을 훑을 때 링크 하나하나가 문단이 되어 목록으로서 쓸모가 없어진다.
요약은 눈으로 보는 보조 정보이고, 전문은 눌러 들어가면 있다.
*/}
{relation.summary ? <p aria-hidden="true">{relation.summary}</p> : null}
</div>
<span aria-hidden="true">↗</span>
</Link>
</li>
@@ -2503,6 +2503,9 @@ dialog::backdrop {
.document-relations ul { margin: 30px 0 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.document-relations li { border-bottom: 1px solid var(--line); }
.document-relations a { display: grid; min-height: 76px; grid-template-columns: 150px 1fr auto; gap: 18px; align-items: center; }
/* 관계 대상의 요약. 제목 아래 한 줄로, 목록을 훑는 흐름을 끊지 않게 옅게 자른다. */
.document-relations a > div { min-width: 0; }
.document-relations a p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.document-relations a > span:first-child { color: var(--faint); font-size: 11px; }
.document-relations strong { font-size: 14px; font-weight: 600; }
.document-relations a:hover strong { color: var(--signal); }