using presets

This commit is contained in:
2026-02-12 09:27:49 -05:00
parent 276732d2a9
commit 0bbb327b29
8 changed files with 259 additions and 271 deletions

View File

@@ -37,6 +37,7 @@ export function TabNavigation(props: TabNavigationProps) {
> >
<SelectableText <SelectableText
selected={() => tab.id == props.activeTab} selected={() => tab.id == props.activeTab}
primary
alignSelf="center" alignSelf="center"
> >
{tab.label} {tab.label}

View File

@@ -68,7 +68,7 @@ export function DiscoverPage(props: PageProps) {
> >
<SelectableText <SelectableText
selected={isSelected} selected={isSelected}
fg={theme.primary} primary
> >
{category.icon} {category.name} {category.icon} {category.name}
</SelectableText> </SelectableText>
@@ -85,14 +85,15 @@ export function DiscoverPage(props: PageProps) {
borderColor={theme.border} borderColor={theme.border}
> >
<box padding={1}> <box padding={1}>
<text <SelectableText
fg={props.depth() == DiscoverPagePaneType.SHOWS ? theme.primary : theme.textMuted} selected={() => false}
primary={props.depth() == DiscoverPagePaneType.SHOWS}
> >
Trending in{" "} Trending in{" "}
{DISCOVER_CATEGORIES.find( {DISCOVER_CATEGORIES.find(
(c) => c.id === discoverStore.selectedCategory(), (c) => c.id === discoverStore.selectedCategory(),
)?.name ?? "All"} )?.name ?? "All"}
</text> </SelectableText>
</box> </box>
<box flexDirection="column" height="100%"> <box flexDirection="column" height="100%">
<Show <Show

View File

@@ -86,54 +86,54 @@ export function FeedDetail(props: FeedDetailProps) {
{/* Header with back button */} {/* Header with back button */}
<box flexDirection="row" justifyContent="space-between"> <box flexDirection="row" justifyContent="space-between">
<box border padding={0} onMouseDown={props.onBack} borderColor={theme.border}> <box border padding={0} onMouseDown={props.onBack} borderColor={theme.border}>
<text fg={theme.primary}>[Esc] Back</text> <SelectableText selected={() => false} primary>[Esc] Back</SelectableText>
</box> </box>
<box border padding={0} onMouseDown={() => setShowInfo((v) => !v)} borderColor={theme.border}> <box border padding={0} onMouseDown={() => setShowInfo((v) => !v)} borderColor={theme.border}>
<text fg={theme.primary}>[i] {showInfo() ? "Hide" : "Show"} Info</text> <SelectableText selected={() => false} primary>[i] {showInfo() ? "Hide" : "Show"} Info</SelectableText>
</box> </box>
</box> </box>
{/* Podcast info section */} {/* Podcast info section */}
<Show when={showInfo()}> <Show when={showInfo()}>
<box border padding={1} flexDirection="column" gap={0} borderColor={theme.border}> <box border padding={1} flexDirection="column" gap={0} borderColor={theme.border}>
<text fg={theme.text}> <SelectableText selected={() => false} primary>
<strong>{props.feed.customName || props.feed.podcast.title}</strong> <strong>{props.feed.customName || props.feed.podcast.title}</strong>
</text> </SelectableText>
{props.feed.podcast.author && ( {props.feed.podcast.author && (
<box flexDirection="row" gap={1}> <box flexDirection="row" gap={1}>
<text fg={theme.textMuted}>by</text> <SelectableText selected={() => false} tertiary>by</SelectableText>
<text fg={theme.primary}>{props.feed.podcast.author}</text> <SelectableText selected={() => false} primary>{props.feed.podcast.author}</SelectableText>
</box> </box>
)} )}
<box height={1} /> <box height={1} />
<text fg={theme.textMuted}> <SelectableText selected={() => false} tertiary>
{props.feed.podcast.description?.slice(0, 200)} {props.feed.podcast.description?.slice(0, 200)}
{(props.feed.podcast.description?.length || 0) > 200 ? "..." : ""} {(props.feed.podcast.description?.length || 0) > 200 ? "..." : ""}
</text> </SelectableText>
<box height={1} /> <box height={1} />
<box flexDirection="row" gap={2}> <box flexDirection="row" gap={2}>
<box flexDirection="row" gap={1}> <box flexDirection="row" gap={1}>
<text fg={theme.textMuted}>Episodes:</text> <SelectableText selected={() => false} tertiary>Episodes:</SelectableText>
<text fg={theme.text}>{props.feed.episodes.length}</text> <SelectableText selected={() => false} tertiary>{props.feed.episodes.length}</SelectableText>
</box> </box>
<box flexDirection="row" gap={1}> <box flexDirection="row" gap={1}>
<text fg={theme.textMuted}>Updated:</text> <SelectableText selected={() => false} tertiary>Updated:</SelectableText>
<text fg={theme.text}>{formatDate(props.feed.lastUpdated)}</text> <SelectableText selected={() => false} tertiary>{formatDate(props.feed.lastUpdated)}</SelectableText>
</box> </box>
<text fg={props.feed.visibility === "public" ? theme.success : theme.warning}> <SelectableText selected={() => false} tertiary>
{props.feed.visibility === "public" ? "[Public]" : "[Private]"} {props.feed.visibility === "public" ? "[Public]" : "[Private]"}
</text> </SelectableText>
{props.feed.isPinned && <text fg={theme.warning}>[Pinned]</text>} {props.feed.isPinned && <SelectableText selected={() => false} tertiary>[Pinned]</SelectableText>}
</box> </box>
</box> </box>
</Show> </Show>
{/* Episodes header */} {/* Episodes header */}
<box flexDirection="row" justifyContent="space-between"> <box flexDirection="row" justifyContent="space-between">
<text fg={theme.text}> <SelectableText selected={() => false} primary>
<strong>Episodes</strong> <strong>Episodes</strong>
</text> </SelectableText>
<text fg={theme.textMuted}>({episodes().length} total)</text> <SelectableText selected={() => false} tertiary>({episodes().length} total)</SelectableText>
</box> </box>
{/* Episode list */} {/* Episode list */}
@@ -154,20 +154,20 @@ export function FeedDetail(props: FeedDetailProps) {
> >
<SelectableText <SelectableText
selected={() => index() === selectedIndex()} selected={() => index() === selectedIndex()}
fg={theme.primary} primary
> >
{index() === selectedIndex() ? ">" : " "} {index() === selectedIndex() ? ">" : " "}
</SelectableText> </SelectableText>
<SelectableText <SelectableText
selected={() => index() === selectedIndex()} selected={() => index() === selectedIndex()}
fg={theme.text} primary
> >
{episode.episodeNumber ? `#${episode.episodeNumber} - ` : ""} {episode.episodeNumber ? `#${episode.episodeNumber} - ` : ""}
{episode.title} {episode.title}
</SelectableText> </SelectableText>
<box flexDirection="row" gap={2} paddingLeft={2}> <box flexDirection="row" gap={2} paddingLeft={2}>
<text fg={theme.textMuted}>{formatDate(episode.pubDate)}</text> <SelectableText selected={() => index() === selectedIndex()} tertiary>{formatDate(episode.pubDate)}</SelectableText>
<text fg={theme.textMuted}>{formatDuration(episode.duration)}</text> <SelectableText selected={() => index() === selectedIndex()} tertiary>{formatDuration(episode.duration)}</SelectableText>
</box> </box>
</SelectableBox> </SelectableBox>
)} )}

View File

@@ -11,6 +11,7 @@ import type { Feed } from "@/types/feed";
import { useTheme } from "@/context/ThemeContext"; import { useTheme } from "@/context/ThemeContext";
import { PageProps } from "@/App"; import { PageProps } from "@/App";
import { SelectableBox, SelectableText } from "@/components/Selectable"; import { SelectableBox, SelectableText } from "@/components/Selectable";
import { se } from "date-fns/locale";
enum FeedPaneType { enum FeedPaneType {
FEED = 1, FEED = 1,
@@ -77,14 +78,29 @@ export function FeedPage(props: PageProps) {
} }
> >
<scrollbox height="100%" focused={props.depth() == FeedPaneType.FEED}> <scrollbox height="100%" focused={props.depth() == FeedPaneType.FEED}>
<For each={Object.entries(episodesByDate()).sort(([a], [b]) => b.localeCompare(a))}> <For
{([date, episode], groupIndex) => ( each={Object.entries(episodesByDate()).sort(([a], [b]) =>
b.localeCompare(a),
)}
>
{([date, episode], groupIndex) => {
const selected = () => groupIndex() === selectedIndex();
return (
<> <>
<box flexDirection="column" gap={0} paddingLeft={1} paddingRight={1} paddingTop={1} paddingBottom={1}> <box
<SelectableText selected={() => false} primary>{date}</SelectableText> flexDirection="column"
gap={0}
paddingLeft={1}
paddingRight={1}
paddingTop={1}
paddingBottom={1}
>
<SelectableText selected={() => false} primary>
{date}
</SelectableText>
</box> </box>
<SelectableBox <SelectableBox
selected={() => groupIndex() === selectedIndex()} selected={selected}
flexDirection="column" flexDirection="column"
gap={0} gap={0}
paddingLeft={1} paddingLeft={1}
@@ -93,29 +109,27 @@ export function FeedPage(props: PageProps) {
paddingBottom={0} paddingBottom={0}
onMouseDown={() => setSelectedIndex(groupIndex())} onMouseDown={() => setSelectedIndex(groupIndex())}
> >
<SelectableText selected={() => groupIndex() === selectedIndex()} primary> <SelectableText selected={selected} primary>
{groupIndex() === selectedIndex() ? ">" : " "} {selected() ? ">" : " "}
</SelectableText> </SelectableText>
<SelectableText <SelectableText selected={selected} primary>
selected={() => groupIndex() === selectedIndex()}
primary
>
{episode.episode.title} {episode.episode.title}
</SelectableText> </SelectableText>
<box flexDirection="row" gap={2} paddingLeft={2}> <box flexDirection="row" gap={2} paddingLeft={2}>
<SelectableText selected={() => groupIndex() === selectedIndex()} primary> <SelectableText selected={selected} primary>
{episode.feed.podcast.title} {episode.feed.podcast.title}
</SelectableText> </SelectableText>
<SelectableText selected={() => groupIndex() === selectedIndex()} tertiary> <SelectableText selected={selected} tertiary>
{formatDate(episode.episode.pubDate)} {formatDate(episode.episode.pubDate)}
</SelectableText> </SelectableText>
<SelectableText selected={() => groupIndex() === selectedIndex()} tertiary> <SelectableText selected={selected} tertiary>
{formatDuration(episode.episode.duration)} {formatDuration(episode.episode.duration)}
</SelectableText> </SelectableText>
</box> </box>
</SelectableBox> </SelectableBox>
</> </>
)} );
}}
</For> </For>
</scrollbox> </scrollbox>
</Show> </Show>

View File

@@ -48,7 +48,7 @@ export function ResultCard(props: ResultCardProps) {
<Show when={podcast().author}> <Show when={podcast().author}>
<SelectableText <SelectableText
selected={() => props.selected} selected={() => props.selected}
fg={theme.textMuted} tertiary
> >
by {podcast().author} by {podcast().author}
</SelectableText> </SelectableText>
@@ -58,7 +58,7 @@ export function ResultCard(props: ResultCardProps) {
{(description) => ( {(description) => (
<SelectableText <SelectableText
selected={() => props.selected} selected={() => props.selected}
fg={theme.text} tertiary
> >
{description().length > 120 {description().length > 120
? description().slice(0, 120) + "..." ? description().slice(0, 120) + "..."

View File

@@ -64,13 +64,13 @@ export function SearchHistory(props: SearchHistoryProps) {
> >
<SelectableText <SelectableText
selected={isSelected} selected={isSelected}
fg={theme.textMuted} tertiary
> >
{">"} {">"}
</SelectableText> </SelectableText>
<SelectableText <SelectableText
selected={isSelected} selected={isSelected}
fg={theme.primary} primary
> >
{query} {query}
</SelectableText> </SelectableText>

View File

@@ -198,20 +198,17 @@ export function SourceManager(props: SourceManagerProps) {
feedStore.toggleSource(source.id); feedStore.toggleSource(source.id);
}} }}
> >
<text <SelectableText
fg={ selected={() => focusArea() === "list" && index() === selectedIndex()}
focusArea() === "list" && index() === selectedIndex() primary
? theme.primary
: theme.textMuted
}
> >
{focusArea() === "list" && index() === selectedIndex() {focusArea() === "list" && index() === selectedIndex()
? ">" ? ">"
: " "} : " "}
</text> </SelectableText>
<SelectableText <SelectableText
selected={() => focusArea() === "list" && index() === selectedIndex()} selected={() => focusArea() === "list" && index() === selectedIndex()}
fg={theme.text} primary
> >
{source.name} {source.name}
</SelectableText> </SelectableText>
@@ -225,11 +222,11 @@ export function SourceManager(props: SourceManagerProps) {
{/* API settings */} {/* API settings */}
<box flexDirection="column" gap={1}> <box flexDirection="column" gap={1}>
<text fg={isApiSource() ? theme.textMuted : theme.accent}> <SelectableText selected={() => false} primary={isApiSource()}>
{isApiSource() {isApiSource()
? "API Settings" ? "API Settings"
: "API Settings (select an API source)"} : "API Settings (select an API source)"}
</text> </SelectableText>
<box flexDirection="row" gap={2}> <box flexDirection="row" gap={2}>
<box <box
border border
@@ -239,11 +236,9 @@ export function SourceManager(props: SourceManagerProps) {
focusArea() === "country" ? theme.primary : undefined focusArea() === "country" ? theme.primary : undefined
} }
> >
<text <SelectableText selected={() => false} primary={focusArea() === "country"}>
fg={focusArea() === "country" ? theme.primary : theme.textMuted}
>
Country: {sourceCountry()} Country: {sourceCountry()}
</text> </SelectableText>
</box> </box>
<box <box
border border
@@ -253,14 +248,10 @@ export function SourceManager(props: SourceManagerProps) {
focusArea() === "language" ? theme.primary : undefined focusArea() === "language" ? theme.primary : undefined
} }
> >
<text <SelectableText selected={() => false} primary={focusArea() === "language"}>
fg={
focusArea() === "language" ? theme.primary : theme.textMuted
}
>
Language:{" "} Language:{" "}
{sourceLanguage() === "ja_jp" ? "Japanese" : "English"} {sourceLanguage() === "ja_jp" ? "Japanese" : "English"}
</text> </SelectableText>
</box> </box>
<box <box
border border
@@ -270,35 +261,25 @@ export function SourceManager(props: SourceManagerProps) {
focusArea() === "explicit" ? theme.primary : undefined focusArea() === "explicit" ? theme.primary : undefined
} }
> >
<text <SelectableText selected={() => false} primary={focusArea() === "explicit"}>
fg={
focusArea() === "explicit" ? theme.primary : theme.textMuted
}
>
Explicit: {sourceExplicit() ? "Yes" : "No"} Explicit: {sourceExplicit() ? "Yes" : "No"}
</text> </SelectableText>
</box> </box>
</box> </box>
<text fg={theme.textMuted}> <SelectableText selected={() => false} tertiary>
Enter/Space to toggle focused setting Enter/Space to toggle focused setting
</text> </SelectableText>
</box> </box>
</box> </box>
{/* Add new source form */} {/* Add new source form */}
<box border borderColor={theme.border} padding={1} flexDirection="column" gap={1}> <box border borderColor={theme.border} padding={1} flexDirection="column" gap={1}>
<text <SelectableText selected={() => false} primary={focusArea() === "add" || focusArea() === "url"}>
fg={
focusArea() === "add" || focusArea() === "url"
? theme.primary
: theme.textMuted
}
>
Add New Source: Add New Source:
</text> </SelectableText>
<box flexDirection="row" gap={1}> <box flexDirection="row" gap={1}>
<text fg={theme.textMuted}>Name:</text> <SelectableText selected={() => false} tertiary>Name:</SelectableText>
<input <input
value={newSourceName()} value={newSourceName()}
onInput={setNewSourceName} onInput={setNewSourceName}
@@ -309,7 +290,7 @@ export function SourceManager(props: SourceManagerProps) {
</box> </box>
<box flexDirection="row" gap={1}> <box flexDirection="row" gap={1}>
<text fg={theme.textMuted}>URL:</text> <SelectableText selected={() => false} tertiary>URL:</SelectableText>
<input <input
value={newSourceUrl()} value={newSourceUrl()}
onInput={(v) => { onInput={(v) => {
@@ -323,14 +304,14 @@ export function SourceManager(props: SourceManagerProps) {
</box> </box>
<box border borderColor={theme.border} padding={0} width={15} onMouseDown={handleAddSource}> <box border borderColor={theme.border} padding={0} width={15} onMouseDown={handleAddSource}>
<text fg={theme.success}>[+] Add Source</text> <SelectableText selected={() => false} primary>[+] Add Source</SelectableText>
</box> </box>
</box> </box>
{/* Error message */} {/* Error message */}
{error() && <text fg={theme.error}>{error()}</text>} {error() && <SelectableText selected={() => false} tertiary>{error()}</SelectableText>}
<text fg={theme.textMuted}>Tab to switch sections, Esc to close</text> <SelectableText selected={() => false} tertiary>Tab to switch sections, Esc to close</SelectableText>
</box> </box>
); );
} }

View File

@@ -298,23 +298,14 @@ function CommandDialog(props: {
<box flexDirection="column" flexGrow={1}> <box flexDirection="column" flexGrow={1}>
<SelectableText <SelectableText
selected={() => index() === selectedIndex()} selected={() => index() === selectedIndex()}
fg={ primary
index() === selectedIndex()
? theme.selectedListItemText
: theme.text
}
attributes={
index() === selectedIndex()
? TextAttributes.BOLD
: undefined
}
> >
{option.title} {option.title}
</SelectableText> </SelectableText>
<Show when={option.footer}> <Show when={option.footer}>
<SelectableText <SelectableText
selected={() => index() === selectedIndex()} selected={() => index() === selectedIndex()}
fg={theme.textMuted} tertiary
> >
{option.footer} {option.footer}
</SelectableText> </SelectableText>
@@ -322,7 +313,7 @@ function CommandDialog(props: {
<Show when={option.description}> <Show when={option.description}>
<SelectableText <SelectableText
selected={() => index() === selectedIndex()} selected={() => index() === selectedIndex()}
fg={theme.textMuted} tertiary
> >
{option.description} {option.description}
</SelectableText> </SelectableText>