Files
app/frontend/src/components/Dashboard/icons.ts
T
stroblmeandClaude Opus 5 dbaa3518b9 Bump dashboards: bar, icon, forecast and clock widget types
Plumbing only: the widget-type literal and its dtype table on both sides,
the regenerated client, a curated lucide map and four stubs the renderers
are wired to. Also a latching switch and a segmented dropdown, both a
`style` on the control that already publishes and reads back, plus the
option editor a dropdown never had.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HTsT1isxUjw5gtkJk8WhuA
2026-08-20 08:31:36 +02:00

91 lines
2.0 KiB
TypeScript

import {
ArrowDown,
ArrowUp,
BatteryCharging,
Bed,
Check,
CircleCheck,
CloudDrizzle,
CloudFog,
CloudLightning,
CloudRain,
CloudSnow,
Cloudy,
DoorOpen,
Droplets,
Fan,
Flame,
House,
Lightbulb,
type LucideIcon,
Moon,
Plug,
Snowflake,
Sun,
SunSnow,
Thermometer,
ThermometerSun,
TriangleAlert,
Umbrella,
Wind,
Zap,
} from "lucide-react"
/**
* The icons a tile may be drawn with, by name.
*
* Curated rather than lucide's `dynamicIconImports`: the panel has to offer
* these in a list, and the dynamic map makes the bundler emit a lazy chunk per
* icon — some fifteen hundred of them — so a wall panel would fetch one request
* per tile over its LAN before it could draw anything. A few dozen weather,
* room and status glyphs cover what a dashboard says, and the map is cheap to
* extend.
*/
export const ICONS: Record<string, LucideIcon> = {
sun: Sun,
moon: Moon,
cloudy: Cloudy,
"cloud-rain": CloudRain,
"cloud-drizzle": CloudDrizzle,
"cloud-snow": CloudSnow,
"cloud-lightning": CloudLightning,
"cloud-fog": CloudFog,
wind: Wind,
umbrella: Umbrella,
snowflake: Snowflake,
droplets: Droplets,
thermometer: Thermometer,
"thermometer-sun": ThermometerSun,
flame: Flame,
fan: Fan,
"sun-snow": SunSnow,
"door-open": DoorOpen,
house: House,
bed: Bed,
lightbulb: Lightbulb,
plug: Plug,
zap: Zap,
"battery-charging": BatteryCharging,
"arrow-up": ArrowUp,
"arrow-down": ArrowDown,
"triangle-alert": TriangleAlert,
check: Check,
"circle-check": CircleCheck,
}
export const ICON_NAMES = Object.keys(ICONS)
/**
* What an icon may be tinted, by name.
*
* Literal classes so Tailwind's scanner sees them. No terracotta: that is the
* one affordance a view gets, and a panel is many tiles.
*/
export const ICON_COLORS: Record<string, string> = {
default: "text-foreground",
muted: "text-muted-foreground",
primary: "text-primary",
success: "text-status-success",
danger: "text-destructive",
}