Skip to content

Commit c90e0f8

Browse files
authored
Merge pull request #43 from pheuberger/claude/sort-tags-alphabetically-ihsQ2
Sort tags alphabetically instead of by frequency
2 parents 3f8e7be + 683bf29 commit c90e0f8

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)