'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?.filter(p => p.status === 'Active').length || 0, archivedProjects: projects?.filter(p => p.status === 'Archived').length || 0, }; // 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 (
Welcome back! Here's an overview of your projects.
Projects in your workspace
> )}Currently in progress
> )}Completed or on hold
> )}{project.key} • {project.description || 'No description'}
No projects yet. Create your first project to get started.