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.
This commit is contained in:
@@ -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',
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -8,16 +8,29 @@ import './objectIconsData';
|
||||
const OBJECT_ICONS: Record<string, string[]> = {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export function DefaultViewer({ object }: { object: TTSObject }) {
|
||||
return (
|
||||
<div key={key} className="rounded-lg border border-zinc-800 bg-zinc-900 p-3">
|
||||
<dt className="font-mono text-xs uppercase text-zinc-500">{key}</dt>
|
||||
<dd className="mt-1 break-words text-zinc-200">
|
||||
<dd className="mt-1 wrap-break-words text-zinc-200">
|
||||
{typeof value === 'string' || typeof value === 'number' ? (
|
||||
value
|
||||
) : (
|
||||
@@ -64,4 +64,4 @@ function safeStringify(value: unknown): string {
|
||||
},
|
||||
2,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user