'use client'; import { useEffect, useState } from 'react'; import Link from 'next/link'; import { NotebookCard } from '@/components/NotebookCard'; import { SearchBar } from '@/components/SearchBar'; import { Header } from '@/components/Header'; interface NotebookData { id: string; title: string; description: string | null; coverColor: string; updatedAt: string; _count: { notes: number }; } export default function NotebooksPage() { const [notebooks, setNotebooks] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { fetch('/api/notebooks') .then((res) => res.json()) .then(setNotebooks) .catch(console.error) .finally(() => setLoading(false)); }, []); return (
New Notebook } /> {/* Mobile search */}
{loading ? (
) : notebooks.length === 0 ? (

No notebooks yet. Create your first one!

Create Notebook
) : (
{notebooks.map((nb) => ( ))}
)}
); }