From 820b7e655a670cf8b8e3f7ad8bb1eb487ee20405 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 14 Sep 2025 10:37:36 +0100 Subject: feat: Add Create Tag button to tags page (#1942) * feat: add Create Tag button to tags page - Added useCreateTag hook to shared-react/hooks/tags.ts - Created CreateTagModal component for tag creation without bookmark attachment - Added Create Tag button to AllTagsView component - Added necessary translation keys for the new feature Fixes #1937 Co-authored-by: Mohamed Bassem * format * localize toasts --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Mohamed Bassem --- packages/shared-react/hooks/tags.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'packages/shared-react/hooks') diff --git a/packages/shared-react/hooks/tags.ts b/packages/shared-react/hooks/tags.ts index 6ce0f0c9..bbbe3d0e 100644 --- a/packages/shared-react/hooks/tags.ts +++ b/packages/shared-react/hooks/tags.ts @@ -1,5 +1,19 @@ import { api } from "../trpc"; +export function useCreateTag( + ...opts: Parameters +) { + const apiUtils = api.useUtils(); + + return api.tags.create.useMutation({ + ...opts[0], + onSuccess: (res, req, meta) => { + apiUtils.tags.list.invalidate(); + return opts[0]?.onSuccess?.(res, req, meta); + }, + }); +} + export function useUpdateTag( ...opts: Parameters ) { -- cgit v1.2.3-70-g09d2