mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 12:59:14 +00:00
refactor(frontend): update category formDialog
This commit is contained in:
parent
84b374c3f3
commit
06d40228cb
@ -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 { ICategory } from "@/types/category.types";
|
import { ICategory } from "@/types/category.types";
|
||||||
import { ComponentFormDialogProps } from "@/types/common/dialogs.types";
|
import { ComponentFormDialogProps } from "@/types/common/dialogs.types";
|
||||||
|
|
||||||
import { CategoryForm } from "./CategoryForm";
|
import { CategoryForm } from "./CategoryForm";
|
||||||
|
|
||||||
export const CategoryFormDialog: FC<ComponentFormDialogProps<ICategory>> = ({
|
export const CategoryFormDialog = <T extends ICategory = ICategory>(
|
||||||
payload,
|
props: ComponentFormDialogProps<T>,
|
||||||
...rest
|
) => (
|
||||||
}) => {
|
<GenericFormDialog<T>
|
||||||
const { t } = useTranslate();
|
Form={CategoryForm}
|
||||||
|
addText="title.new_category"
|
||||||
return (
|
editText="title.edit_category"
|
||||||
<CategoryForm
|
{...props}
|
||||||
data={payload}
|
|
||||||
onSuccess={() => {
|
|
||||||
rest.onClose(true);
|
|
||||||
}}
|
|
||||||
Wrapper={FormDialog}
|
|
||||||
WrapperProps={{
|
|
||||||
title: payload ? t("title.edit_category") : t("title.new_category"),
|
|
||||||
...rest,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user