From d07f2c90065f53d36a3fc0e7db54c32d54a2a332 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Thu, 25 Apr 2024 20:15:15 +0100 Subject: feature(web): Add ability to rename, merge and fast delete tags. Fixes #105 (#125) * feature(web): Allow deleting tags from the all tags page * feature(web): Add ability to rename, merge and fast delete tags. Fixes #105 --- apps/web/app/dashboard/tags/[tagId]/page.tsx | 47 ++++++++++++++++++++++++++ apps/web/app/dashboard/tags/[tagName]/page.tsx | 38 --------------------- 2 files changed, 47 insertions(+), 38 deletions(-) create mode 100644 apps/web/app/dashboard/tags/[tagId]/page.tsx delete mode 100644 apps/web/app/dashboard/tags/[tagName]/page.tsx (limited to 'apps/web/app') diff --git a/apps/web/app/dashboard/tags/[tagId]/page.tsx b/apps/web/app/dashboard/tags/[tagId]/page.tsx new file mode 100644 index 00000000..f6e02a65 --- /dev/null +++ b/apps/web/app/dashboard/tags/[tagId]/page.tsx @@ -0,0 +1,47 @@ +import { notFound } from "next/navigation"; +import Bookmarks from "@/components/dashboard/bookmarks/Bookmarks"; +import EditableTagName from "@/components/dashboard/tags/EditableTagName"; +import { TagOptions } from "@/components/dashboard/tags/TagOptions"; +import { Button } from "@/components/ui/button"; +import { api } from "@/server/api/client"; +import { TRPCError } from "@trpc/server"; +import { MoreHorizontal } from "lucide-react"; + +export default async function TagPage({ + params, +}: { + params: { tagId: string }; +}) { + let tag; + try { + tag = await api.tags.get({ tagId: params.tagId }); + } catch (e) { + if (e instanceof TRPCError) { + if (e.code == "NOT_FOUND") { + notFound(); + } + } + throw e; + } + + return ( + + + + + + + + } + query={{ tagId: tag.id }} + showEditorCard={true} + /> + ); +} diff --git a/apps/web/app/dashboard/tags/[tagName]/page.tsx b/apps/web/app/dashboard/tags/[tagName]/page.tsx deleted file mode 100644 index b8bf351d..00000000 --- a/apps/web/app/dashboard/tags/[tagName]/page.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { notFound } from "next/navigation"; -import Bookmarks from "@/components/dashboard/bookmarks/Bookmarks"; -import DeleteTagButton from "@/components/dashboard/tags/DeleteTagButton"; -import { api } from "@/server/api/client"; -import { TRPCError } from "@trpc/server"; - -export default async function TagPage({ - params, -}: { - params: { tagName: string }; -}) { - const tagName = decodeURIComponent(params.tagName); - - let tag; - try { - tag = await api.tags.get({ tagName }); - } catch (e) { - if (e instanceof TRPCError) { - if (e.code == "NOT_FOUND") { - notFound(); - } - } - throw e; - } - - return ( - - {tagName} - - - } - query={{ tagId: tag.id }} - showEditorCard={true} - /> - ); -} -- cgit v1.2.3-70-g09d2