Extract Central pages from the wild-cloud web app into a standalone React app for Wild Central. Includes: - Central overview, DNS, DHCP, Firewall, VPN, Ingress, CrowdSec pages - Simplified sidebar with Central-only navigation - Branding updated to "Wild Central" - All Cloud-specific pages, components, hooks, and API services removed - TypeScript type-check and production build pass Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import { Moon, Sun, Monitor } from 'lucide-react';
|
|
import { Button } from './ui/button';
|
|
import { useTheme } from '../contexts/ThemeContext';
|
|
|
|
export function ThemeToggle() {
|
|
const { theme, setTheme } = useTheme();
|
|
|
|
const cycleTheme = () => {
|
|
if (theme === 'light') {
|
|
setTheme('dark');
|
|
} else if (theme === 'dark') {
|
|
setTheme('system');
|
|
} else {
|
|
setTheme('light');
|
|
}
|
|
};
|
|
|
|
const getIcon = () => {
|
|
switch (theme) {
|
|
case 'light':
|
|
return <Sun className="h-4 w-4" />;
|
|
case 'dark':
|
|
return <Moon className="h-4 w-4" />;
|
|
default:
|
|
return <Monitor className="h-4 w-4" />;
|
|
}
|
|
};
|
|
|
|
const getLabel = () => {
|
|
switch (theme) {
|
|
case 'light':
|
|
return 'Light mode';
|
|
case 'dark':
|
|
return 'Dark mode';
|
|
default:
|
|
return 'System theme';
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Button
|
|
variant="ghost"
|
|
size="sm"
|
|
onClick={cycleTheme}
|
|
title={`Current: ${getLabel()}. Click to cycle themes.`}
|
|
className="gap-2"
|
|
>
|
|
{getIcon()}
|
|
<span className="text-xs font-medium">{getLabel()}</span>
|
|
</Button>
|
|
);
|
|
} |