'use client' import * as React from 'react' import Link from 'next/link' import { usePathname } from 'next/navigation' import { ChevronRight, Home, Search, Star, BookOpen, Code, Layers, Package, Globe, } from 'lucide-react' import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, } from '@/components/ui/sidebar' import { ScrollArea } from '@/components/ui/scroll-area' import { Input } from '@/components/ui/input' import { cn } from '@/lib/utils' import { AwesomeIcon } from '@/components/ui/awesome-icon' interface Category { name: string icon: React.ReactNode lists: ListItem[] expanded?: boolean } interface ListItem { id: string name: string url: string stars?: number } export function AppSidebar() { const pathname = usePathname() const [searchQuery, setSearchQuery] = React.useState('') const [expandedCategories, setExpandedCategories] = React.useState>( new Set(['Front-end Development']) ) // Mock data - will be replaced with actual API call const categories: Category[] = [ { name: 'Front-end Development', icon: , lists: [ { id: 'react', name: 'React', url: '/list/react', stars: 45000 }, { id: 'vue', name: 'Vue.js', url: '/list/vue', stars: 38000 }, { id: 'angular', name: 'Angular', url: '/list/angular', stars: 32000 }, { id: 'svelte', name: 'Svelte', url: '/list/svelte', stars: 28000 }, { id: 'css', name: 'CSS', url: '/list/css', stars: 25000 }, { id: 'tailwind', name: 'Tailwind CSS', url: '/list/tailwind', stars: 22000 }, ], }, { name: 'Back-end Development', icon: , lists: [ { id: 'nodejs', name: 'Node.js', url: '/list/nodejs', stars: 38000 }, { id: 'python', name: 'Python', url: '/list/python', stars: 52000 }, { id: 'go', name: 'Go', url: '/list/go', stars: 35000 }, { id: 'rust', name: 'Rust', url: '/list/rust', stars: 30000 }, { id: 'java', name: 'Java', url: '/list/java', stars: 28000 }, { id: 'dotnet', name: '.NET', url: '/list/dotnet', stars: 24000 }, ], }, { name: 'Programming Languages', icon: , lists: [ { id: 'javascript', name: 'JavaScript', url: '/list/javascript', stars: 48000 }, { id: 'typescript', name: 'TypeScript', url: '/list/typescript', stars: 42000 }, { id: 'python-lang', name: 'Python', url: '/list/python-lang', stars: 52000 }, { id: 'rust-lang', name: 'Rust', url: '/list/rust-lang', stars: 30000 }, { id: 'go-lang', name: 'Go', url: '/list/go-lang', stars: 35000 }, ], }, { name: 'Platforms', icon: , lists: [ { id: 'docker', name: 'Docker', url: '/list/docker', stars: 40000 }, { id: 'kubernetes', name: 'Kubernetes', url: '/list/kubernetes', stars: 38000 }, { id: 'aws', name: 'AWS', url: '/list/aws', stars: 35000 }, { id: 'azure', name: 'Azure', url: '/list/azure', stars: 28000 }, ], }, { name: 'Tools', icon: , lists: [ { id: 'vscode', name: 'VS Code', url: '/list/vscode', stars: 45000 }, { id: 'git', name: 'Git', url: '/list/git', stars: 42000 }, { id: 'vim', name: 'Vim', url: '/list/vim', stars: 38000 }, { id: 'cli', name: 'CLI', url: '/list/cli', stars: 35000 }, ], }, ] const toggleCategory = (categoryName: string) => { setExpandedCategories((prev) => { const next = new Set(prev) if (next.has(categoryName)) { next.delete(categoryName) } else { next.add(categoryName) } return next }) } const filteredCategories = React.useMemo(() => { if (!searchQuery) return categories return categories .map((category) => ({ ...category, lists: category.lists.filter((list) => list.name.toLowerCase().includes(searchQuery.toLowerCase()) ), })) .filter((category) => category.lists.length > 0) }, [searchQuery]) return ( {/* Header */}
Awesome
{/* Search Input */}
setSearchQuery(e.target.value)} />
{/* Main Navigation */} Home Search Browse {/* Categories */} {filteredCategories.map((category) => { const isExpanded = expandedCategories.has(category.name) return ( {isExpanded && ( {category.lists.map((list) => ( {list.name} {list.stars && ( {(list.stars / 1000).toFixed(0)}k )} ))} )} ) })} {/* Footer */}
Built with 💜💗💛
Updated every 6 hours
) }