diff --git a/src/pages/MyShows/MyShowsPage.tsx b/src/pages/MyShows/MyShowsPage.tsx index 643b595..4a83f5c 100644 --- a/src/pages/MyShows/MyShowsPage.tsx +++ b/src/pages/MyShows/MyShowsPage.tsx @@ -13,6 +13,7 @@ import { format } from "date-fns"; import type { Episode } from "@/types/episode"; import type { Feed } from "@/types/feed"; import { PageProps } from "@/App"; +import { useTheme } from "@/context/ThemeContext"; enum MyShowsPaneType { SHOWS = 1, @@ -27,6 +28,8 @@ export function MyShowsPage(props: PageProps) { const [showIndex, setShowIndex] = createSignal(0); const [episodeIndex, setEpisodeIndex] = createSignal(0); const [isRefreshing, setIsRefreshing] = createSignal(false); + const { theme } = useTheme(); + const mutedColor = () => theme.muted || theme.text; /** Threshold: load more when within this many items of the end */ const LOAD_MORE_THRESHOLD = 5; @@ -94,23 +97,6 @@ export function MyShowsPage(props: PageProps) { } }; - /** Get download status color */ - const downloadColor = (episodeId: string): string => { - const status = downloadStore.getDownloadStatus(episodeId); - switch (status) { - case DownloadStatus.QUEUED: - return "yellow"; - case DownloadStatus.DOWNLOADING: - return "cyan"; - case DownloadStatus.COMPLETED: - return "green"; - case DownloadStatus.FAILED: - return "red"; - default: - return "gray"; - } - }; - const handleRefresh = async () => { const show = selectedShow(); if (!show) return; @@ -127,17 +113,34 @@ export function MyShowsPage(props: PageProps) { setEpisodeIndex(0); }; + /** Get download status color */ + const downloadColor = (episodeId: string): string => { + const status = downloadStore.getDownloadStatus(episodeId); + switch (status) { + case DownloadStatus.QUEUED: + return theme.warning.toString(); + case DownloadStatus.DOWNLOADING: + return theme.primary.toString(); + case DownloadStatus.COMPLETED: + return theme.success.toString(); + case DownloadStatus.FAILED: + return theme.error.toString(); + default: + return mutedColor().toString(); + } + }; + return ( - Refreshing... + Refreshing... 0} fallback={ - + No shows yet. Subscribe from Discover or Search. @@ -154,19 +157,19 @@ export function MyShowsPage(props: PageProps) { gap={1} paddingLeft={1} paddingRight={1} - backgroundColor={index() === showIndex() ? "#333" : undefined} + backgroundColor={index() === showIndex() ? theme.primary : undefined} onMouseDown={() => { setShowIndex(index()); setEpisodeIndex(0); }} > - + {index() === showIndex() ? ">" : " "} - + {feed.customName || feed.podcast.title} - ({feed.episodes.length}) + ({feed.episodes.length}) )} @@ -174,82 +177,82 @@ export function MyShowsPage(props: PageProps) { - - Select a show - - } - > - 0} - fallback={ - - No episodes. Press [r] to refresh. - - } - > - - - {(episode, index) => ( - setEpisodeIndex(index())} - > - - - {index() === episodeIndex() ? ">" : " "} - - - {episode.episodeNumber - ? `#${episode.episodeNumber} ` - : ""} - {episode.title} - - - - {formatDate(episode.pubDate)} - {formatDuration(episode.duration)} - - - {downloadLabel(episode.id)} - - - - - )} - - - - Loading more episodes... + + Select a show - + } + > 0} + fallback={ + + No episodes. Press [r] to refresh. + } > - - Scroll down for more episodes - + + + {(episode, index) => ( + setEpisodeIndex(index())} + > + + + {index() === episodeIndex() ? ">" : " "} + + + {episode.episodeNumber + ? `#${episode.episodeNumber} ` + : ""} + {episode.title} + + + + {formatDate(episode.pubDate)} + {formatDuration(episode.duration)} + + + {downloadLabel(episode.id)} + + + + + )} + + + + Loading more episodes... + + + + + Scroll down for more episodes + + + - - - + ); diff --git a/src/pages/Player/PlayerPage.tsx b/src/pages/Player/PlayerPage.tsx index ee01328..f322c85 100644 --- a/src/pages/Player/PlayerPage.tsx +++ b/src/pages/Player/PlayerPage.tsx @@ -3,6 +3,7 @@ import { PlaybackControls } from "./PlaybackControls"; import { RealtimeWaveform } from "./RealtimeWaveform"; import { useAudio } from "@/hooks/useAudio"; import { useAppStore } from "@/stores/app"; +import { useTheme } from "@/context/ThemeContext"; enum PlayerPaneType { PLAYER = 1, @@ -11,6 +12,7 @@ export const PlayerPaneCount = 1; export function PlayerPage(props: PageProps) { const audio = useAudio(); + const { theme } = useTheme(); const progressPercent = () => { const d = audio.duration(); @@ -30,19 +32,19 @@ export function PlayerPage(props: PageProps) { Now Playing - + {formatTime(audio.position())} / {formatTime(audio.duration())} ( {progressPercent()}%) - {audio.error() && {audio.error()}} + {audio.error() && {audio.error()}} - + {audio.currentEpisode()?.title} - {audio.currentEpisode()?.description} + {audio.currentEpisode()?.description} { diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 7336d6d..c727bd9 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -10,6 +10,7 @@ import { SearchHistory } from "./SearchHistory"; import type { SearchResult } from "@/types/source"; import { PageProps } from "@/App"; import { MyShowsPage } from "../MyShows/MyShowsPage"; +import { useTheme } from "@/context/ThemeContext"; enum SearchPaneType { INPUT = 1, @@ -23,6 +24,7 @@ export function SearchPage(props: PageProps) { const [inputValue, setInputValue] = createSignal(""); const [resultIndex, setResultIndex] = createSignal(0); const [historyIndex, setHistoryIndex] = createSignal(0); + const { theme } = useTheme(); // Keep parent informed about input focus state // TODO: have a global input focused prop in useKeyboard hook @@ -83,42 +85,42 @@ export function SearchPage(props: PageProps) { paddingRight={1} onMouseDown={handleSearch} > - [Enter] Search + [Enter] Search {/* Status */} - Searching... + Searching... - {searchStore.error()} + {searchStore.error()} - {/* Main Content - Results or History */} - - {/* Results Panel */} - - - + {/* Results Panel */} + + + + Results ({searchStore.results().length}) + + + 0} + fallback={ + + + {searchStore.query() + ? "No results found" + : "Enter a search term to find podcasts"} + + + } > - Results ({searchStore.results().length}) - - - 0} - fallback={ - - - {searchStore.query() - ? "No results found" - : "Enter a search term to find podcasts"} - - - } - > History