Spaces:
Paused
Paused
| 'use client'; | |
| import GpuMonitor from '@/components/GPUMonitor'; | |
| import JobsTable from '@/components/JobsTable'; | |
| import { TopBar, MainContent } from '@/components/layout'; | |
| import Link from 'next/link'; | |
| import { useAuth } from '@/contexts/AuthContext'; | |
| import HFLoginButton from '@/components/HFLoginButton'; | |
| export default function Dashboard() { | |
| const { status: authStatus, namespace } = useAuth(); | |
| const isAuthenticated = authStatus === 'authenticated'; | |
| return ( | |
| <> | |
| <TopBar> | |
| <div> | |
| <h1 className="text-lg">Dashboard</h1> | |
| </div> | |
| <div className="flex-1 flex items-center justify-end gap-3 pr-2 text-sm text-gray-400"> | |
| {isAuthenticated ? ( | |
| <span>Welcome, {namespace || 'user'}</span> | |
| ) : ( | |
| <> | |
| <span>Welcome, Guest</span> | |
| <HFLoginButton size="sm" /> | |
| <Link href="/settings" className="text-xs text-blue-400 hover:text-blue-300"> | |
| Settings | |
| </Link> | |
| </> | |
| )} | |
| </div> | |
| </TopBar> | |
| <MainContent> | |
| <GpuMonitor /> | |
| <div className="w-full mt-4"> | |
| <div className="flex justify-between items-center mb-2"> | |
| <h1 className="text-md">Active Jobs</h1> | |
| <div className="text-xs text-gray-500"> | |
| <Link href="/jobs">View All</Link> | |
| </div> | |
| </div> | |
| {isAuthenticated ? ( | |
| <JobsTable onlyActive /> | |
| ) : ( | |
| <div className="border border-gray-800 rounded-lg p-6 bg-gray-900 text-gray-400 text-sm"> | |
| Sign in with Hugging Face or add an access token in Settings to view and manage jobs. | |
| </div> | |
| )} | |
| </div> | |
| </MainContent> | |
| </> | |
| ); | |
| } | |