fix: keep Rating + Tags pills in their sections, only hide Flag in Discarded
Rated and Tags sections still benefit from their respective pill — Rating because the user can refine the section's ratingMin >= 1 to a higher floor, Tags because they can intersect the tag-grouped view with a specific tag id list. Flag in Discarded is the only pill where the section locks the only useful value, so it stays hidden there. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,14 +47,12 @@ export function FilterBar() {
|
|||||||
const tagIds = useFilterStore((s) => s.tagIds)
|
const tagIds = useFilterStore((s) => s.tagIds)
|
||||||
const currentSection = useFilterStore((s) => s.currentSection)
|
const currentSection = useFilterStore((s) => s.currentSection)
|
||||||
|
|
||||||
// Section-locked pills: each section has a preset filter that defines
|
// Only the Flag pill is hidden inside the Discarded section. Flag has
|
||||||
// it (Rated → ratingMin, Discarded → flag, Tags → groupBy=tag). The
|
// exactly two values and the section locks one of them, so the pill
|
||||||
// matching pill is hidden while you're inside that section because
|
// would only ever toggle the section off — useless. Rating + Tags
|
||||||
// toggling it would either be a no-op or break the section. The user
|
// pills stay visible in their sections because the user can refine
|
||||||
// can still navigate away to change the locked dimension.
|
// them further (ratingMin >= 3, restrict to specific tag ids).
|
||||||
const hideRatingPill = currentSection === 'rated'
|
|
||||||
const hideFlagPill = currentSection === 'discarded'
|
const hideFlagPill = currentSection === 'discarded'
|
||||||
const hideTagsPill = currentSection === 'tags'
|
|
||||||
|
|
||||||
const setDateFrom = useFilterStore((s) => s.setDateFrom)
|
const setDateFrom = useFilterStore((s) => s.setDateFrom)
|
||||||
const setDateTo = useFilterStore((s) => s.setDateTo)
|
const setDateTo = useFilterStore((s) => s.setDateTo)
|
||||||
@@ -226,40 +224,36 @@ export function FilterBar() {
|
|||||||
</div>
|
</div>
|
||||||
</FilterPill>
|
</FilterPill>
|
||||||
|
|
||||||
{/* Rating — hidden in the Rated section since the section already
|
{/* Rating */}
|
||||||
* pins ratingMin and the only useful tweak (ratingMin >= N) lives
|
<FilterPill
|
||||||
* in the section preset itself. */}
|
label="Rating"
|
||||||
{!hideRatingPill && (
|
value={ratingValue}
|
||||||
<FilterPill
|
isActive={ratingActive}
|
||||||
label="Rating"
|
onClear={() => setRatingMin(0)}
|
||||||
value={ratingValue}
|
>
|
||||||
isActive={ratingActive}
|
<div>
|
||||||
onClear={() => setRatingMin(0)}
|
<p className="mb-1 text-[11px] text-text-muted">Minimum</p>
|
||||||
>
|
<div className="flex gap-1">
|
||||||
<div>
|
{[1, 2, 3, 4, 5].map((n) => (
|
||||||
<p className="mb-1 text-[11px] text-text-muted">Minimum</p>
|
<button
|
||||||
<div className="flex gap-1">
|
key={n}
|
||||||
{[1, 2, 3, 4, 5].map((n) => (
|
onClick={() => setRatingMin(ratingMin === n ? 0 : n)}
|
||||||
<button
|
className="p-0.5"
|
||||||
key={n}
|
title={`At least ${n} star${n > 1 ? 's' : ''}`}
|
||||||
onClick={() => setRatingMin(ratingMin === n ? 0 : n)}
|
>
|
||||||
className="p-0.5"
|
<Star
|
||||||
title={`At least ${n} star${n > 1 ? 's' : ''}`}
|
className={clsx(
|
||||||
>
|
'h-5 w-5 transition-colors',
|
||||||
<Star
|
n <= ratingMin
|
||||||
className={clsx(
|
? 'fill-star text-star'
|
||||||
'h-5 w-5 transition-colors',
|
: 'text-text-muted hover:text-star'
|
||||||
n <= ratingMin
|
)}
|
||||||
? 'fill-star text-star'
|
/>
|
||||||
: 'text-text-muted hover:text-star'
|
</button>
|
||||||
)}
|
))}
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</FilterPill>
|
</div>
|
||||||
)}
|
</FilterPill>
|
||||||
|
|
||||||
{/* Color */}
|
{/* Color */}
|
||||||
<FilterPill
|
<FilterPill
|
||||||
@@ -332,10 +326,8 @@ export function FilterBar() {
|
|||||||
</FilterPill>
|
</FilterPill>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Tags — hidden in the Tags section since the section already
|
{/* Tags */}
|
||||||
* groups everything by tag and re-applying a tag filter on top
|
{allTags.length > 0 && (
|
||||||
* collapses the view to a single bucket. */}
|
|
||||||
{!hideTagsPill && allTags.length > 0 && (
|
|
||||||
<FilterPill
|
<FilterPill
|
||||||
label="Tags"
|
label="Tags"
|
||||||
value={tagValue}
|
value={tagValue}
|
||||||
|
|||||||
Reference in New Issue
Block a user