diff options
| author | haappi <74637670+haappi@users.noreply.github.com> | 2025-08-20 03:46:21 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-20 09:46:21 +0100 |
| commit | 2263c0fcd677d9deb68369c463b312a8b6ff4906 (patch) | |
| tree | 9419d51c0f2d8ac50a486f38f4c02cb2ba77727d /apps/web/components/dashboard/bookmarks | |
| parent | df6814f292f56aa0f650af3d093ba1ca7f159726 (diff) | |
| download | karakeep-2263c0fcd677d9deb68369c463b312a8b6ff4906.tar.zst | |
feat: Render human tags before AI tags (#1740)
Diffstat (limited to 'apps/web/components/dashboard/bookmarks')
| -rw-r--r-- | apps/web/components/dashboard/bookmarks/TagList.tsx | 32 | ||||
| -rw-r--r-- | apps/web/components/dashboard/bookmarks/TagsEditor.tsx | 13 |
2 files changed, 26 insertions, 19 deletions
diff --git a/apps/web/components/dashboard/bookmarks/TagList.tsx b/apps/web/components/dashboard/bookmarks/TagList.tsx index 593a269b..e8bed9eb 100644 --- a/apps/web/components/dashboard/bookmarks/TagList.tsx +++ b/apps/web/components/dashboard/bookmarks/TagList.tsx @@ -24,20 +24,24 @@ export default function TagList({ } return ( <> - {bookmark.tags.map((t) => ( - <div key={t.id} className={className}> - <Link - key={t.id} - className={cn( - badgeVariants({ variant: "secondary" }), - "text-nowrap font-light text-gray-700 hover:bg-foreground hover:text-secondary dark:text-gray-400", - )} - href={`/dashboard/tags/${t.id}`} - > - {t.name} - </Link> - </div> - ))} + {bookmark.tags + .sort((a, b) => + a.attachedBy === "ai" ? 1 : b.attachedBy === "ai" ? -1 : 0, + ) + .map((t) => ( + <div key={t.id} className={className}> + <Link + key={t.id} + className={cn( + badgeVariants({ variant: "secondary" }), + "text-nowrap font-light text-gray-700 hover:bg-foreground hover:text-secondary dark:text-gray-400", + )} + href={`/dashboard/tags/${t.id}`} + > + {t.name} + </Link> + </div> + ))} </> ); } diff --git a/apps/web/components/dashboard/bookmarks/TagsEditor.tsx b/apps/web/components/dashboard/bookmarks/TagsEditor.tsx index 5efdd0dd..1893c2a6 100644 --- a/apps/web/components/dashboard/bookmarks/TagsEditor.tsx +++ b/apps/web/components/dashboard/bookmarks/TagsEditor.tsx @@ -96,11 +96,14 @@ export function TagsEditor({ attachedBy: "human" as const, })) ?? [] } - value={optimisticTags.map((t) => ({ - label: t.name, - value: t.id, - attachedBy: t.attachedBy, - }))} + value={optimisticTags + .slice() + .sort((a) => (a.attachedBy === "human" ? -1 : 1)) + .map((t) => ({ + label: t.name, + value: t.id, + attachedBy: t.attachedBy, + }))} isMulti closeMenuOnSelect={false} isClearable={false} |
