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', () => {
|
it('maps known classes to icons', () => {
|
||||||
expect(iconsForObject('Card')).toEqual(['mdi:cards-outline']);
|
expect(iconsForObject('Card')).toEqual(['mdi:cards-outline']);
|
||||||
expect(iconsForObject('Custom_Model_Bag')).toEqual([
|
expect(iconsForObject('Custom_Model_Bag')).toEqual([
|
||||||
'mdi:bag-personal-outline',
|
'file-icons:3d-model',
|
||||||
'mdi:cube-outline',
|
'material-symbols:folder',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,16 +8,29 @@ import './objectIconsData';
|
|||||||
const OBJECT_ICONS: Record<string, string[]> = {
|
const OBJECT_ICONS: Record<string, string[]> = {
|
||||||
Card: ['mdi:cards-outline'],
|
Card: ['mdi:cards-outline'],
|
||||||
Deck: ['mdi:cards'],
|
Deck: ['mdi:cards'],
|
||||||
|
DeckCustom: ['mdi:cards'],
|
||||||
Custom_Deck: ['mdi:cards'],
|
Custom_Deck: ['mdi:cards'],
|
||||||
Bag: ['mdi:bag-personal-outline'],
|
Bag: ['material-symbols:folder'],
|
||||||
Custom_Model_Bag: ['mdi:bag-personal-outline', 'mdi:cube-outline'],
|
Custom_Model_Bag: ['file-icons:3d-model', 'material-symbols:folder'],
|
||||||
Custom_Model: ['mdi:cube-outline'],
|
Custom_Model_Infinite_Bag: ['file-icons:3d-model','boxicons:infinite'],
|
||||||
|
Custom_Model: ['file-icons:3d-model'],
|
||||||
Custom_Token: ['mdi:circle-outline'],
|
Custom_Token: ['mdi:circle-outline'],
|
||||||
Custom_Image: ['mdi:image-outline'],
|
Custom_Image: ['mdi:image-outline'],
|
||||||
Custom_PDF: ['mdi:file-pdf-box'],
|
Custom_PDF: ['mdi:file-pdf-box'],
|
||||||
Dice: ['mdi:dice-6'],
|
Dice: ['mdi:dice-6'],
|
||||||
|
Custom_Dice: ['mdi:dice-6'],
|
||||||
Figurine: ['mdi:chess-knight'],
|
Figurine: ['mdi:chess-knight'],
|
||||||
Board: ['mdi:table-large'],
|
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'];
|
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. */
|
/** Resolve the icon name(s) for an object class. */
|
||||||
export function iconsForObject(name: string): string[] {
|
export function iconsForObject(name: string): string[] {
|
||||||
return OBJECT_ICONS[name] ?? FALLBACK;
|
return OBJECT_ICONS[name] ?? FALLBACK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export function DefaultViewer({ object }: { object: TTSObject }) {
|
|||||||
return (
|
return (
|
||||||
<div key={key} className="rounded-lg border border-zinc-800 bg-zinc-900 p-3">
|
<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>
|
<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' ? (
|
{typeof value === 'string' || typeof value === 'number' ? (
|
||||||
value
|
value
|
||||||
) : (
|
) : (
|
||||||
@@ -64,4 +64,4 @@ function safeStringify(value: unknown): string {
|
|||||||
},
|
},
|
||||||
2,
|
2,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user