"use client"; // Mobile Discover sheet (spec "Sheets"): three soft depth rows that open the // Featured experts, Trending minnects and Find experts panels as 80% height // sheets, then the Dark/Light appearance switch. Styles: src/styles/sheet.css. import type { ReactNode } from "react"; import type { DiscoverExpert, DiscoverMinnect } from "@/lib/discover"; import { useTheme } from "@/lib/use-theme"; import type { Theme } from "@/lib/theme"; import { BottomSheet } from "./BottomSheet"; import { DepthButton } from "./Buttons"; import { FeaturedCarousel } from "./FeaturedCarousel"; import { HexAvatar } from "./HexAvatar"; import { TrendingMinnectsRail } from "./TrendingMinnectsRail"; export type DiscoverPanel = "featured" | "trending" | "search"; /** Width of the center photo in the featured panel sheet. */ export const PANEL_CAROUSEL_SIZE = 150; /** "Name1, Name2 and N more" for the Featured experts row; shorter lists read plainly. */ export function featuredSubtitle(experts: Pick[]): string { const names = experts.map((e) => e.displayName || "Expert"); if (names.length === 0) return ""; if (names.length === 1) return names[0]; if (names.length === 2) return `${names[0]} and ${names[1]}`; return `${names[0]}, ${names[1]} and ${names.length - 2} more`; } function Chevron() { return ( ); } const icon = { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.7, strokeLinecap: "round", strokeLinejoin: "round" } as const; function FlameIcon() { return ( ); } function SearchIcon() { return ( ); } function MoonIcon() { return ( ); } function SunIcon() { return ( ); } /** The Dark/Light switch in the soft depth style; the choice persists through useTheme. */ export function AppearanceSwitch() { const { theme, setTheme } = useTheme(); const options: { value: Theme; label: string; icon: ReactNode }[] = [ { value: "dark", label: "Dark", icon: }, { value: "light", label: "Light", icon: }, ]; return (
{options.map((o) => ( ))}
); } export interface DiscoverSheetProps { experts: DiscoverExpert[]; onOpen: (panel: DiscoverPanel) => void; onClose: () => void; } export function DiscoverSheet({ experts, onOpen, onClose }: DiscoverSheetProps) { return ( {experts.length > 0 ? ( onOpen("featured")} leading={ } trailing={} /> ) : null} } trailing={} onClick={() => onOpen("trending")} /> } trailing={} onClick={() => onOpen("search")} /> Appearance ); } export interface DiscoverPanelSheetProps { panel: DiscoverPanel; experts: DiscoverExpert[]; trending: DiscoverMinnect[]; search?: ReactNode; onClose: () => void; } const TITLES: Record = { featured: "Featured experts", trending: "Trending minnects", search: "Find experts", }; /** One Discover panel as an 80% height sheet with a close button; reuses the desktop components. */ export function DiscoverPanelSheet({ panel, experts, trending, search, onClose }: DiscoverPanelSheetProps) { return ( {panel === "featured" ? : null} {panel === "trending" ? : null} {panel === "search" ? search : null} ); }