@hedhog/admin 0.46.36 → 0.46.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +960 -960
  2. package/dist/auth/auth.service.d.ts.map +1 -1
  3. package/dist/auth/auth.service.js +22 -2
  4. package/dist/auth/auth.service.js.map +1 -1
  5. package/dist/auth/consts/body.js +24 -24
  6. package/dist/emails/index.d.ts +3 -0
  7. package/dist/emails/index.d.ts.map +1 -0
  8. package/dist/emails/index.js +19 -0
  9. package/dist/emails/index.js.map +1 -0
  10. package/dist/emails/lib.d.ts +6 -0
  11. package/dist/emails/lib.d.ts.map +1 -0
  12. package/dist/emails/lib.js +43 -0
  13. package/dist/emails/lib.js.map +1 -0
  14. package/dist/emails/templates.d.ts +13 -0
  15. package/dist/emails/templates.d.ts.map +1 -0
  16. package/dist/emails/templates.js +63 -0
  17. package/dist/emails/templates.js.map +1 -0
  18. package/frontend/menu/components/create-panel.tsx.ejs +55 -55
  19. package/frontend/menu/components/update-panel.tsx.ejs +67 -67
  20. package/frontend/menu/locales/en/admin.menu.json +11 -11
  21. package/frontend/menu/locales/pt/admin.menu.json +11 -11
  22. package/frontend/menu/react-query/handlers.ts.ejs +28 -28
  23. package/frontend/menu/react-query/requests.ts.ejs +56 -56
  24. package/frontend/menu-locale/locales/en/admin.menu-locale.json +11 -11
  25. package/frontend/menu-locale/locales/pt/admin.menu-locale.json +11 -11
  26. package/frontend/menu-screen/locales/en/admin.menu-screen.json +11 -11
  27. package/frontend/menu-screen/locales/pt/admin.menu-screen.json +11 -11
  28. package/frontend/multifactor/components/create-panel.tsx.ejs +55 -55
  29. package/frontend/multifactor/components/update-panel.tsx.ejs +70 -70
  30. package/frontend/multifactor/locales/en/admin.multifactor.json +11 -11
  31. package/frontend/multifactor/locales/pt/admin.multifactor.json +11 -11
  32. package/frontend/multifactor/react-query/handlers.ts.ejs +28 -28
  33. package/frontend/multifactor/react-query/requests.ts.ejs +59 -59
  34. package/frontend/multifactor-locale/locales/en/admin.multifactor-locale.json +11 -11
  35. package/frontend/multifactor-locale/locales/pt/admin.multifactor-locale.json +11 -11
  36. package/frontend/screen/components/create-panel.tsx.ejs +55 -55
  37. package/frontend/screen/components/update-panel.tsx.ejs +67 -67
  38. package/frontend/screen/locales/en/admin.screen.json +11 -11
  39. package/frontend/screen/locales/pt/admin.screen.json +11 -11
  40. package/frontend/screen/react-query/handlers.ts.ejs +28 -28
  41. package/frontend/screen/react-query/requests.ts.ejs +56 -56
  42. package/frontend/screen-locale/locales/en/admin.screen-locale.json +11 -11
  43. package/frontend/screen-locale/locales/pt/admin.screen-locale.json +11 -11
  44. package/frontend/translation/components/create-panel.tsx.ejs +52 -52
  45. package/frontend/translation/components/update-panel.tsx.ejs +67 -67
  46. package/frontend/translation/locales/en/admin.translation.json +11 -11
  47. package/frontend/translation/locales/pt/admin.translation.json +11 -11
  48. package/frontend/translation/react-query/handlers.ts.ejs +28 -28
  49. package/frontend/translation/react-query/requests.ts.ejs +58 -58
  50. package/frontend/translation-namespace/components/create-panel.tsx.ejs +53 -53
  51. package/frontend/translation-namespace/components/update-panel.tsx.ejs +70 -70
  52. package/frontend/translation-namespace/locales/en/admin.translation-namespace.json +11 -11
  53. package/frontend/translation-namespace/locales/pt/admin.translation-namespace.json +11 -11
  54. package/frontend/translation-namespace/react-query/handlers.ts.ejs +28 -28
  55. package/frontend/translation-namespace/react-query/requests.ts.ejs +60 -60
  56. package/frontend/user/components/create-panel.tsx.ejs +52 -52
  57. package/frontend/user/components/update-panel.tsx.ejs +64 -64
  58. package/frontend/user/locales/en/admin.user.json +11 -11
  59. package/frontend/user/locales/pt/admin.user.json +11 -11
  60. package/frontend/user/react-query/handlers.ts.ejs +28 -28
  61. package/frontend/user/react-query/requests.ts.ejs +55 -55
  62. package/hedhog.yaml +783 -783
  63. package/package.json +45 -43
  64. package/src/admin.module.ts +39 -39
  65. package/src/auth/auth.controller.ts +88 -88
  66. package/src/auth/auth.module.ts +41 -41
  67. package/src/auth/auth.service.spec.ts +196 -196
  68. package/src/auth/auth.service.ts +349 -323
  69. package/src/auth/consts/body.ts +27 -27
  70. package/src/auth/dto/change.dto.ts +19 -19
  71. package/src/auth/dto/email.dto.ts +15 -15
  72. package/src/auth/dto/forget.dto.ts +6 -6
  73. package/src/auth/dto/login.dto.ts +21 -21
  74. package/src/auth/dto/otp.dto.ts +11 -11
  75. package/src/auth/dto/reset.dto.ts +14 -14
  76. package/src/auth/enums/multifactor-type.enum.ts +4 -4
  77. package/src/auth/guards/auth.guard.ts +54 -54
  78. package/src/auth/types/user.type.ts +8 -8
  79. package/src/dto/delete.dto.ts +8 -8
  80. package/src/dto/update-ids.dto.ts +9 -9
  81. package/src/emails/index.ts +2 -0
  82. package/src/emails/lib.ts +40 -0
  83. package/src/emails/templates.ts +60 -0
  84. package/src/index.ts +20 -20
  85. package/src/menu/dto/create.dto.ts +25 -25
  86. package/src/menu/dto/order.dto.ts +8 -8
  87. package/src/menu/dto/update.dto.ts +19 -19
  88. package/src/menu/menu.controller.ts +105 -105
  89. package/src/menu/menu.module.ts +18 -18
  90. package/src/menu/menu.service.spec.ts +247 -247
  91. package/src/menu/menu.service.ts +263 -263
  92. package/src/role/dto/create.dto.ts +7 -7
  93. package/src/role/dto/update.dto.ts +4 -4
  94. package/src/role/guards/role.guard.ts +121 -121
  95. package/src/role/role.controller.ts +126 -126
  96. package/src/role/role.module.ts +28 -28
  97. package/src/role/role.service.spec.ts +417 -417
  98. package/src/role/role.service.ts +289 -289
  99. package/src/route/dto/create.dto.ts +13 -13
  100. package/src/route/dto/update.dto.ts +15 -15
  101. package/src/route/route.controller.ts +91 -91
  102. package/src/route/route.module.ts +18 -18
  103. package/src/route/route.service.spec.ts +300 -300
  104. package/src/route/route.service.ts +164 -164
  105. package/src/screen/dto/create.dto.ts +11 -11
  106. package/src/screen/dto/update.dto.ts +19 -19
  107. package/src/screen/screen.controller.ts +93 -93
  108. package/src/screen/screen.module.ts +18 -18
  109. package/src/screen/screen.service.spec.ts +298 -298
  110. package/src/screen/screen.service.ts +179 -179
  111. package/src/types/http-method.ts +8 -8
  112. package/src/user/constants/user.constants.ts +1 -1
  113. package/src/user/dto/create.dto.ts +24 -24
  114. package/src/user/dto/update.dto.ts +41 -41
  115. package/src/user/user.controller.ts +75 -75
  116. package/src/user/user.module.ts +18 -18
  117. package/src/user/user.service.spec.ts +294 -294
  118. package/src/user/user.service.ts +129 -129
  119. package/tsconfig.lib.json +9 -9
  120. package/tsconfig.production.json +20 -20
@@ -1,11 +1,11 @@
1
- {
2
- "create": "Criar tela locale",
3
- "createText": "Preencha as informações da tela locale.",
4
- "createTooltip": "Criar nova tela locale",
5
- "delete": "Excluir tela locale",
6
- "deleteText": "Você tem certeza de que deseja excluir estas telas locale?",
7
- "deleteTooltip": "Excluir a tela locale selecionada",
8
- "edit": "Editar tela locale",
9
- "editText": "Visualizar e editar as informações da tela locale.",
10
- "editTooltip": "Editar a tela locale selecionada"
11
- }
1
+ {
2
+ "create": "Criar tela locale",
3
+ "createText": "Preencha as informações da tela locale.",
4
+ "createTooltip": "Criar nova tela locale",
5
+ "delete": "Excluir tela locale",
6
+ "deleteText": "Você tem certeza de que deseja excluir estas telas locale?",
7
+ "deleteTooltip": "Excluir a tela locale selecionada",
8
+ "edit": "Editar tela locale",
9
+ "editText": "Visualizar e editar as informações da tela locale.",
10
+ "editTooltip": "Editar a tela locale selecionada"
11
+ }
@@ -1,52 +1,52 @@
1
- import FormPanel, { FormPanelRef } from "@/components/panels/form-panel";
2
-
3
- import { useTranslationCreate } from "@/features/admin/translation";
4
- import { Translation } from "@/types/models";
5
- import { forwardRef, useImperativeHandle, useRef } from "react";
6
- import { useTranslation } from "react-i18next";
7
-
8
- export type TranslationCreatePanelRef = {
9
- submit: () => void;
10
- };
11
-
12
- export type TranslationCreatePanelProps = {
13
- onCreated?: (data: Translation) => void;
14
- };
15
-
16
- const TranslationCreatePanel = forwardRef(
17
- ({ onCreated }: TranslationCreatePanelProps, ref) => {
18
- const formRef = useRef<FormPanelRef>(null);
19
- const { t } = useTranslation(["actions", "fields", "translations"]);
20
- const { mutateAsync: createTranslation } = useTranslationCreate();
21
-
22
- useImperativeHandle(
23
- ref,
24
- () => ({
25
- submit: () => {
26
- formRef.current?.submit();
27
- },
28
- }),
29
- [formRef],
30
- );
31
-
32
- return (
33
- <FormPanel
34
- ref={formRef}
35
- fields={[]}
36
- button={{ text: t("create", { ns: "actions" }) }}
37
- onSubmit={async (data) => {
38
- const createdData = await createTranslation({
39
- data,
40
- });
41
- if (typeof onCreated === "function") {
42
- onCreated(createdData as any);
43
- }
44
- }}
45
- />
46
- );
47
- },
48
- );
49
-
50
- TranslationCreatePanel.displayName = "TranslationCreatePanel";
51
-
52
- export default TranslationCreatePanel;
1
+ import FormPanel, { FormPanelRef } from "@/components/panels/form-panel";
2
+
3
+ import { useTranslationCreate } from "@/features/admin/translation";
4
+ import { Translation } from "@/types/models";
5
+ import { forwardRef, useImperativeHandle, useRef } from "react";
6
+ import { useTranslation } from "react-i18next";
7
+
8
+ export type TranslationCreatePanelRef = {
9
+ submit: () => void;
10
+ };
11
+
12
+ export type TranslationCreatePanelProps = {
13
+ onCreated?: (data: Translation) => void;
14
+ };
15
+
16
+ const TranslationCreatePanel = forwardRef(
17
+ ({ onCreated }: TranslationCreatePanelProps, ref) => {
18
+ const formRef = useRef<FormPanelRef>(null);
19
+ const { t } = useTranslation(["actions", "fields", "translations"]);
20
+ const { mutateAsync: createTranslation } = useTranslationCreate();
21
+
22
+ useImperativeHandle(
23
+ ref,
24
+ () => ({
25
+ submit: () => {
26
+ formRef.current?.submit();
27
+ },
28
+ }),
29
+ [formRef],
30
+ );
31
+
32
+ return (
33
+ <FormPanel
34
+ ref={formRef}
35
+ fields={[]}
36
+ button={{ text: t("create", { ns: "actions" }) }}
37
+ onSubmit={async (data) => {
38
+ const createdData = await createTranslation({
39
+ data,
40
+ });
41
+ if (typeof onCreated === "function") {
42
+ onCreated(createdData as any);
43
+ }
44
+ }}
45
+ />
46
+ );
47
+ },
48
+ );
49
+
50
+ TranslationCreatePanel.displayName = "TranslationCreatePanel";
51
+
52
+ export default TranslationCreatePanel;
@@ -1,67 +1,67 @@
1
- import FormPanel, { FormPanelRef } from "@/components/panels/form-panel";
2
- import { Overlay } from "@/components/custom/overlay";
3
- import { TabPanel } from "@/components/panels/tab-panel";
4
- import {
5
- useTranslationGet,
6
- useTranslationUpdate,
7
- } from "@/features/admin/translation";
8
- import useEffectAfterFirstUpdate from "@/hooks/use-effect-after-first-update";
9
- import { Translation } from "@/types/models";
10
- import { useState, forwardRef, useImperativeHandle, useRef } from "react";
11
- import { useTranslation } from "react-i18next";
12
- import { IconEdit, IconPlus, IconTrash } from "@tabler/icons-react";
13
-
14
- export type TranslationUpdatePanelProps = {
15
- data: Translation;
16
- onUpdated?: (data: Translation) => void;
17
- };
18
-
19
- const TranslationUpdatePanel = forwardRef(
20
- ({ data, onUpdated }: TranslationUpdatePanelProps, ref) => {
21
- const { t } = useTranslation(["actions", "fields", "translations"]);
22
- const { data: item, isLoading } = useTranslationGet(data.id as number);
23
- const { mutate: translationUpdate } = useTranslationUpdate();
24
- const formRef = useRef<FormPanelRef>(null);
25
-
26
- useEffectAfterFirstUpdate(() => {
27
- if (item && formRef.current) {
28
- formRef.current.setValuesFromItem(item);
29
- }
30
- }, [item]);
31
-
32
- useImperativeHandle(ref, () => ({}));
33
-
34
- return (
35
- <TabPanel
36
- activeTabIndex={0}
37
- tabs={[
38
- {
39
- title: t("details", { ns: "actions" }),
40
- children: (
41
- <Overlay loading={isLoading}>
42
- <FormPanel
43
- ref={formRef}
44
- fields={[]}
45
- button={{ text: t("save", { ns: "actions" }) }}
46
- onSubmit={(data) => {
47
- translationUpdate({
48
- id: data.id,
49
- data,
50
- });
51
- if (typeof onUpdated === "function") {
52
- onUpdated(data);
53
- }
54
- }}
55
- />
56
- </Overlay>
57
- ),
58
- },
59
- ]}
60
- />
61
- );
62
- },
63
- );
64
-
65
- TranslationUpdatePanel.displayName = "TranslationUpdatePanel";
66
-
67
- export default TranslationUpdatePanel;
1
+ import FormPanel, { FormPanelRef } from "@/components/panels/form-panel";
2
+ import { Overlay } from "@/components/custom/overlay";
3
+ import { TabPanel } from "@/components/panels/tab-panel";
4
+ import {
5
+ useTranslationGet,
6
+ useTranslationUpdate,
7
+ } from "@/features/admin/translation";
8
+ import useEffectAfterFirstUpdate from "@/hooks/use-effect-after-first-update";
9
+ import { Translation } from "@/types/models";
10
+ import { useState, forwardRef, useImperativeHandle, useRef } from "react";
11
+ import { useTranslation } from "react-i18next";
12
+ import { IconEdit, IconPlus, IconTrash } from "@tabler/icons-react";
13
+
14
+ export type TranslationUpdatePanelProps = {
15
+ data: Translation;
16
+ onUpdated?: (data: Translation) => void;
17
+ };
18
+
19
+ const TranslationUpdatePanel = forwardRef(
20
+ ({ data, onUpdated }: TranslationUpdatePanelProps, ref) => {
21
+ const { t } = useTranslation(["actions", "fields", "translations"]);
22
+ const { data: item, isLoading } = useTranslationGet(data.id as number);
23
+ const { mutate: translationUpdate } = useTranslationUpdate();
24
+ const formRef = useRef<FormPanelRef>(null);
25
+
26
+ useEffectAfterFirstUpdate(() => {
27
+ if (item && formRef.current) {
28
+ formRef.current.setValuesFromItem(item);
29
+ }
30
+ }, [item]);
31
+
32
+ useImperativeHandle(ref, () => ({}));
33
+
34
+ return (
35
+ <TabPanel
36
+ activeTabIndex={0}
37
+ tabs={[
38
+ {
39
+ title: t("details", { ns: "actions" }),
40
+ children: (
41
+ <Overlay loading={isLoading}>
42
+ <FormPanel
43
+ ref={formRef}
44
+ fields={[]}
45
+ button={{ text: t("save", { ns: "actions" }) }}
46
+ onSubmit={(data) => {
47
+ translationUpdate({
48
+ id: data.id,
49
+ data,
50
+ });
51
+ if (typeof onUpdated === "function") {
52
+ onUpdated(data);
53
+ }
54
+ }}
55
+ />
56
+ </Overlay>
57
+ ),
58
+ },
59
+ ]}
60
+ />
61
+ );
62
+ },
63
+ );
64
+
65
+ TranslationUpdatePanel.displayName = "TranslationUpdatePanel";
66
+
67
+ export default TranslationUpdatePanel;
@@ -1,11 +1,11 @@
1
- {
2
- "create": "Create translation",
3
- "createText": "Fill the translation informations.",
4
- "createTooltip": "Create new translation",
5
- "delete": "Delete translation",
6
- "deleteText": "Are you sure to delete these translation?",
7
- "deleteTooltip": "Delete the selected translation",
8
- "edit": "Edit translation",
9
- "editText": "View and edit translation information.",
10
- "editTooltip": "Edit the selected translation"
11
- }
1
+ {
2
+ "create": "Create translation",
3
+ "createText": "Fill the translation informations.",
4
+ "createTooltip": "Create new translation",
5
+ "delete": "Delete translation",
6
+ "deleteText": "Are you sure to delete these translation?",
7
+ "deleteTooltip": "Delete the selected translation",
8
+ "edit": "Edit translation",
9
+ "editText": "View and edit translation information.",
10
+ "editTooltip": "Edit the selected translation"
11
+ }
@@ -1,11 +1,11 @@
1
- {
2
- "create": "Criar translation",
3
- "createText": "Preencha as informações da translation.",
4
- "createTooltip": "Criar nova translation",
5
- "delete": "Excluir translation",
6
- "deleteText": "Você tem certeza de que deseja excluir estas translation?",
7
- "deleteTooltip": "Excluir a translation selecionada",
8
- "edit": "Editar translation",
9
- "editText": "Ver e editar as informações da translation.",
10
- "editTooltip": "Editar a translation selecionada"
11
- }
1
+ {
2
+ "create": "Criar translation",
3
+ "createText": "Preencha as informações da translation.",
4
+ "createTooltip": "Criar nova translation",
5
+ "delete": "Excluir translation",
6
+ "deleteText": "Você tem certeza de que deseja excluir estas translation?",
7
+ "deleteTooltip": "Excluir a translation selecionada",
8
+ "edit": "Editar translation",
9
+ "editText": "Ver e editar as informações da translation.",
10
+ "editTooltip": "Editar a translation selecionada"
11
+ }
@@ -1,28 +1,28 @@
1
- import { useDefaultMutation } from "@/hooks/use-default-mutation";
2
- import { useQuery } from "@tanstack/react-query";
3
- import { requests } from "./requests";
4
-
5
- const scope = "translation";
6
-
7
- export function useTranslationCreate() {
8
- const { translationCreate } = requests();
9
- return useDefaultMutation(scope, "create", translationCreate);
10
- }
11
-
12
- export function useTranslationDelete() {
13
- const { translationDelete } = requests();
14
- return useDefaultMutation(scope, "delete", translationDelete);
15
- }
16
-
17
- export function useTranslationUpdate() {
18
- const { translationUpdate } = requests();
19
- return useDefaultMutation(scope, "update", translationUpdate);
20
- }
21
-
22
- export function useTranslationGet(id: number) {
23
- const { translationGet } = requests();
24
- return useQuery({
25
- queryKey: [scope, "get"],
26
- queryFn: () => translationGet(id),
27
- });
28
- }
1
+ import { useDefaultMutation } from "@/hooks/use-default-mutation";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { requests } from "./requests";
4
+
5
+ const scope = "translation";
6
+
7
+ export function useTranslationCreate() {
8
+ const { translationCreate } = requests();
9
+ return useDefaultMutation(scope, "create", translationCreate);
10
+ }
11
+
12
+ export function useTranslationDelete() {
13
+ const { translationDelete } = requests();
14
+ return useDefaultMutation(scope, "delete", translationDelete);
15
+ }
16
+
17
+ export function useTranslationUpdate() {
18
+ const { translationUpdate } = requests();
19
+ return useDefaultMutation(scope, "update", translationUpdate);
20
+ }
21
+
22
+ export function useTranslationGet(id: number) {
23
+ const { translationGet } = requests();
24
+ return useQuery({
25
+ queryKey: [scope, "get"],
26
+ queryFn: () => translationGet(id),
27
+ });
28
+ }
@@ -1,58 +1,58 @@
1
- import { useApp } from "@/hooks/use-app";
2
- import { Delete, PaginationParams, PaginationResult } from "@/types";
3
- import { Translation } from "@/types/models";
4
- import { HttpMethod } from "@/types/http-method";
5
-
6
- export function requests() {
7
- const { request } = useApp();
8
-
9
- const translationList = async (params: PaginationParams) => {
10
- return request<PaginationResult<Translation>>({
11
- url: "/translation",
12
- params,
13
- }).then((res) => res.data);
14
- };
15
-
16
- const translationGet = async (id: number) => {
17
- return request<Translation>({
18
- url: `/translation/${id}`,
19
- }).then((res) => res.data);
20
- };
21
-
22
- const translationCreate = async (params: { data: Translation }) => {
23
- const { data } = params;
24
- return request<Translation>({
25
- url: "/translation",
26
- method: HttpMethod.POST,
27
- data: data,
28
- }).then((res) => res.data);
29
- };
30
-
31
- const translationDelete = async (ids: number[]) => {
32
- return request<Delete>({
33
- url: "/translation",
34
- data: { ids },
35
- method: HttpMethod.DELETE,
36
- }).then((res) => res.data);
37
- };
38
-
39
- const translationUpdate = async (params: {
40
- id: number;
41
- data: Translation;
42
- }) => {
43
- const { id, data } = params;
44
- return request<Translation>({
45
- url: `/translation/${id}`,
46
- method: HttpMethod.PATCH,
47
- data: data,
48
- }).then((res) => res.data);
49
- };
50
-
51
- return {
52
- translationCreate,
53
- translationUpdate,
54
- translationDelete,
55
- translationList,
56
- translationGet,
57
- };
58
- }
1
+ import { useApp } from "@/hooks/use-app";
2
+ import { Delete, PaginationParams, PaginationResult } from "@/types";
3
+ import { Translation } from "@/types/models";
4
+ import { HttpMethod } from "@/types/http-method";
5
+
6
+ export function requests() {
7
+ const { request } = useApp();
8
+
9
+ const translationList = async (params: PaginationParams) => {
10
+ return request<PaginationResult<Translation>>({
11
+ url: "/translation",
12
+ params,
13
+ }).then((res) => res.data);
14
+ };
15
+
16
+ const translationGet = async (id: number) => {
17
+ return request<Translation>({
18
+ url: `/translation/${id}`,
19
+ }).then((res) => res.data);
20
+ };
21
+
22
+ const translationCreate = async (params: { data: Translation }) => {
23
+ const { data } = params;
24
+ return request<Translation>({
25
+ url: "/translation",
26
+ method: HttpMethod.POST,
27
+ data: data,
28
+ }).then((res) => res.data);
29
+ };
30
+
31
+ const translationDelete = async (ids: number[]) => {
32
+ return request<Delete>({
33
+ url: "/translation",
34
+ data: { ids },
35
+ method: HttpMethod.DELETE,
36
+ }).then((res) => res.data);
37
+ };
38
+
39
+ const translationUpdate = async (params: {
40
+ id: number;
41
+ data: Translation;
42
+ }) => {
43
+ const { id, data } = params;
44
+ return request<Translation>({
45
+ url: `/translation/${id}`,
46
+ method: HttpMethod.PATCH,
47
+ data: data,
48
+ }).then((res) => res.data);
49
+ };
50
+
51
+ return {
52
+ translationCreate,
53
+ translationUpdate,
54
+ translationDelete,
55
+ translationList,
56
+ translationGet,
57
+ };
58
+ }
@@ -1,53 +1,53 @@
1
- import FormPanel, { FormPanelRef } from "@/components/panels/form-panel";
2
-
3
- import { useTranslationNamespaceCreate } from "@/features/admin/translation-namespace";
4
- import { TranslationNamespace } from "@/types/models";
5
- import { forwardRef, useImperativeHandle, useRef } from "react";
6
- import { useTranslation } from "react-i18next";
7
-
8
- export type TranslationNamespaceCreatePanelRef = {
9
- submit: () => void;
10
- };
11
-
12
- export type TranslationNamespaceCreatePanelProps = {
13
- onCreated?: (data: TranslationNamespace) => void;
14
- };
15
-
16
- const TranslationNamespaceCreatePanel = forwardRef(
17
- ({ onCreated }: TranslationNamespaceCreatePanelProps, ref) => {
18
- const formRef = useRef<FormPanelRef>(null);
19
- const { t } = useTranslation(["actions", "fields", "translations"]);
20
- const { mutateAsync: createTranslationNamespace } =
21
- useTranslationNamespaceCreate();
22
-
23
- useImperativeHandle(
24
- ref,
25
- () => ({
26
- submit: () => {
27
- formRef.current?.submit();
28
- },
29
- }),
30
- [formRef],
31
- );
32
-
33
- return (
34
- <FormPanel
35
- ref={formRef}
36
- fields={[]}
37
- button={{ text: t("create", { ns: "actions" }) }}
38
- onSubmit={async (data) => {
39
- const createdData = await createTranslationNamespace({
40
- data,
41
- });
42
- if (typeof onCreated === "function") {
43
- onCreated(createdData as any);
44
- }
45
- }}
46
- />
47
- );
48
- },
49
- );
50
-
51
- TranslationNamespaceCreatePanel.displayName = "TranslationNamespaceCreatePanel";
52
-
53
- export default TranslationNamespaceCreatePanel;
1
+ import FormPanel, { FormPanelRef } from "@/components/panels/form-panel";
2
+
3
+ import { useTranslationNamespaceCreate } from "@/features/admin/translation-namespace";
4
+ import { TranslationNamespace } from "@/types/models";
5
+ import { forwardRef, useImperativeHandle, useRef } from "react";
6
+ import { useTranslation } from "react-i18next";
7
+
8
+ export type TranslationNamespaceCreatePanelRef = {
9
+ submit: () => void;
10
+ };
11
+
12
+ export type TranslationNamespaceCreatePanelProps = {
13
+ onCreated?: (data: TranslationNamespace) => void;
14
+ };
15
+
16
+ const TranslationNamespaceCreatePanel = forwardRef(
17
+ ({ onCreated }: TranslationNamespaceCreatePanelProps, ref) => {
18
+ const formRef = useRef<FormPanelRef>(null);
19
+ const { t } = useTranslation(["actions", "fields", "translations"]);
20
+ const { mutateAsync: createTranslationNamespace } =
21
+ useTranslationNamespaceCreate();
22
+
23
+ useImperativeHandle(
24
+ ref,
25
+ () => ({
26
+ submit: () => {
27
+ formRef.current?.submit();
28
+ },
29
+ }),
30
+ [formRef],
31
+ );
32
+
33
+ return (
34
+ <FormPanel
35
+ ref={formRef}
36
+ fields={[]}
37
+ button={{ text: t("create", { ns: "actions" }) }}
38
+ onSubmit={async (data) => {
39
+ const createdData = await createTranslationNamespace({
40
+ data,
41
+ });
42
+ if (typeof onCreated === "function") {
43
+ onCreated(createdData as any);
44
+ }
45
+ }}
46
+ />
47
+ );
48
+ },
49
+ );
50
+
51
+ TranslationNamespaceCreatePanel.displayName = "TranslationNamespaceCreatePanel";
52
+
53
+ export default TranslationNamespaceCreatePanel;