'use client'; import { useState, useEffect, use } from 'react'; import { ResourceCard } from '@/components/ResourceCard'; import { getLessons } from '@/lib/actions/lessonActions'; import { getCategories } from '@/lib/actions/categoryActions'; import { Search, Code2, SlidersHorizontal, Loader2 } from 'lucide-react'; export default function LessonsPage({ params }: { params: Promise<{ locale: string }> }) { const { locale } = use(params); const [search, setSearch] = useState(''); const [selectedCat, setSelectedCat] = useState(null); const [lessons, setLessons] = useState([]); const [categories, setCategories] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { getCategories().then(setCategories); }, []); useEffect(() => { async function loadData() { setLoading(true); const res = await getLessons({ query: search, category: selectedCat || undefined }); setLessons(res); setLoading(false); } loadData(); }, [search, selectedCat]); return (
{/* Header */}
YouTube Content & Code Library

All Video Tutorials & Code Resources

Browse, filter, and inspect all source code snippets, lesson notes, starter zip packages, and multi-file project structures.

{/* Filter Bar */}
{/* Search Input */}
setSearch(e.target.value)} className="w-full bg-slate-950 border border-slate-800 rounded-xl pl-10 pr-4 py-2 text-xs text-white placeholder-slate-500 focus:outline-none focus:border-red-500/50" />
{/* Category Pills */}
{categories.map((cat) => ( ))}
{/* Grid */} {loading ? (
Loading tutorials...
) : lessons.length > 0 ? (
{lessons.map((item) => ( ))}
) : (
No YouTube tutorials match your search filters.
)}
); }