show applied tags first in tag selector picker

Applied tags are now pinned to the front of each category's tag list,
with unapplied tags continuing in usage order behind them. Both
partitions preserve the existing usage-sort from the API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Garret Patti
2026-04-12 20:58:12 -04:00
parent b0d146679f
commit 89ac22e9d1

View File

@@ -298,9 +298,13 @@ export default function TagSelector({ itemKey, onTagsChanged, refreshKey }: Prop
{all.categories.map((category) => { {all.categories.map((category) => {
const categoryTags = all.tags.filter((t) => t.categoryId === category.id) const categoryTags = all.tags.filter((t) => t.categoryId === category.id)
const search = categorySearches[category.id] ?? '' const search = categorySearches[category.id] ?? ''
const visibleTags = categoryTags const filtered = categoryTags.filter(
.filter((t) => !search || t.name.toLowerCase().includes(search.toLowerCase())) (t) => !search || t.name.toLowerCase().includes(search.toLowerCase())
.slice(0, 25) )
const visibleTags = [
...filtered.filter((t) => isAssigned(t.id)),
...filtered.filter((t) => !isAssigned(t.id)),
].slice(0, 25)
return ( return (
<div key={category.id}> <div key={category.id}>