From 044659fd1ba2082491eed713dc72bafd696f0439 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sat, 6 Apr 2024 02:13:47 +0100 Subject: fix: Refresh the all tags page automatically when a tag is modified --- apps/web/app/dashboard/tags/page.tsx | 53 ++---------------------------------- 1 file changed, 3 insertions(+), 50 deletions(-) (limited to 'apps/web/app') diff --git a/apps/web/app/dashboard/tags/page.tsx b/apps/web/app/dashboard/tags/page.tsx index 9f5038e7..6caea513 100644 --- a/apps/web/app/dashboard/tags/page.tsx +++ b/apps/web/app/dashboard/tags/page.tsx @@ -1,62 +1,15 @@ -import Link from "next/link"; -import InfoTooltip from "@/components/ui/info-tooltip"; +import AllTagsView from "@/components/dashboard/tags/AllTagsView"; import { Separator } from "@/components/ui/separator"; import { api } from "@/server/api/client"; -function TagPill({ name, count }: { name: string; count: number }) { - return ( - - {name} {count} - - ); -} - export default async function TagsPage() { - let allTags = (await api.tags.list()).tags; - - // Sort tags by usage desc - allTags = allTags.sort((a, b) => b.count - a.count); - - const humanTags = allTags.filter((t) => (t.countAttachedBy.human ?? 0) > 0); - const aiTags = allTags.filter((t) => (t.countAttachedBy.human ?? 0) == 0); - - const tagsToPill = (tags: typeof allTags) => { - let tagPill; - if (tags.length) { - tagPill = tags.map((t) => ( - - )); - } else { - tagPill = "No Tags"; - } - return tagPill; - }; + const allTags = (await api.tags.list()).tags; return (
All Tags - - -

Your Tags

- -

Tags that were attached at least once by you

-
-
-
{tagsToPill(humanTags)}
- - - - -

AI Tags

- -

Tags that were only attached automatically (by AI)

-
-
-
{tagsToPill(aiTags)}
+
); } -- cgit v1.2.3-70-g09d2