From 06d40228cb2df1bbaa682ee273de6b83cbdb87ae Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Thu, 6 Feb 2025 00:32:22 +0100 Subject: [PATCH] refactor(frontend): update category formDialog --- .../categories/CategoryFormDialog.tsx | 35 ++++++------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/frontend/src/components/categories/CategoryFormDialog.tsx b/frontend/src/components/categories/CategoryFormDialog.tsx index 74112ea3..e290019b 100644 --- a/frontend/src/components/categories/CategoryFormDialog.tsx +++ b/frontend/src/components/categories/CategoryFormDialog.tsx @@ -6,32 +6,19 @@ * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ -import { FC } from "react"; - -import { FormDialog } from "@/app-components/dialogs"; -import { useTranslate } from "@/hooks/useTranslate"; +import { GenericFormDialog } from "@/app-components/dialogs"; import { ICategory } from "@/types/category.types"; import { ComponentFormDialogProps } from "@/types/common/dialogs.types"; import { CategoryForm } from "./CategoryForm"; -export const CategoryFormDialog: FC> = ({ - payload, - ...rest -}) => { - const { t } = useTranslate(); - - return ( - { - rest.onClose(true); - }} - Wrapper={FormDialog} - WrapperProps={{ - title: payload ? t("title.edit_category") : t("title.new_category"), - ...rest, - }} - /> - ); -}; +export const CategoryFormDialog = ( + props: ComponentFormDialogProps, +) => ( + + Form={CategoryForm} + addText="title.new_category" + editText="title.edit_category" + {...props} + /> +);