fix(channel): drop channel-constant sort options on the channel page

Subscribers and Channel-priority sorts are meaningless when the feed is scoped to one channel
(both are constant across its videos), so hide them there via a channelScoped flag on Feed.
The main feed keeps all sorts.
This commit is contained in:
npeter83 2026-06-30 04:37:00 +02:00
parent 78d81f81d0
commit c59b53a51b
2 changed files with 9 additions and 1 deletions

View file

@ -255,6 +255,7 @@ export default function ChannelPage({
onYtSearch={() => {}} onYtSearch={() => {}}
onExitYtSearch={() => {}} onExitYtSearch={() => {}}
onOpenChannel={onOpenChannel} onOpenChannel={onOpenChannel}
channelScoped
/> />
{!ch?.subscribed && nextToken && ( {!ch?.subscribed && nextToken && (
<div className="flex justify-center pb-6"> <div className="flex justify-center pb-6">

View file

@ -78,6 +78,7 @@ export default function Feed({
onYtSearch, onYtSearch,
onExitYtSearch, onExitYtSearch,
onOpenChannel, onOpenChannel,
channelScoped,
}: { }: {
filters: FeedFilters; filters: FeedFilters;
setFilters: (f: FeedFilters) => void; setFilters: (f: FeedFilters) => void;
@ -95,8 +96,14 @@ export default function Feed({
// Open a channel's dedicated page (from a card's channel name / avatar). Threaded down to // Open a channel's dedicated page (from a card's channel name / avatar). Threaded down to
// the cards via VirtualFeed. // the cards via VirtualFeed.
onOpenChannel?: (channelId: string, channelName?: string) => void; onOpenChannel?: (channelId: string, channelName?: string) => void;
// True when this feed is scoped to a single channel (the channel page). Drops sort options
// that are constant within one channel (subscribers, priority) — they'd be meaningless.
channelScoped?: boolean;
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
const sortKeys = channelScoped
? SORT_KEYS.filter((k) => k !== "subscribers" && k !== "priority")
: SORT_KEYS;
const [overrides, setOverrides] = useState<Record<string, string>>({}); const [overrides, setOverrides] = useState<Record<string, string>>({});
const [savedOverrides, setSavedOverrides] = useState<Record<string, boolean>>({}); const [savedOverrides, setSavedOverrides] = useState<Record<string, boolean>>({});
// The open player: which video and where to start (null = resume from saved position). // The open player: which video and where to start (null = resume from saved position).
@ -519,7 +526,7 @@ export default function Feed({
className="bg-card border border-border rounded-lg px-2 py-1.5 text-sm outline-none focus:border-accent" className="bg-card border border-border rounded-lg px-2 py-1.5 text-sm outline-none focus:border-accent"
> >
{/* Relevance only ranks meaningfully when there's a search term — offer it then. */} {/* Relevance only ranks meaningfully when there's a search term — offer it then. */}
{(filters.q.trim() ? (["relevance", ...SORT_KEYS] as SortKey[]) : SORT_KEYS).map((k) => ( {(filters.q.trim() ? (["relevance", ...sortKeys] as SortKey[]) : sortKeys).map((k) => (
<option key={k} value={k}> <option key={k} value={k}>
{t("feed.sortKey." + k)} {t("feed.sortKey." + k)}
</option> </option>