Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | import { Pin, PinOff, ChevronRight } from "lucide-react"; import type { Category } from "@/lib/types"; interface GroupListProps { groups: string[]; categories: Category[]; onSelectGroup: (name: string) => void; isPinned: (name: string) => boolean; onTogglePin: (name: string) => void; } export const GroupList = ({ groups, categories, onSelectGroup, isPinned, onTogglePin, }: GroupListProps) => { const getChannelCount = (groupName: string) => categories.find((c) => c.name === groupName)?.channelCount ?? 0; return ( <div className="px-4 pt-2 flex flex-col gap-1"> {groups.map((name) => ( <div key={name} role="button" tabIndex={0} className="flex items-center justify-between p-2.5 rounded-lg bg-secondary hover:bg-accent transition-colors cursor-pointer" onClick={() => onSelectGroup(name)} onKeyDown={(e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); onSelectGroup(name); } }} > <div className="flex items-center gap-2"> <span className="text-sm">{name}</span> <span className="text-xs text-muted-foreground"> {getChannelCount(name)} ch </span> </div> <div className="flex items-center gap-2"> <button onClick={(e) => { e.stopPropagation(); onTogglePin(name); }} className={`p-1 rounded hover:bg-background transition-colors ${ isPinned(name) ? "text-primary" : "text-muted-foreground" }`} > {isPinned(name) ? ( <PinOff className="h-3.5 w-3.5" /> ) : ( <Pin className="h-3.5 w-3.5" /> )} </button> <ChevronRight className="h-4 w-4 text-muted-foreground" /> </div> </div> ))} </div> ); }; |