'use client'; import Link from 'next/link'; import { useState } from 'react'; import { Plus, FolderKanban, Archive, TrendingUp, ArrowRight } from 'lucide-react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { Skeleton } from '@/components/ui/skeleton'; import { useProjects } from '@/lib/hooks/use-projects'; import { CreateProjectDialog } from '@/components/features/projects/CreateProjectDialog'; export default function DashboardPage() { const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false); const { data: projects, isLoading } = useProjects(); // Calculate statistics const stats = { totalProjects: projects?.length || 0, activeProjects: projects?.length || 0, // TODO: Add status field to Project model archivedProjects: 0, // TODO: Add status field to Project model }; // Get recent projects (sort by creation time, take first 5) const recentProjects = projects ?.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()) .slice(0, 5) || []; return (
{/* Header */}

Dashboard

Welcome back! Here's an overview of your projects.

{/* Statistics Cards */}
Total Projects {isLoading ? ( ) : ( <>
{stats.totalProjects}

Projects in your workspace

)}
Active Projects {isLoading ? ( ) : ( <>
{stats.activeProjects}

Currently in progress

)}
Archived Projects {isLoading ? ( ) : ( <>
{stats.archivedProjects}

Completed or on hold

)}
{/* Recent Projects */}
Recent Projects Your recently created projects
{isLoading ? (
{[1, 2, 3].map((i) => (
))}
) : recentProjects.length > 0 ? (
{recentProjects.map((project) => (

{project.name}

{project.key}

{project.description || 'No description'}

{new Date(project.createdAt).toLocaleDateString()}
))}
) : (

No projects yet. Create your first project to get started.

)}
{/* Quick Actions Card */} Quick Actions Common tasks to get you started
); }