2026-01-07 09:31:02 +00:00
|
|
|
import React, { useState } from 'react';
|
|
|
|
|
import { Card } from '../ui/card';
|
|
|
|
|
import { Button } from '../ui/button';
|
|
|
|
|
import { Save, AlertTriangle, Server, Activity } from 'lucide-react';
|
2026-01-26 13:12:17 +00:00
|
|
|
import { useToast } from '../../components/feedback/ToastProvider';
|
2026-01-07 09:31:02 +00:00
|
|
|
|
|
|
|
|
export const AdminSettingsView: React.FC = () => {
|
|
|
|
|
const { addToast } = useToast();
|
|
|
|
|
const [maintenance, setMaintenance] = useState(false);
|
|
|
|
|
const [uploadLimit, setUploadLimit] = useState(500); // MB
|
|
|
|
|
const [announcement, setAnnouncement] = useState('');
|
|
|
|
|
|
|
|
|
|
const handleSave = () => {
|
2026-01-13 18:47:57 +00:00
|
|
|
addToast('System settings updated', 'success');
|
2026-01-07 09:31:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-8 animate-fadeIn max-w-4xl pb-20">
|
feat(ui): education, gamification, developer, admin views polish
Education:
- CourseCard: lessons count badge, progress bar, backdrop-blur on badges
- EducationView: framer-motion stagger on grid
- Filters: interactive color-coded pills (Beginner/Intermediate/Advanced)
- MyCoursesView: stagger animation, semantic token migration
Gamification:
- LeaderboardView: gold/silver/bronze podium styling with glow + accents
- AchievementCard: shine sweep animation on hover, lift effect
- AchievementsView: stagger animation with filter re-animation
- XPBar: semantic token fix
Developer dashboard:
- API key copy-to-clipboard with icon toggle
- Status indicator badges with animated pulse dot
Commerce/Admin:
- WishlistView: stagger animation, hover lift
- PurchasesView: stagger on list items
- Admin views: consistent headers, semantic tokens (text-white → text-foreground)
18 files modified, all text-white → text-foreground migrations
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 23:48:45 +00:00
|
|
|
<div className="flex justify-between items-center border-b border-border/50 pb-6">
|
|
|
|
|
<div>
|
|
|
|
|
<h2 className="text-2xl font-display font-bold text-foreground tracking-tight">
|
|
|
|
|
SYSTEM SETTINGS
|
|
|
|
|
</h2>
|
|
|
|
|
<p className="text-muted-foreground font-mono text-sm">
|
|
|
|
|
Global configuration and feature management.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2026-01-13 18:47:57 +00:00
|
|
|
<Button
|
|
|
|
|
variant="primary"
|
|
|
|
|
icon={<Save className="w-4 h-4" />}
|
|
|
|
|
onClick={handleSave}
|
|
|
|
|
>
|
|
|
|
|
SAVE CHANGES
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
{/* General Config */}
|
|
|
|
|
<Card variant="default">
|
2026-02-07 18:37:41 +00:00
|
|
|
<h3 className="font-bold text-foreground mb-6 flex items-center gap-2">
|
|
|
|
|
<Server className="w-5 h-5 text-muted-foreground" /> General Configuration
|
2026-01-13 18:47:57 +00:00
|
|
|
</h3>
|
|
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
|
|
|
<div>
|
2026-02-07 18:37:41 +00:00
|
|
|
<label className="block text-sm font-bold text-muted-foreground mb-2">
|
|
|
|
|
Upload Limit (MB)
|
|
|
|
|
</label>
|
2026-01-13 18:47:57 +00:00
|
|
|
<input
|
|
|
|
|
type="number"
|
2026-02-07 18:37:41 +00:00
|
|
|
className="w-full bg-card border border-border rounded p-2 text-foreground outline-none focus:border-primary"
|
2026-01-13 18:47:57 +00:00
|
|
|
value={uploadLimit}
|
|
|
|
|
onChange={(e) => setUploadLimit(Number(e.target.value))}
|
|
|
|
|
/>
|
2026-02-07 18:37:41 +00:00
|
|
|
<p className="text-xs text-muted-foreground mt-1">
|
2026-01-13 18:47:57 +00:00
|
|
|
Maximum file size for standard users.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2026-02-07 18:37:41 +00:00
|
|
|
<label className="block text-sm font-bold text-muted-foreground mb-2">
|
|
|
|
|
Default Storage Region
|
|
|
|
|
</label>
|
|
|
|
|
<select className="w-full bg-card border border-border rounded p-2 text-foreground outline-none focus:border-primary">
|
2026-01-13 18:47:57 +00:00
|
|
|
<option>us-east-1 (N. Virginia)</option>
|
|
|
|
|
<option>eu-west-1 (Ireland)</option>
|
|
|
|
|
<option>ap-northeast-1 (Tokyo)</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Card>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
{/* Feature Flags */}
|
|
|
|
|
<Card variant="default">
|
2026-02-07 18:37:41 +00:00
|
|
|
<h3 className="font-bold text-foreground mb-6 flex items-center gap-2">
|
|
|
|
|
<Activity className="w-5 h-5 text-primary" /> Feature Flags
|
2026-01-13 18:47:57 +00:00
|
|
|
</h3>
|
|
|
|
|
<div className="space-y-4">
|
|
|
|
|
{[
|
|
|
|
|
'Live Streaming',
|
|
|
|
|
'Marketplace Transactions',
|
|
|
|
|
'AI Mastering',
|
|
|
|
|
'Public Registrations',
|
|
|
|
|
].map((feature) => (
|
|
|
|
|
<div
|
|
|
|
|
key={feature}
|
2026-02-07 18:37:41 +00:00
|
|
|
className="flex items-center justify-between p-4 bg-muted/50 rounded border border-border"
|
2026-01-13 18:47:57 +00:00
|
|
|
>
|
2026-02-07 18:37:41 +00:00
|
|
|
<span className="font-bold text-foreground">{feature}</span>
|
|
|
|
|
<div className="w-10 h-5 bg-success rounded-full relative cursor-pointer">
|
2026-01-13 18:47:57 +00:00
|
|
|
<div className="absolute top-0.5 right-0.5 w-4 h-4 bg-white rounded-full shadow-md"></div>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
2026-01-13 18:47:57 +00:00
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</Card>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
{/* Maintenance */}
|
2026-02-07 18:37:41 +00:00
|
|
|
<Card variant="default" className="border-destructive/30">
|
|
|
|
|
<h3 className="font-bold text-foreground mb-6 flex items-center gap-2">
|
|
|
|
|
<AlertTriangle className="w-5 h-5 text-destructive" /> Emergency &
|
2026-01-13 18:47:57 +00:00
|
|
|
Maintenance
|
|
|
|
|
</h3>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
<div className="space-y-6">
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<div>
|
2026-02-07 18:37:41 +00:00
|
|
|
<div className="text-foreground font-bold">Maintenance Mode</div>
|
|
|
|
|
<div className="text-xs text-muted-foreground">
|
2026-01-13 18:47:57 +00:00
|
|
|
Disable access for non-admin users
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
onClick={() => setMaintenance(!maintenance)}
|
2026-02-07 18:37:41 +00:00
|
|
|
className={`w-12 h-6 rounded-full relative cursor-pointer transition-colors ${maintenance ? 'bg-destructive' : 'bg-muted'}`}
|
2026-01-13 18:47:57 +00:00
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
className={`absolute top-1 w-4 h-4 bg-white rounded-full transition-all ${maintenance ? 'left-7' : 'left-1'}`}
|
|
|
|
|
></div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
2026-01-13 18:47:57 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
2026-02-07 18:37:41 +00:00
|
|
|
<label className="block text-sm font-bold text-muted-foreground mb-2">
|
2026-01-13 18:47:57 +00:00
|
|
|
Global Announcement
|
|
|
|
|
</label>
|
|
|
|
|
<textarea
|
2026-02-07 18:37:41 +00:00
|
|
|
className="w-full bg-card border border-border rounded p-4 text-foreground outline-none focus:border-primary h-24 resize-none"
|
2026-01-13 18:47:57 +00:00
|
|
|
placeholder="Message to display on all pages..."
|
|
|
|
|
value={announcement}
|
|
|
|
|
onChange={(e) => setAnnouncement(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Card>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|