fix(plex,channels): address R13 S2 review findings
- Shared usePlexClearFilters hook replaces the duplicated clearAll (was copied in PlexBrowse and PlexSidebar) — one "reset every Plex narrowing" both call. - The Plex duration chip's minutes unit is localized (plex.filter.durationUnit: "min"/"perc") instead of a hardcoded "m". - The Plex collection chip falls back to the "Collection" label, not the raw rating_key id, when collectionTitle is missing. - Dropped the dead rowClassName that dimmed hidden rows in the subscribed table (hidden channels are excluded there now — they live in the Hidden tab). - Renamed the misleading `set` null-check predicate to `has`. Gate green: tsc/eslint-0/prettier/knip clean, vitest 106.
This commit is contained in:
@@ -3,7 +3,7 @@ import { qk } from "../lib/queryKeys";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { Layers, ListMusic, Plus, SlidersHorizontal, X } from "lucide-react";
|
||||
import { api, EMPTY_PLEX_FILTERS, plexFilterCount, type PlexFilters } from "../lib/api";
|
||||
import { api, plexFilterCount, type PlexFilters } from "../lib/api";
|
||||
import { healPlexSort, plexSortOptions, PLEX_SORT_FALLBACK } from "../lib/plexSort";
|
||||
import { defaultLayout, type PanelLayout } from "../lib/panelLayout";
|
||||
import { useDebounced } from "../lib/useDebounced";
|
||||
@@ -11,6 +11,7 @@ import { useScrollFade } from "../lib/useScrollFade";
|
||||
import SidePanel from "./SidePanel";
|
||||
import PanelGroups, { type PanelItem } from "./PanelGroups";
|
||||
import SortControl from "./SortControl";
|
||||
import { usePlexClearFilters } from "./usePlexActiveFilters";
|
||||
import { usePlex, usePlexActions } from "./PlexProvider";
|
||||
|
||||
// The Plex module's left filter column — now the shared floating SidePanel with its filter groups
|
||||
@@ -123,11 +124,7 @@ export default function PlexSidebar({ layout, setLayout, collapsed, onToggleColl
|
||||
const patch = (p: Partial<PlexFilters>) => setFilters({ ...filters, ...p });
|
||||
const toggleIn = (arr: string[], v: string) =>
|
||||
arr.includes(v) ? arr.filter((x) => x !== v) : [...arr, v];
|
||||
const clearAll = () => {
|
||||
setFilters(EMPTY_PLEX_FILTERS);
|
||||
setShow("all");
|
||||
setSort(PLEX_SORT_FALLBACK);
|
||||
};
|
||||
const clearAll = usePlexClearFilters();
|
||||
|
||||
const sortOptions = plexSortOptions(scope, (k) => t(`plex.sort.${k}`));
|
||||
const durBucketKey = DURATION_BUCKETS.find(
|
||||
|
||||
Reference in New Issue
Block a user