fix(ui): address self-review findings (R13 S2c)

Three low-severity findings from the /code-review high self-pass:
- Plex duration: the "Any" chip no longer false-highlights when durationMin/Max
  hold a set-but-off-bucket value (stale/version-skew state) — it selects
  nothing then, matching the pre-sweep behaviour, instead of colliding on the
  empty-string sentinel.
- FilterChipGroup: count badge now guards on count > 0 (was `!= null`), matching
  the Tabs badge so a future count:0 can't render a stray "0" pill.
- Extract the shared CountBadge component; Tabs and FilterChipGroup now render
  the count-badge token from one source (was two near-identical inline spans).

gate green (tsc/eslint-0/vitest 136/knip/prettier). Duration self-E2E'd:
bucket select + Any toggle intact. Branch not merged.
This commit is contained in:
2026-08-15 01:37:05 +02:00
parent 9fdf274422
commit 80cdafdbfe
4 changed files with 25 additions and 19 deletions
+6 -1
View File
@@ -373,7 +373,12 @@ export default function PlexSidebar({ layout, setLayout, collapsed, onToggleColl
body: (
<FilterChipGroup
ariaLabel={t("plex.filter.duration")}
value={durBucketKey ?? ""}
// "Any" is selected only when there is genuinely no duration filter; a set-but-off-bucket
// duration (e.g. stale state after a bucket-boundary change) selects nothing, not "Any".
value={
durBucketKey ??
(filters.durationMin == null && filters.durationMax == null ? "" : "")
}
options={[
{ value: "", label: t("plex.filter.any") },
...DURATION_BUCKETS.map((b) => ({