Sign in required
Please log in to view your profile
/** * Component: User Profile Page * Documentation: documentation/frontend/components.md */ 'use client'; import { useMemo } from 'react'; import { Header } from '@/components/layout/Header'; import { RequestCard } from '@/components/requests/RequestCard'; import { useAuth } from '@/contexts/AuthContext'; import { useRequests } from '@/lib/hooks/useRequests'; import { cn } from '@/lib/utils/cn'; import { GoodreadsShelvesSection } from '@/components/profile/GoodreadsShelvesSection'; import { ApiTokensSection } from '@/components/profile/ApiTokensSection'; import { WatchedSeriesSection, WatchedAuthorsSection } from '@/components/profile/WatchedListsSection'; const statConfig = [ { key: 'total', label: 'Total', color: 'text-gray-900 dark:text-white' }, { key: 'active', label: 'Active', color: 'text-blue-500' }, { key: 'waiting', label: 'Waiting', color: 'text-amber-500' }, { key: 'completed', label: 'Complete', color: 'text-emerald-500' }, { key: 'failed', label: 'Failed', color: 'text-red-500' }, { key: 'cancelled', label: 'Cancelled', color: 'text-gray-400 dark:text-gray-500' }, ] as const; type StatKey = (typeof statConfig)[number]['key']; export default function ProfilePage() { const { user } = useAuth(); const { requests, isLoading } = useRequests(undefined, 50, true); const stats = useMemo(() => { if (!requests.length) { return { total: 0, completed: 0, active: 0, waiting: 0, failed: 0, cancelled: 0 }; } return { total: requests.length, completed: requests.filter((r: any) => ['available', 'downloaded'].includes(r.status)).length, active: requests.filter((r: any) => ['pending', 'searching', 'downloading', 'processing'].includes(r.status)).length, waiting: requests.filter((r: any) => ['awaiting_search', 'awaiting_import'].includes(r.status)).length, failed: requests.filter((r: any) => r.status === 'failed').length, cancelled: requests.filter((r: any) => r.status === 'cancelled').length, }; }, [requests]); const activeDownloads = useMemo(() => { return requests.filter((r: any) => ['downloading', 'processing'].includes(r.status)); }, [requests]); const recentRequests = useMemo(() => { return [...requests] .sort((a: any, b: any) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()) .slice(0, 5); }, [requests]); if (!user) { return (
Please log in to view your profile
{user.email}
)}