Files
co-lite/solvway-admin-portal/app/components/app/icon-map.ts
T
ngqileandClaude Opus 5.5 bb2c5c5db7 feat(portal): landing pages list, editor, preview and public page
Pages list and Tiptap editor (ported from babyboo) with image upload on
save, the FORM event picker, field errors at their fields, delete
confirmation, unsaved-edits guard and a draft preview. The public page
/p/<company>/<slug> renders on the server with metadata, sanitize-html,
the company's logo and accent, and the sign-up form with UTM tags.
Companies get branding; the event lead detail shows the web page and
campaign. Labels in English and Chinese.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-02 16:30:54 +08:00

44 lines
1.8 KiB
TypeScript

import { CalendarDays, Circle, ClipboardList, Globe, Languages, LayoutDashboard, LockKeyhole, Mail, MessageCircle, PanelsTopLeft, ScrollText, Shield, ShieldCheck, Store, Tags, UserCog, Users } from "lucide-react";
import type { LucideIcon } from "lucide-react";
// Maps the aclMenu tree's `iconName` (a plain string served by
// solvway-services-system — see AdminModule.iconName) to a lucide-react icon
// component. A curated map, not `import * as Icons from "lucide-react"`: the
// old src/components/app/nav-config.ts imported icon components directly, and
// pulling in the whole icon set here would ship every lucide icon to the
// browser for a handful of nav entries. Add an entry when a module is seeded
// with a new iconName value.
const ICONS: Record<string, LucideIcon> = {
// Icons Co-Lite seeds (local/seed/03-colite.sql and the archived change SQL), plus Companies (Store)
// and Login security (LockKeyhole, a sidebar override).
LayoutDashboard,
CalendarDays,
ClipboardList,
Tags,
Users,
UserCog,
ShieldCheck,
Shield,
LockKeyhole,
Mail,
ScrollText,
Store,
MessageCircle,
Languages,
Globe,
PanelsTopLeft,
};
/** Neutral fallback for an absent or unrecognised `iconName` (spec: "The
* Sidebar Renders Lucide Icons From icon_name" — unmapped names MUST render
* a safe fallback, not throw). A plain circle, distinct from every seeded
* icon, so a nav entry never renders with no icon at all. */
const FALLBACK_ICON: LucideIcon = Circle;
/** Looks up the icon for an aclMenu node's `iconName`. Unrecognised or absent
* names resolve to the neutral fallback icon rather than throwing. */
export function iconFor(iconName: string | undefined): LucideIcon {
if (!iconName) return FALLBACK_ICON;
return ICONS[iconName] ?? FALLBACK_ICON;
}