diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-09-14 10:37:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-14 10:37:36 +0100 |
| commit | 820b7e655a670cf8b8e3f7ad8bb1eb487ee20405 (patch) | |
| tree | 7bc8443499b8d72afc286d7ed778e118a284ce03 /packages | |
| parent | c2dcb9dca6218d315c032e1644325c144408b4e9 (diff) | |
| download | karakeep-820b7e655a670cf8b8e3f7ad8bb1eb487ee20405.tar.zst | |
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 <MohamedBassem@users.noreply.github.com>
* format
* localize toasts
---------
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Mohamed Bassem <MohamedBassem@users.noreply.github.com>
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/shared-react/hooks/tags.ts | 14 |
1 files changed, 14 insertions, 0 deletions
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<typeof api.tags.create.useMutation> +) { + 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<typeof api.tags.update.useMutation> ) { |
