refactor(frontend): update label formDialog

This commit is contained in:
yassinedorbozgithub 2025-02-06 00:32:50 +01:00
parent c55dbd401f
commit 76b5310cd5

View File

@ -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). * 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 { GenericFormDialog } from "@/app-components/dialogs";
import { FormDialog } from "@/app-components/dialogs";
import { useTranslate } from "@/hooks/useTranslate";
import { ComponentFormDialogProps } from "@/types/common/dialogs.types"; import { ComponentFormDialogProps } from "@/types/common/dialogs.types";
import { ILabel } from "@/types/label.types"; import { ILabel } from "@/types/label.types";
import { LabelForm } from "./LabelForm"; import { LabelForm } from "./LabelForm";
export const LabelFormDialog: FC<ComponentFormDialogProps<ILabel>> = ({ export const LabelFormDialog = <T extends ILabel = ILabel>(
payload, props: ComponentFormDialogProps<T>,
...rest ) => (
}) => { <GenericFormDialog<T>
const { t } = useTranslate(); Form={LabelForm}
addText="title.new_label"
return ( editText="title.edit_label"
<LabelForm {...props}
data={payload}
onSuccess={() => {
rest.onClose(true);
}}
Wrapper={FormDialog}
WrapperProps={{
title: payload ? t("title.edit_label") : t("title.new_label"),
...rest,
}}
/> />
); );
};