Skip to content

Commit 683bf29

Browse files
committed
Sort tags alphabetically in sidebar and bookmark items
Changed TagSidebar to sort tags alphabetically instead of by count, and sort inline tag badges on BookmarkItem alphabetically. https://claude.ai/code/session_01D6FHtS8by1bg4beY2xV8Ce
1 parent 3f8e7be commit 683bf29

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

src/components/bookmarks/BookmarkItem.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export const BookmarkItem = forwardRef(function BookmarkItem(
146146
<span className="text-xs text-muted-foreground truncate flex-shrink-0 font-normal hidden md:inline">{domain}</span>
147147
{tags && tags.length > 0 && (
148148
<div className="items-center gap-1.5 flex-shrink-0 hidden md:flex">
149-
{tags.map((tag) => (
149+
{[...tags].sort((a, b) => a.localeCompare(b)).map((tag) => (
150150
<span
151151
key={tag}
152152
onClick={(e) => {

src/components/bookmarks/TagSidebar.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ export function TagSidebar({
3030

3131
const sortedTags = useMemo(() => {
3232
return Object.entries(tagCounts)
33-
.sort((a, b) => {
34-
if (b[1] !== a[1]) return b[1] - a[1]
35-
return a[0].localeCompare(b[0])
36-
})
33+
.sort((a, b) => a[0].localeCompare(b[0]))
3734
.map(([tag, count]) => ({ tag, count }))
3835
}, [tagCounts])
3936

0 commit comments

Comments
 (0)