task-group-icons.ts1.2 KBView on GitHub /**
* Task-group icons.
*
* `task_groups.icon` stores a lucide icon *name* (e.g. 'Trophy') rather than a component, so the
* value round-trips through the DB and is readable by the agent. This map resolves the name back
* to a component. Mirrors the STATUS_ICON_MAP pattern in modules/crm/utils.
*
* Only the names the default seed uses are registered; anything unknown (including a null icon on
* the virtual Misc lane, or a group the user created by hand) falls back to ListTodo.
*/
import {
CalendarCheck,
CalendarClock,
CalendarPlus,
Database,
ListTodo,
NotebookPen,
Reply,
Send,
Trophy,
Users,
Zap,
type LucideIcon,
} from 'lucide-react';
export const TASK_GROUP_ICON_MAP: Record<string, LucideIcon> = {
Trophy,
Reply,
CalendarCheck,
CalendarPlus,
Database,
NotebookPen,
Send,
CalendarClock,
Users,
Zap,
ListTodo,
};
export const DEFAULT_TASK_GROUP_ICON: LucideIcon = ListTodo;
/** Resolve a stored icon name to a component, falling back to ListTodo. */
export function taskGroupIcon(name: string | null | undefined): LucideIcon {
if (!name) return DEFAULT_TASK_GROUP_ICON;
return TASK_GROUP_ICON_MAP[name] ?? DEFAULT_TASK_GROUP_ICON;
}