diff --git a/AppImage/components/notification-settings.tsx b/AppImage/components/notification-settings.tsx index f7876a9c..1fe8df24 100644 --- a/AppImage/components/notification-settings.tsx +++ b/AppImage/components/notification-settings.tsx @@ -101,6 +101,140 @@ const AI_PROVIDERS = [ { value: "groq", label: "Groq" }, ] +// ── Channel visual definitions ── +const CHANNEL_COLOR_MAP: Record = { + blue: "border-blue-500/60 bg-blue-500/10", + green: "border-green-500/60 bg-green-500/10", + indigo: "border-indigo-500/60 bg-indigo-500/10", + amber: "border-amber-500/60 bg-amber-500/10", +} +const CHANNEL_TEXT_COLOR: Record = { + blue: "text-blue-400", + green: "text-green-400", + indigo: "text-indigo-400", + amber: "text-amber-400", +} +const CHANNEL_MUTED_COLOR: Record = { + blue: "text-blue-500/30", + green: "text-green-500/30", + indigo: "text-indigo-500/30", + amber: "text-amber-500/30", +} +const CHANNEL_SWITCH_COLOR: Record = { + blue: "bg-blue-600", + green: "bg-green-600", + indigo: "bg-indigo-600", + amber: "bg-amber-600", +} + +const CHANNEL_DEFS: ChannelDef[] = [ + { key: "telegram", label: "Telegram", color: "blue", activeColor: "bg-blue-600 hover:bg-blue-700" }, + { key: "gotify", label: "Gotify", color: "green", activeColor: "bg-green-600 hover:bg-green-700" }, + { key: "discord", label: "Discord", color: "indigo", activeColor: "bg-indigo-600 hover:bg-indigo-700" }, + { key: "email", label: "Email", color: "amber", activeColor: "bg-amber-600 hover:bg-amber-700" }, +] + +interface ChannelDef { + key: string + label: string + color: string + activeColor: string +} + +function ChannelLogo({ channel, className }: { channel: string; className?: string }) { + switch (channel) { + case "telegram": + return ( + + + + ) + case "gotify": + return ( + + + + ) + case "discord": + return ( + + + + ) + case "email": + return + default: + return null + } +} + +function ChannelGrid({ channels, selectedChannel, onSelectChannel, onToggleChannel }: { + channels: Record + selectedChannel: string | null + onSelectChannel: (key: string) => void + onToggleChannel: (key: string, enabled: boolean) => void +}) { + return ( +
+ {CHANNEL_DEFS.map(ch => { + const isEnabled = channels[ch.key]?.enabled || false + const isSelected = selectedChannel === ch.key + + return ( + + ) + })} +
+ ) +} + const DEFAULT_CONFIG: NotificationConfig = { enabled: false, channels: { @@ -672,100 +806,12 @@ matcher: proxmenux-pbs {/* ── Channel Cards Grid ── */} -
- {([ - { key: "telegram", label: "Telegram", color: "blue", activeColor: "bg-blue-600 hover:bg-blue-700", - logo: }, - { key: "gotify", label: "Gotify", color: "green", activeColor: "bg-green-600 hover:bg-green-700", - logo: }, - { key: "discord", label: "Discord", color: "indigo", activeColor: "bg-indigo-600 hover:bg-indigo-700", - logo: }, - { key: "email", label: "Email", color: "amber", activeColor: "bg-amber-600 hover:bg-amber-700", - logo: }, - ] as { key: string; label: string; color: string; activeColor: string; logo: React.ReactNode }[]).map(ch => { - const isEnabled = (config.channels as Record)[ch.key]?.enabled || false - const isSelected = selectedChannel === ch.key - const colorMap: Record = { - blue: "border-blue-500/60 bg-blue-500/10", - green: "border-green-500/60 bg-green-500/10", - indigo: "border-indigo-500/60 bg-indigo-500/10", - amber: "border-amber-500/60 bg-amber-500/10", - } - const textColorMap: Record = { - blue: "text-blue-400", - green: "text-green-400", - indigo: "text-indigo-400", - amber: "text-amber-400", - } - const mutedColorMap: Record = { - blue: "text-blue-500/30", - green: "text-green-500/30", - indigo: "text-indigo-500/30", - amber: "text-amber-500/30", - } - const switchColorMap: Record = { - blue: "bg-blue-600", - green: "bg-green-600", - indigo: "bg-indigo-600", - amber: "bg-amber-600", - } - - return ( - - ) - })} -
+ setSelectedChannel(selectedChannel === key ? null : key)} + onToggleChannel={(key, enabled) => updateChannel(key, "enabled", enabled)} + /> {/* ── Selected Channel Configuration Panel ── */} {selectedChannel === "telegram" && (