This commit is contained in:
2026-02-07 00:44:52 -05:00
parent db74e20571
commit 46f9135776
4 changed files with 48 additions and 86 deletions

View File

@@ -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();

View File

@@ -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 (
<box
border
borderColor={theme.border}
onMouseDown={() => props.onSelect(props.tab.id)}
style={{
padding: 1,
backgroundColor: props.active ? theme.primary : "transparent",
}}
>
<text style={{ fg: theme.text }}>
{props.active ? "[" : " "}
{props.tab.label}
{props.active ? "]" : " "}
</text>
</box>
);
}

View File

@@ -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 (
<box style={{ flexDirection: "row", gap: 1 }}>
<Tab
tab={{ id: "feed", label: "Feed" }}
active={props.activeTab === "feed"}
onSelect={props.onTabSelect}
/>
<Tab
tab={{ id: "shows", label: "My Shows" }}
active={props.activeTab === "shows"}
onSelect={props.onTabSelect}
/>
<Tab
tab={{ id: "discover", label: "Discover" }}
active={props.activeTab === "discover"}
onSelect={props.onTabSelect}
/>
<Tab
tab={{ id: "search", label: "Search" }}
active={props.activeTab === "search"}
onSelect={props.onTabSelect}
/>
<Tab
tab={{ id: "player", label: "Player" }}
active={props.activeTab === "player"}
onSelect={props.onTabSelect}
/>
<Tab
tab={{ id: "settings", label: "Settings" }}
active={props.activeTab === "settings"}
onSelect={props.onTabSelect}
/>
<For each={tabs}>
{(tab) => (
<box
border
borderColor={theme.border}
onMouseDown={() => props.onTabSelect(tab.id)}
style={{
padding: 1,
backgroundColor:
tab.id == props.activeTab ? theme.primary : "transparent",
}}
>
<text style={{ fg: theme.text }}>
{tab.id == props.activeTab ? "[" : " "}
{tab.label}
{tab.id == props.activeTab ? "]" : " "}
</text>
</box>
)}
</For>
</box>
);
}
export type TabId =
| "feed"
| "shows"
| "discover"
| "search"
| "player"
| "settings";
export type TabDefinition = {
id: TabId;
label: string;
};