Files
loyaly_cutomerweb/src/shared/utils/icons.ts
2026-09-30 19:09:48 +05:30

272 lines
5.4 KiB
TypeScript

/**
* The single icon map for the whole app.
*
* Astryx resolves exactly 26 SEMANTIC names through the theme's icon registry
* (`<Icon icon="search" />`). Everything else must be passed as a component.
* Rather than let feature files import from lucide-react ad hoc — which is how
* an icon set drifts — every non-semantic glyph is named once, here.
*
* Rule: `<Icon icon="search" />` for anything in SEMANTIC_ICONS,
* `<Icon icon={ICONS.stores} />` for everything else.
*/
import {
ArrowRight,
BadgeCheck,
Barcode,
Bell,
BookOpen,
Building2,
CalendarClock,
CalendarDays,
Camera,
ChartLine,
ChevronsUpDown,
CircleAlert,
CircleHelp,
Clock,
Code,
Coins,
Columns3,
CreditCard,
Disc3,
DoorOpen,
Download,
Expand,
Footprints,
Gift,
Globe,
History,
IndianRupee,
Info,
Keyboard,
LayoutDashboard,
Lightbulb,
Lock,
LogOut,
Maximize2,
Megaphone,
Menu,
MessageSquare,
Headphones,
LayoutGrid,
Laptop,
List,
Microwave,
Refrigerator,
Smartphone,
Snowflake,
Star,
Tablet,
Tv,
WashingMachine,
Watch,
Package,
Mic,
Minimize2,
PanelLeftClose,
PanelLeftOpen,
PanelRightClose,
PanelRightOpen,
Paperclip,
Plus,
Percent,
Plug,
Route,
RotateCw,
Send,
Settings,
ShieldCheck,
Shrink,
ShoppingBag,
ShoppingCart,
Sliders,
Square,
SquarePen,
ScanBarcode,
Sparkles,
Store,
Tag,
Target,
Ticket,
TrendingDown,
TrendingUp,
Trophy,
Sun,
Moon,
User,
UserCheck,
UserPlus,
Users,
UserX,
} from 'lucide-react';
import type {IconType} from '@astryxdesign/core/Icon';
export const ICONS = {
// Expansion & Resize
expand: Expand,
restore: Shrink,
fullscreen: Maximize2,
minimize: Minimize2,
// Navigation
dashboard: LayoutDashboard,
commerce: ShoppingCart,
stores: Store,
products: Package,
// Product catalogue — one glyph per product kind, plus the view toggle.
productTv: Tv,
productMobile: Smartphone,
productLaptop: Laptop,
productTablet: Tablet,
productFridge: Refrigerator,
productWasher: WashingMachine,
productAc: Snowflake,
productMicrowave: Microwave,
productAudio: Headphones,
productWearable: Watch,
rating: Star,
viewGrid: LayoutGrid,
viewList: List,
barcode: Barcode,
scanBarcode: ScanBarcode,
tag: Tag,
cameras: Camera,
lyts: Gift,
staff: Users,
settings: Settings,
// Settings Modules
business: Building2,
roles: ShieldCheck,
integrations: Plug,
api: Code,
security: Lock,
preferences: Sliders,
// Dashboard metrics
visitors: Footprints,
purchases: ShoppingCart,
revenue: IndianRupee,
activeRewards: BadgeCheck,
conversion: Percent,
lyt: Coins,
// Customer activities.
//
// One glyph per activity in the loyalty ecosystem. Named with an `activity`
// prefix rather than folded into the metric block above because several
// collide with an existing concept and must not be merged with it: a `visit`
// is a customer walking in, which is not the `visitors` KPI; `activityShop`
// is the shop ACTIVITY, while `purchases` is the transaction metric.
activityWalk: Footprints,
activityVisit: DoorOpen,
activitySelfie: Camera,
activitySpin: Disc3,
activityScratch: Ticket,
activityBrand: Megaphone,
activityChallenge: Target,
activityFriend: UserPlus,
activityShop: ShoppingBag,
activityEvent: CalendarDays,
// Store intelligence
journey: Route,
campaign: Megaphone,
insight: Lightbulb,
arrowRight: ArrowRight,
// Dashboard controls
compare: Columns3,
// Trend / delta
up: TrendingUp,
down: TrendingDown,
// Loyaly AI
ai: Sparkles,
analytics: ChartLine,
chat: MessageSquare,
mic: Mic,
send: Send,
panelClose: PanelRightClose,
panelOpen: PanelRightOpen,
newChat: SquarePen,
reload: RotateCw,
history: History,
attach: Paperclip,
plus: Plus,
stop: Square,
// Shell
// One control drives the sidebar in all three states, so it needs all three
// glyphs: the hamburger below the drawer breakpoint, and the panel pair
// above it. PanelLeft*, not PanelRight* — those belong to the Loyaly AI rail
// on the opposite edge, and pointing both controls the same way would make
// the header read as two buttons for one panel.
menu: Menu,
sidebarOpen: PanelLeftOpen,
sidebarClose: PanelLeftClose,
notifications: Bell,
sun: Sun,
moon: Moon,
// Account menu
language: Globe,
help: CircleHelp,
billing: CreditCard,
download: Download,
profile: User,
signOut: LogOut,
switcher: ChevronsUpDown,
// Help panel. `info` duplicates a semantic name on purpose: the account menu
// config types its icons as components, so it cannot pass the string form.
docs: BookOpen,
keyboard: Keyboard,
info: Info,
sessions: Clock,
// Staff / rewards
present: UserCheck,
absent: UserX,
late: Clock,
leaderboard: Trophy,
expiry: CalendarClock,
alert: CircleAlert,
} satisfies Record<string, IconType>;
export type IconKey = keyof typeof ICONS;
/**
* The names that resolve through the theme registry. Prefer these over an
* equivalent lucide import so the icon follows the theme.
*/
export const SEMANTIC_ICONS = [
'close',
'chevronDown',
'chevronLeft',
'chevronRight',
'check',
'success',
'error',
'warning',
'info',
'calendar',
'clock',
'externalLink',
'menu',
'moreHorizontal',
'search',
'arrowUp',
'arrowDown',
'arrowsUpDown',
'funnel',
'eyeSlash',
'viewColumns',
'copy',
'checkDouble',
'wrench',
'stop',
'microphone',
] as const;