'use client'; import { useState } from 'react'; import Link from 'next/link'; import { Plus, FolderKanban, Calendar } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { Skeleton } from '@/components/ui/skeleton'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; import { useProjects } from '@/lib/hooks/use-projects'; import { ProjectForm } from '@/components/projects/project-form'; import { formatDistanceToNow } from 'date-fns'; export default function ProjectsPage() { const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false); const { data: projects, isLoading, error } = useProjects(); if (isLoading) { return (
{Array.from({ length: 6 }).map((_, i) => ( ))}
); } if (error) { return (
Error Loading Projects {error instanceof Error ? error.message : 'Failed to load projects'}
); } return (
{/* Header */}

Projects

Manage your projects and track progress

{/* Projects Grid */} {projects && projects.length > 0 ? (
{projects.map((project) => (
{project.name}
{project.key}
{project.description ? (

{project.description}

) : (

No description

)}
Created {formatDistanceToNow(new Date(project.createdAt), { addSuffix: true })}
))}
) : ( No projects yet Get started by creating your first project )} {/* Create Project Dialog */} Create New Project Add a new project to organize your work and track progress setIsCreateDialogOpen(false)} onCancel={() => setIsCreateDialogOpen(false)} />
); }