fix: 「먼저 읽을 것」을 종류마다 한 편으로 줄이고 나머지도 같은 순서로 둔다
종류마다 두 편씩 담았더니 일곱 줄이 되어, 순서가 아니라 또 하나의 목록이 됐다. 이 자리가 답하는 것은 무엇이 있나가 아니라 어디서부터 읽나다. 아래 나머지 목록도 같은 순서를 따른다 — 한 화면에서 순서가 두 번 바뀌면 순서로 읽히지 않는다. 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
dc2fda7a5d
commit
db83228992
@@ -27,20 +27,30 @@ import { usePublicContent } from "../use-public-content.tsx";
|
||||
*/
|
||||
const READING_ORDER: ReadonlyArray<RecordKind> = ["CONCEPT", "CASE", "REFERENCE", "QUESTION"];
|
||||
|
||||
/** 한 종류에서 앞의 몇 편까지. 넘으면 순서가 아니라 목록이 된다. */
|
||||
const PER_KIND = 2;
|
||||
|
||||
/**
|
||||
* 종류마다 한 편씩. 둘씩 담아 봤더니 일곱 줄이 되어 순서가 아니라 또 하나의 목록이 됐다 —
|
||||
* 여기가 답하는 것은 「무엇이 있나」가 아니라 「어디서부터 읽나」다.
|
||||
*/
|
||||
function firstReads(records: ReadonlyArray<PublicRecord>) {
|
||||
return READING_ORDER.flatMap((kind) =>
|
||||
records
|
||||
.filter((record) => record.kind === kind)
|
||||
.slice(0, PER_KIND)
|
||||
.map((record) => ({
|
||||
label: DOCUMENT_KIND_LABELS[record.kind],
|
||||
title: record.title,
|
||||
path: record.path,
|
||||
summary: record.summary,
|
||||
})),
|
||||
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>) {
|
||||
return [...records].sort(
|
||||
(left, right) => READING_ORDER.indexOf(left.kind) - READING_ORDER.indexOf(right.kind),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -70,7 +80,7 @@ export function TopicPage() {
|
||||
const axisLabel = topic.variantLabel.trim() || "접근";
|
||||
const readingOrder = firstReads(records);
|
||||
const readingPaths = new Set(readingOrder.map((entry) => entry.path));
|
||||
const rest = records.filter((record) => !readingPaths.has(record.path));
|
||||
const rest = byReadingOrder(records.filter((record) => !readingPaths.has(record.path)));
|
||||
return (
|
||||
<main id="main-content" className="shell public-index-page topic-hub">
|
||||
<header className="public-page-header">
|
||||
|
||||
Reference in New Issue
Block a user