From 9619cc38631210078cb703f9451b5ead9a42eeb2 Mon Sep 17 00:00:00 2001 From: hypercross Date: Sat, 8 Aug 2026 12:45:40 +0800 Subject: [PATCH] feat(web): expand object class icon mapping Map more TTS classes to icons, including multi-set icons for models and bags, and add a wrap-break-word class fix in the default viewer. --- apps/web/src/components/objectIcons.test.ts | 4 ++-- apps/web/src/components/objectIcons.tsx | 21 +++++++++++++++++---- apps/web/src/components/viewers.tsx | 4 ++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/apps/web/src/components/objectIcons.test.ts b/apps/web/src/components/objectIcons.test.ts index 17c3ee7..db24b7f 100644 --- a/apps/web/src/components/objectIcons.test.ts +++ b/apps/web/src/components/objectIcons.test.ts @@ -5,8 +5,8 @@ describe('iconsForObject', () => { it('maps known classes to icons', () => { expect(iconsForObject('Card')).toEqual(['mdi:cards-outline']); expect(iconsForObject('Custom_Model_Bag')).toEqual([ - 'mdi:bag-personal-outline', - 'mdi:cube-outline', + 'file-icons:3d-model', + 'material-symbols:folder', ]); }); diff --git a/apps/web/src/components/objectIcons.tsx b/apps/web/src/components/objectIcons.tsx index 7b7624a..a72189c 100644 --- a/apps/web/src/components/objectIcons.tsx +++ b/apps/web/src/components/objectIcons.tsx @@ -8,16 +8,29 @@ import './objectIconsData'; const OBJECT_ICONS: Record = { Card: ['mdi:cards-outline'], Deck: ['mdi:cards'], + DeckCustom: ['mdi:cards'], Custom_Deck: ['mdi:cards'], - Bag: ['mdi:bag-personal-outline'], - Custom_Model_Bag: ['mdi:bag-personal-outline', 'mdi:cube-outline'], - Custom_Model: ['mdi:cube-outline'], + Bag: ['material-symbols:folder'], + Custom_Model_Bag: ['file-icons:3d-model', 'material-symbols:folder'], + Custom_Model_Infinite_Bag: ['file-icons:3d-model','boxicons:infinite'], + Custom_Model: ['file-icons:3d-model'], Custom_Token: ['mdi:circle-outline'], Custom_Image: ['mdi:image-outline'], Custom_PDF: ['mdi:file-pdf-box'], Dice: ['mdi:dice-6'], + Custom_Dice: ['mdi:dice-6'], Figurine: ['mdi:chess-knight'], Board: ['mdi:table-large'], + HandTrigger: ['mdi:hand'], + BlockSquare: ['bitcoin-icons:block-filled'], + Custom_Assetbundle: ['mynaui:package-solid'], + + Tile: ['picon:tile'], + Custom_Tile: ['picon:tile'], + + Infinite_Bag: ['boxicons:infinite'], + + Bowl: ['tabler:bowl-filled'] }; const FALLBACK = ['mdi:help-circle-outline']; @@ -25,4 +38,4 @@ const FALLBACK = ['mdi:help-circle-outline']; /** Resolve the icon name(s) for an object class. */ export function iconsForObject(name: string): string[] { return OBJECT_ICONS[name] ?? FALLBACK; -} \ No newline at end of file +} diff --git a/apps/web/src/components/viewers.tsx b/apps/web/src/components/viewers.tsx index 5329377..ccac7ca 100644 --- a/apps/web/src/components/viewers.tsx +++ b/apps/web/src/components/viewers.tsx @@ -34,7 +34,7 @@ export function DefaultViewer({ object }: { object: TTSObject }) { return (
{key}
-
+
{typeof value === 'string' || typeof value === 'number' ? ( value ) : ( @@ -64,4 +64,4 @@ function safeStringify(value: unknown): string { }, 2, ); -} \ No newline at end of file +}