'use client'; import { useState } from 'react'; import { useAuth } from '@/lib/auth'; import { apiRequest } from '@/lib/api'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; const AdminPage = () => { const [message, setMessage] = useState(''); const [error, setError] = useState(''); const auth = useAuth(); const handleScan = async () => { setError(''); setMessage('Scanning...'); try { const data = await apiRequest('/videos/scan', { method: 'POST', token: auth.token }); setMessage(data.message); } catch (err: any) { setError(err.message); } }; const users = [{email: 'admin@example.com', role: 'admin'}, {email: 'user@example.com', role: 'user'}]; const votes = [{video_id: 'xyz', decision: 'approve', reason: 'Good clip'}]; if (auth.user?.role !== 'admin') { return
Access Denied. You must be an admin to view this page.
; } return ({message}
} {error &&{error}
}User list functionality would go here.
Vote list functionality would go here.