mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 14:11:12 -05:00
Add admin panel refresh settings
This commit is contained in:
@@ -251,6 +251,79 @@ export default function AdminSettings() {
|
||||
);
|
||||
}
|
||||
|
||||
// Admin panel refresh mode setting
|
||||
if (setting.setting_key === 'system.admin_panel_refresh_mode') {
|
||||
return (
|
||||
<Card className="p-4">
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<Settings className="w-4 h-4 text-blue-500" />
|
||||
<Label className="text-base font-medium">Admin Panel Refresh Mode</Label>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Choose how the admin panel statistics refresh
|
||||
</p>
|
||||
<div className="flex items-center gap-4">
|
||||
<Select
|
||||
value={typeof localValue === 'string' ? localValue.replace(/"/g, '') : localValue}
|
||||
onValueChange={(value) => {
|
||||
setLocalValue(value);
|
||||
updateSetting(setting.setting_key, JSON.stringify(value));
|
||||
}}
|
||||
>
|
||||
<SelectTrigger className="w-48">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="manual">Manual Only</SelectItem>
|
||||
<SelectItem value="auto">Auto-refresh</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Badge variant="outline">
|
||||
Current: {(typeof localValue === 'string' ? localValue.replace(/"/g, '') : localValue) === 'auto' ? 'Auto-refresh' : 'Manual'}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
// Admin panel poll interval setting
|
||||
if (setting.setting_key === 'system.admin_panel_poll_interval') {
|
||||
return (
|
||||
<Card className="p-4">
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<Clock className="w-4 h-4 text-green-500" />
|
||||
<Label className="text-base font-medium">Auto-refresh Interval</Label>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
How often to automatically refresh admin panel statistics (when auto-refresh is enabled)
|
||||
</p>
|
||||
<div className="flex items-center gap-4">
|
||||
<Select value={localValue?.toString()} onValueChange={(value) => {
|
||||
const numValue = parseInt(value);
|
||||
setLocalValue(numValue);
|
||||
updateSetting(setting.setting_key, numValue);
|
||||
}}>
|
||||
<SelectTrigger className="w-40">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="10">10 seconds</SelectItem>
|
||||
<SelectItem value="30">30 seconds</SelectItem>
|
||||
<SelectItem value="60">1 minute</SelectItem>
|
||||
<SelectItem value="120">2 minutes</SelectItem>
|
||||
<SelectItem value="300">5 minutes</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Badge variant="outline">Current: {localValue}s</Badge>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
// Boolean/switch settings
|
||||
if (setting.setting_key.includes('email_alerts') ||
|
||||
setting.setting_key.includes('require_approval') ||
|
||||
|
||||
Reference in New Issue
Block a user