This commit is contained in:
chriscrosstalk 2026-10-06 16:51:14 -07:00 committed by GitHub
commit 602354ad69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 5 deletions

View File

@ -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,

View File

@ -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' },

View File

@ -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} />

View File

@ -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,