mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-10-16 21:00:03 +02:00
Merge 2964e3b6dc into 54ee30a449
This commit is contained in:
commit
602354ad69
|
|
@ -3,9 +3,8 @@
|
|||
* six across and six down.
|
||||
*
|
||||
* Every name here must exist in the `DynamicIcon` registry (`inertia/lib/icons.ts`).
|
||||
* `DynamicIcon` renders nothing at all for a name it does not know, so an icon
|
||||
* that is not in that registry produces a tile with a silent hole where its icon
|
||||
* should be. Shared by the picker and the server-side validator so the two can
|
||||
* `DynamicIcon` falls back to a generic box for a name it does not know, so an
|
||||
* icon that is not in that registry produces a tile with the wrong icon. Shared by the picker and the server-side validator so the two can
|
||||
* never disagree about what is selectable.
|
||||
*
|
||||
* Chosen for "a thing on my network": storage, media, documents, tooling,
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ const ICON_OPTIONS = [
|
|||
{ value: 'IconWorld', label: 'Web' },
|
||||
{ value: 'IconShieldLock', label: 'Security' },
|
||||
{ value: 'IconMovie', label: 'Media' },
|
||||
{ value: 'IconDeviceGamepad2', label: 'Gaming' },
|
||||
{ value: 'IconBook', label: 'Book' },
|
||||
{ value: 'IconNotes', label: 'Notes' },
|
||||
{ value: 'IconCpu', label: 'Compute' },
|
||||
|
|
|
|||
|
|
@ -13,11 +13,13 @@ interface DynamicIconProps {
|
|||
const DynamicIcon: React.FC<DynamicIconProps> = ({ icon, className, stroke, onClick }) => {
|
||||
if (!icon) return null
|
||||
|
||||
const Icon = icons[icon]
|
||||
let Icon = icons[icon]
|
||||
|
||||
// A name outside the registry can still arrive from data (e.g. a Custom App icon set
|
||||
// via the API). Show a generic box rather than an empty hole where the icon should be.
|
||||
if (!Icon) {
|
||||
console.warn(`Icon "${icon}" not found in icon map.`)
|
||||
return null
|
||||
Icon = icons.IconBox
|
||||
}
|
||||
|
||||
return <Icon className={classNames('h-5 w-5', className)} strokeWidth={stroke ?? 2} onClick={onClick} />
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import {
|
|||
IconCopy,
|
||||
IconCpu,
|
||||
IconDatabase,
|
||||
IconDeviceGamepad2,
|
||||
IconDownload,
|
||||
IconExternalLink,
|
||||
IconFileDescription,
|
||||
|
|
@ -97,6 +98,7 @@ export const icons = {
|
|||
IconCopy,
|
||||
IconCpu,
|
||||
IconDatabase,
|
||||
IconDeviceGamepad2,
|
||||
IconDownload,
|
||||
IconExternalLink,
|
||||
IconFileDescription,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user