forked from ChaiHao/BPOS-MVP
知识库补图标 —— 顺带堵掉「图标名写错静默留白」这个洞
左轨那一格是空的:ZONES 给知识库写的 `library` 在 Ico 字典里根本没有,
而 Ico 查不到名字时返回一个**空 svg** —— 图标掉了不报错、不留痕,
八格有图标一格没有,看上去像布局塌了。是用户指出来才发现的。
三件事:
· 补 library 字形(书脊排在架上,与运营侧知识库的 layers 明显不同形)
· 查无此名时画一枚虚线空框(字体界的「豆腐块」),不画空气 —— 缺图标得看得见
· 导出 hasIco,加一条测试逐格对 ZONES / ZM / TABS 的图标名,
并自证查名管用(不在册的要答不在,否则前三条是空转)
全库 92 个手写图标名扫过一遍,现在零缺
顺手改掉知识库占位卡的语气:原来用 Clear(绿对勾),读着像给「还没建」打了勾;
换成中性 Note + 三行未建清单。
四闸绿(api:check 未动契约)。
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// 共享内联 lucide 图标(会话面板 / 工作区驾驶舱 / 设置等共用)。
|
||||
export function Ico({ name, s = 18 }: { name: string; s?: number }) {
|
||||
const p: Record<string, React.ReactNode> = {
|
||||
const GLYPHS: Record<string, React.ReactNode> = {
|
||||
"chevron-right": (<path d="m9 18 6-6-6-6" />),
|
||||
"chevron-down": (<path d="m6 9 6 6 6-6" />),
|
||||
check: (<path d="M20 6 9 17l-5-5" />),
|
||||
@@ -125,11 +124,31 @@ export function Ico({ name, s = 18 }: { name: string; s?: number }) {
|
||||
"redo-2": (<><path d="m15 14 5-5-5-5" /><path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13" /></>),
|
||||
"maximize-2": (<><polyline points="15 3 21 3 21 9" /><polyline points="9 21 3 21 3 15" /><line x1="21" x2="14" y1="3" y2="10" /><line x1="3" x2="10" y1="21" y2="14" /></>),
|
||||
x: (<><path d="M18 6 6 18" /><path d="m6 6 12 12" /></>),
|
||||
library: (<><path d="m16 6 4 14" /><path d="M12 6v14" /><path d="M8 8v12" /><path d="M4 4v16" /></>),
|
||||
"log-out": (<><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /><polyline points="16 17 21 12 16 7" /><line x1="21" x2="9" y1="12" y2="12" /></>),
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 名字在不在册 —— 给守闸的测试用。
|
||||
* 导航表里写错一个名字,从前只会在界面上留一格**看不见的空白**(知识库那格就这么空了一版);
|
||||
* 现在有测试逐个对表,写错当场红。
|
||||
*/
|
||||
export function hasIco(name: string): boolean {
|
||||
return Object.hasOwn(GLYPHS, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查无此名时画一枚**虚线空框**(字体界的「豆腐块」),不画空气 ——
|
||||
* 缺图标得看得见才修得掉。
|
||||
*/
|
||||
const MISSING = (
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" strokeDasharray="3 3" opacity="0.55" />
|
||||
);
|
||||
|
||||
export function Ico({ name, s = 18 }: { name: string; s?: number }) {
|
||||
return (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
||||
{p[name]}
|
||||
{GLYPHS[name] ?? MISSING}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
export type { ViewContainerProps } from './ViewContainer.tsx';
|
||||
export { ViewContainer } from './ViewContainer.tsx';
|
||||
export { ViewBlocks } from './ViewBlocks.tsx';
|
||||
export { Ico } from './Ico.tsx';
|
||||
export { Ico, hasIco } from './Ico.tsx';
|
||||
|
||||
export const UI_KIT_VERSION = '0.1.0-m6';
|
||||
|
||||
Reference in New Issue
Block a user