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:
co-authored by
Claude Opus 5
parent
69eabc7d6c
commit
aca4f189d1
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user