import { useSearch } from "@tanstack/react-router"; import { Tab, Tabs } from "baseui/tabs-motion"; import { HeadingSmall } from "baseui/typography"; import _ from "lodash"; import { Key, useEffect, useState } from "react"; import RecentTracks from "../overview/recenttracks"; import TopArtists from "../overview/topartists"; import TopTracks from "../overview/toptracks"; import Albums from "./albums"; export type LibraryProps = { activeKey?: string; }; function Library(props: LibraryProps) { const [activeKey, setActiveKey] = useState( _.get(props, "activeKey", "0"), ); const { tab } = useSearch({ strict: false }); console.log("tab", tab); useEffect(() => { if (!tab) { return; } setActiveKey(tab); }, [tab]); return ( <> Library { setActiveKey(activeKey); }} overrides={{ TabHighlight: { style: { backgroundColor: "var(--color-purple)", }, }, TabBorder: { style: { display: "none", }, }, }} activateOnFocus > ); } export default Library;