mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 04:48:51 +00:00
refactor(frontend): update translation formDialog
This commit is contained in:
parent
76b5310cd5
commit
28a6fccaa7
@ -6,31 +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 { ITranslation } from "@/types/translation.types";
|
import { ITranslation } from "@/types/translation.types";
|
||||||
|
|
||||||
import { TranslationForm } from "./TranslationForm";
|
import { TranslationForm } from "./TranslationForm";
|
||||||
|
|
||||||
export const TranslationFormDialog: FC<
|
export const TranslationFormDialog = <T extends ITranslation = ITranslation>(
|
||||||
ComponentFormDialogProps<ITranslation>
|
props: ComponentFormDialogProps<T>,
|
||||||
> = ({ payload, ...rest }) => {
|
) => (
|
||||||
const { t } = useTranslate();
|
<GenericFormDialog<T>
|
||||||
|
Form={TranslationForm}
|
||||||
return (
|
addText="title.new_label"
|
||||||
<TranslationForm
|
editText="title.edit_label"
|
||||||
data={payload}
|
{...props}
|
||||||
onSuccess={() => {
|
/>
|
||||||
rest.onClose(true);
|
);
|
||||||
}}
|
|
||||||
Wrapper={FormDialog}
|
|
||||||
WrapperProps={{
|
|
||||||
title: t("title.update_translation"),
|
|
||||||
...rest,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user