mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 04:48:51 +00:00
refactor(frontend): update language formDialog
This commit is contained in:
parent
c9822b1689
commit
9cf9847457
@ -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 { ILanguage } from "@/types/language.types";
|
import { ILanguage } from "@/types/language.types";
|
||||||
|
|
||||||
import { LanguageForm } from "./LanguageForm";
|
import { LanguageForm } from "./LanguageForm";
|
||||||
|
|
||||||
export const LanguageFormDialog: FC<ComponentFormDialogProps<ILanguage>> = ({
|
export const LanguageFormDialog = <T extends ILanguage = ILanguage>(
|
||||||
payload,
|
props: ComponentFormDialogProps<T>,
|
||||||
...rest
|
) => (
|
||||||
}) => {
|
<GenericFormDialog<T>
|
||||||
const { t } = useTranslate();
|
Form={LanguageForm}
|
||||||
|
addText="title.new_language"
|
||||||
return (
|
editText="title.edit_language"
|
||||||
<LanguageForm
|
{...props}
|
||||||
data={payload}
|
/>
|
||||||
onSuccess={() => {
|
);
|
||||||
rest.onClose(true);
|
|
||||||
}}
|
|
||||||
Wrapper={FormDialog}
|
|
||||||
WrapperProps={{
|
|
||||||
title: payload ? t("title.edit_language") : t("title.new_language"),
|
|
||||||
...rest,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user