import { useTranslation } from "react-i18next"; import SegmentedToggle from "../../components/ui/SegmentedToggle"; import type { PlexViewControls } from "./plexSubUrl"; // The Discover ⟷ Browse switch, hosted in the header next to the library-scope pill (All/Movies/Shows). // It reflects + drives PlexBrowse's top-level sub-view (`view`, from PlexHeader), and hides itself on // the deeper views (a show/info/person page has no Discover/Browse choice). export default function PlexViewToggle({ view: ctl }: { view: PlexViewControls }) { const { t } = useTranslation(); // Only the two title-browse views host the Discover/Browse choice; deeper views (show/info/person/…) // and the playlists/collections browse surfaces hide it. if (ctl.kind !== "discover" && ctl.kind !== "grid") return null; // The floating header wrapper is pointer-events-none (so clicks fall through its empty area to the // content below); every interactive child must re-enable pointer events or it is click-dead — the // sibling PlexScopeToggle does the same. return ( ctl.open(v === "discover" ? { kind: "discover" } : { kind: "grid" })} /> ); }