feat(mira): wiki listing 加 Index Entries section(CC navigation 入口)
leo 反饋:原本只看到 wiki-page 列表沒看到 per-entity index-entry, 不知道 CC 從哪入口。新增 section 列出所有 type=index-entry blocks, 標題用 entity 名稱(剝 `index-` prefix),點進去看完整 markdown 摘要。 對應 design.md §3.5.12.4.2 雙層 outliner(v1.6): - 概覽層:index-entry markdown(含「段落 outline」/「涵蓋面向」等) - 完整 outliner:wiki page 自身(7B.3g 已實現的樹狀渲染) 部署:arcrun-landing.pages.dev(手動 wrangler pages deploy)。
This commit is contained in:
@@ -28,6 +28,7 @@ export default function WikiIndexPage() {
|
||||
const [indexChildren, setIndexChildren] = useState<Block[]>([]);
|
||||
const [logEntries, setLogEntries] = useState<Block[]>([]);
|
||||
const [otherWikiPages, setOtherWikiPages] = useState<Block[]>([]);
|
||||
const [indexEntries, setIndexEntries] = useState<Block[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
@@ -95,6 +96,22 @@ export default function WikiIndexPage() {
|
||||
.filter((b) => !hasAnyInfraSubtype(b) && !hasMetaTag(b))
|
||||
.sort((a, b) => (b.created_at ?? 0) - (a.created_at ?? 0)),
|
||||
);
|
||||
|
||||
// 平行撈 index-entry blocks(per-entity 摘要,CC navigation entry point)
|
||||
// 對應 design.md §3.5.12.4.1 / 7B.3f
|
||||
const idxRes = await fetch(
|
||||
`${KBDB_BASE}/blocks?type=index-entry&limit=200`,
|
||||
{ headers },
|
||||
);
|
||||
if (idxRes.ok) {
|
||||
const idxData = await idxRes.json();
|
||||
if (!cancelled) {
|
||||
const idxBlocks: Block[] = idxData.blocks ?? [];
|
||||
setIndexEntries(
|
||||
idxBlocks.sort((a, b) => (a.page_name ?? '').localeCompare(b.page_name ?? '')),
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e: any) {
|
||||
if (!cancelled) setError(e?.message ?? 'load failed');
|
||||
} finally {
|
||||
@@ -163,6 +180,29 @@ export default function WikiIndexPage() {
|
||||
)}
|
||||
</Section>
|
||||
|
||||
<Section title={`🧭 Index Entries(${indexEntries.length})— CC 看的 entity 摘要`}>
|
||||
{indexEntries.length > 0 ? (
|
||||
<div style={{ display: 'grid', gap: 8 }}>
|
||||
{indexEntries.map((b) => {
|
||||
const entity = (b.page_name ?? '').replace(/^index-/, '');
|
||||
const firstLine = firstLineOf(b.content)
|
||||
.replace(/^#+\s*/, '')
|
||||
.slice(0, 80);
|
||||
return (
|
||||
<WikiCardLink
|
||||
key={b.id}
|
||||
page_name={b.page_name ?? ''}
|
||||
title={entity}
|
||||
excerpt={firstLine || `index for ${entity}`}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<Empty>尚未有 index-entry(wiki_synthesis 跑完後自動建)</Empty>
|
||||
)}
|
||||
</Section>
|
||||
|
||||
<Section title="📜 Log(每月一筆)">
|
||||
{logEntries.length > 0 ? (
|
||||
<div style={{ display: 'grid', gap: 8 }}>
|
||||
|
||||
Reference in New Issue
Block a user