diff options
| author | MohamedBassem <me@mbassem.com> | 2024-03-17 15:38:03 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-03-17 15:38:03 +0000 |
| commit | 60467f1d7fdc63e8ec3b10ad0d183248cebac4ee (patch) | |
| tree | d94e78eddab8ea07c74ea4b18e7d0cf551591bc9 /apps/web/app | |
| parent | 19c67633956760096a49275a161f29ca2f6537c0 (diff) | |
| download | karakeep-60467f1d7fdc63e8ec3b10ad0d183248cebac4ee.tar.zst | |
feature(web): A better tags editor using react select with auto complete and auto create
Diffstat (limited to 'apps/web/app')
| -rw-r--r-- | apps/web/app/dashboard/tags/page.tsx | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/apps/web/app/dashboard/tags/page.tsx b/apps/web/app/dashboard/tags/page.tsx index 08acd968..dec11527 100644 --- a/apps/web/app/dashboard/tags/page.tsx +++ b/apps/web/app/dashboard/tags/page.tsx @@ -1,11 +1,8 @@ import Link from "next/link"; import { redirect } from "next/navigation"; import { Separator } from "@/components/ui/separator"; +import { api } from "@/server/api/client"; import { getServerAuthSession } from "@/server/auth"; -import { count, eq } from "drizzle-orm"; - -import { db } from "@hoarder/db"; -import { bookmarkTags, tagsOnBookmarks } from "@hoarder/db/schema"; function TagPill({ name, count }: { name: string; count: number }) { return ( @@ -24,16 +21,7 @@ export default async function TagsPage() { redirect("/"); } - let tags = await db - .select({ - id: tagsOnBookmarks.tagId, - name: bookmarkTags.name, - count: count(), - }) - .from(tagsOnBookmarks) - .where(eq(bookmarkTags.userId, session.user.id)) - .groupBy(tagsOnBookmarks.tagId) - .innerJoin(bookmarkTags, eq(bookmarkTags.id, tagsOnBookmarks.tagId)); + let tags = (await api.tags.list()).tags; // Sort tags by usage desc tags = tags.sort((a, b) => b.count - a.count); |
