diff --git a/src/App.tsx b/src/App.tsx index d006a36..3d6f565 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ import { createSignal, createMemo, ErrorBoundary } from "solid-js"; import { useSelectionHandler } from "@opentui/solid"; -import { Layout } from "./components/Layout"; +import { Layout } from "./Layout"; import { TabNavigation } from "./components/TabNavigation"; import { FeedPage } from "@/tabs/Feed/FeedPage"; import { MyShowsPage } from "@/tabs/MyShows/MyShowsPage"; @@ -14,7 +14,6 @@ import { Player } from "@/tabs/Player/Player"; import { SettingsScreen } from "@/tabs/Settings/SettingsScreen"; import { useAuthStore } from "@/stores/auth"; import { useFeedStore } from "@/stores/feed"; -import { useAppStore } from "@/stores/app"; import { useAudio } from "@/hooks/useAudio"; import { useMultimediaKeys } from "@/hooks/useMultimediaKeys"; import { FeedVisibility } from "@/types/feed"; @@ -34,7 +33,6 @@ export function App() { const [layerDepth, setLayerDepth] = createSignal(0); const auth = useAuthStore(); const feedStore = useFeedStore(); - const appStore = useAppStore(); const audio = useAudio(); const toast = useToast(); const renderer = useRenderer(); diff --git a/src/components/Layout.tsx b/src/Layout.tsx similarity index 100% rename from src/components/Layout.tsx rename to src/Layout.tsx diff --git a/src/components/Tab.tsx b/src/components/Tab.tsx deleted file mode 100644 index f2d384d..0000000 --- a/src/components/Tab.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { useTheme } from "@/context/ThemeContext"; - -export type TabId = - | "feed" - | "shows" - | "discover" - | "search" - | "player" - | "settings"; - -export type TabDefinition = { - id: TabId; - label: string; -}; - -export const tabs: TabDefinition[] = [ - { id: "feed", label: "Feed" }, - { id: "shows", label: "My Shows" }, - { id: "discover", label: "Discover" }, - { id: "search", label: "Search" }, - { id: "player", label: "Player" }, - { id: "settings", label: "Settings" }, -]; - -type TabProps = { - tab: TabDefinition; - active: boolean; - onSelect: (tab: TabId) => void; -}; - -export function Tab(props: TabProps) { - const { theme } = useTheme(); - return ( - props.onSelect(props.tab.id)} - style={{ - padding: 1, - backgroundColor: props.active ? theme.primary : "transparent", - }} - > - - {props.active ? "[" : " "} - {props.tab.label} - {props.active ? "]" : " "} - - - ); -} diff --git a/src/components/TabNavigation.tsx b/src/components/TabNavigation.tsx index 45e387e..b43534d 100644 --- a/src/components/TabNavigation.tsx +++ b/src/components/TabNavigation.tsx @@ -1,43 +1,57 @@ -import { Tab, type TabId } from "./Tab"; +import { useTheme } from "@/context/ThemeContext"; +import { For } from "solid-js"; -type TabNavigationProps = { +interface TabNavigationProps { activeTab: TabId; onTabSelect: (tab: TabId) => void; -}; +} + +export const tabs: TabDefinition[] = [ + { id: "feed", label: "Feed" }, + { id: "shows", label: "My Shows" }, + { id: "discover", label: "Discover" }, + { id: "search", label: "Search" }, + { id: "player", label: "Player" }, + { id: "settings", label: "Settings" }, +]; export function TabNavigation(props: TabNavigationProps) { + const { theme } = useTheme(); return ( - - - - - - + + {(tab) => ( + props.onTabSelect(tab.id)} + style={{ + padding: 1, + backgroundColor: + tab.id == props.activeTab ? theme.primary : "transparent", + }} + > + + {tab.id == props.activeTab ? "[" : " "} + {tab.label} + {tab.id == props.activeTab ? "]" : " "} + + + )} + ); } + +export type TabId = + | "feed" + | "shows" + | "discover" + | "search" + | "player" + | "settings"; + +export type TabDefinition = { + id: TabId; + label: string; +};