- Created SearchBar component with debounced input - Built FilterPanel component with controls for priority, completion, tags, and due date - Added sort controls (field and direction) - Implemented filter clear functionality - Display search results with highlighted text - Added GlobalSearch component for home page - Integrated search and filter into list detail view - Added CSS styles for search highlighting Requirements: 6.1, 6.2, 6.3, 6.4, 8.1, 8.2, 8.3
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { getListWithItems } from '@/lib/actions'
|
|
import { notFound } from 'next/navigation'
|
|
import Link from 'next/link'
|
|
import { ArrowLeft } from 'lucide-react'
|
|
import InlineItemCreate from '@/components/InlineItemCreate'
|
|
import ListDetailView from '@/components/ListDetailView'
|
|
|
|
export default async function ListDetailPage({ params }: { params: { id: string } }) {
|
|
const list = await getListWithItems(params.id)
|
|
|
|
if (!list) {
|
|
notFound()
|
|
}
|
|
|
|
const completedItems = list.items.filter(item => item.completed)
|
|
|
|
return (
|
|
<main className="container mx-auto px-4 py-8 max-w-4xl">
|
|
{/* Header */}
|
|
<div className="mb-8">
|
|
<Link
|
|
href="/"
|
|
className="inline-flex items-center gap-2 text-gray-600 hover:text-gray-900 mb-4 transition-colors"
|
|
>
|
|
<ArrowLeft size={20} />
|
|
<span>Back to Lists</span>
|
|
</Link>
|
|
|
|
<div className="flex items-center gap-3 mb-2">
|
|
<div
|
|
className="w-6 h-6 rounded-full flex-shrink-0"
|
|
style={{ backgroundColor: list.color }}
|
|
/>
|
|
<h1 className="text-3xl font-bold text-gray-900">{list.title}</h1>
|
|
</div>
|
|
|
|
<p className="text-gray-600">
|
|
{completedItems.length} of {list.items.length} tasks completed
|
|
</p>
|
|
</div>
|
|
|
|
{/* Inline Item Creation */}
|
|
<div className="mb-6">
|
|
<InlineItemCreate listId={list.id} />
|
|
</div>
|
|
|
|
{/* Search, Filter, and Items List */}
|
|
<ListDetailView listId={list.id} initialItems={list.items} />
|
|
</main>
|
|
)
|
|
}
|