fix(mira): [pageName] h1 顯示 entity 名 + listing dedupe by entity
兩個 leo 反饋的 UI bug: 1. wiki/[pageName] 對 index-entry 渲染時,h1 用 block.content(整篇 markdown) 會把整個內容塞進 h1。改:wiki-page 用 content 當 entity 名;其他類型 (index-entry/schema/log)用 page_name 剝 `wiki-` / `index-` prefix。 2. listing「Wiki Pages (21)」累積式設計造成同 entity 多版顯示為多張卡,雜亂。 改:用 useMemo dedupe by entity(content)— 每 entity 一張卡顯示最新版, 標題顯示「N 版累積」當 N>1。原始 21 筆 → 現在約 6-7 個 unique entity。
This commit is contained in:
@@ -141,8 +141,12 @@ export default function WikiPagePage({
|
||||
return Array.from(groups.entries()).map(([facet, paragraphs]) => ({ facet, paragraphs }));
|
||||
}, [paragraphs, triplets]);
|
||||
|
||||
const entity = block?.content?.trim() || decodedName.replace(/^wiki-/, '');
|
||||
const isWikiPage = block?.type === 'wiki-page';
|
||||
// 標題:wiki-page 用 content(entity 名稱),其他(index-entry/schema/log/...)用 page_name 剝 prefix
|
||||
// 修 bug:原本一律用 block.content,但 index-entry 的 content 是整篇 markdown,會把整個 content render 成 h1
|
||||
const entity = isWikiPage
|
||||
? (block?.content?.trim() || decodedName.replace(/^wiki-/, ''))
|
||||
: decodedName.replace(/^(wiki|index)-/, '');
|
||||
|
||||
function toggleCollapse(key: string) {
|
||||
setCollapsed((c) => ({ ...c, [key]: !c[key] }));
|
||||
|
||||
Reference in New Issue
Block a user