// Next.js Server Component (no 'use client' needed here) // This page runs on the server, reads from SQLite directly, and renders HTML import { getTasks } from '@/src/lib/tasks'; import TaskForm from '@/src/lib/components/TaskForm'; import TaskCard from '@/src/lib/components/TaskCard'; import TaskFilterToolbar from '@/src/lib/components/TaskFilterToolbar'; // Next.js 15 page props for async searchParams interface PageProps { searchParams: Promise<{ sortBy?: 'due_date' | 'topic' | 'status' }>; } export default async function HomePage({ searchParams }: PageProps) { // Await search parameters from the URL (e.g., ?sortBy=topic) const params = await searchParams; const sortBy = params.sortBy || 'due_date'; // Direct SQLite query on the server to get active tasks sorted const tasks = getTasks(sortBy); return (
{/* Header */}

📝 Todo App

Local-first SQLite task manager with dynamic overdue detection.

{/* Task Creation Form */} {/* Task Sorting Toolbar */} {/* List of Tasks */}

Tasks ({tasks.length})

{/* Empty state if no tasks exist */} {tasks.length === 0 ? (

No active tasks found. Create one above!

) : ( /* Render grid of task cards */
{tasks.map(task => ( ))}
)}
); }