/** * Icon lookup for registry-driven UI. * * PHP-side registries name their icon as a string (see Module::icon() and the * `aureon_admin_sections` section descriptors) because a plugin or child theme * can't hand a React component across the boundary. This maps those names to * components. * * Imports stay explicit — a barrel `import * as Lucide` would pull the whole * icon set into the admin bundle. Anything unknown falls back to a generic grid * glyph, so an unrecognized name never breaks a card or a nav entry. * * Most entries are Lucide line icons; a few are brand marks from * `brand-icons.tsx`, which are fixed multi-colour logos rather than tintable * glyphs. Both answer to ``, which is all a caller needs, but * a surface drawing a brand mark wants a plain tile rather than the bordered, * tinted one a line icon sits in — see `iconStyle` on a `group` descriptor. */ import { LayoutGrid, Moon, LoaderCircle, ArrowUpToLine, Heart, UserRound, UserPlus, KeyRound, Wrench, Code, ArrowDownUp, LogIn, ShieldCheck, Link, Globe, Users, Lightbulb, FileText, LogOut, RotateCcw, Trash2, PanelLeft, ListChecks, Settings, Palette, Mail, } from './icons'; import type { ComponentType } from 'react'; import { GoogleMark, FacebookMark } from './brand-icons'; /** * What every entry here has in common, and all any caller asks of one. Wider * than `LucideIcon` so the brand marks fit too — they take a `size` and nothing * else, having no strokes to weight. */ export type PanelIcon = ComponentType< { // Loose like Lucide's own props, which accept either — a narrower type here // would reject every Lucide component this map is mostly made of. size?: string | number; strokeWidth?: string | number; } >; const ICONS: Record< string, PanelIcon > = { LayoutGrid, Moon, LoaderCircle, ArrowUpToLine, Heart, UserRound, UserPlus, KeyRound, Wrench, Code, ArrowDownUp, LogIn, ShieldCheck, Link, Globe, Users, Lightbulb, FileText, LogOut, RotateCcw, Trash2, PanelLeft, ListChecks, Settings, Palette, Mail, GoogleMark, FacebookMark, }; export default function moduleIcon( name?: string ): PanelIcon { return ( name && ICONS[ name ] ) || LayoutGrid; }