import { useState } from "react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./ui/card"; import { Button } from "./ui/button"; import { RefreshCw, Trash2, ShieldAlert, Loader2, Power } from "lucide-react"; /** * Props for the ControlPanel component */ interface ControlPanelProps { maintenanceMode: boolean; } /** * ControlPanel component provides quick administrative actions for the bot. * Integrated with the premium glassmorphic theme. */ export function ControlPanel({ maintenanceMode }: ControlPanelProps) { const [loading, setLoading] = useState(null); /** * Handles triggering an administrative action via the API */ const handleAction = async (action: string, payload?: Record) => { setLoading(action); try { const response = await fetch(`/api/actions/${action}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: payload ? JSON.stringify(payload) : undefined, }); if (!response.ok) throw new Error(`Action ${action} failed`); } catch (error) { console.error("Action Error:", error); // Ideally we'd show a toast here } finally { setLoading(null); } }; return (
System Controls Administrative bot operations
{/* Reload Commands Button */} {/* Clear Cache Button */}
{/* Maintenance Mode Toggle Button */}
); }