mirror of
https://github.com/hexastack/hexabot
synced 2025-05-09 15:10:57 +00:00
refactor(frontend): update contextVar formDialog
This commit is contained in:
parent
06d40228cb
commit
c55dbd401f
@ -6,33 +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 { IContextVar } from "@/types/context-var.types";
|
import { IContextVar } from "@/types/context-var.types";
|
||||||
|
|
||||||
import { ContextVarForm } from "./ContextVarForm";
|
import { ContextVarForm } from "./ContextVarForm";
|
||||||
|
|
||||||
export const ContextVarFormDialog: FC<
|
export const ContextVarFormDialog = <T extends IContextVar = IContextVar>(
|
||||||
ComponentFormDialogProps<IContextVar>
|
props: ComponentFormDialogProps<T>,
|
||||||
> = ({ payload, ...rest }) => {
|
) => (
|
||||||
const { t } = useTranslate();
|
<GenericFormDialog<T>
|
||||||
|
Form={ContextVarForm}
|
||||||
return (
|
addText="title.new_context_var"
|
||||||
<ContextVarForm
|
editText="title.edit_context_var"
|
||||||
data={payload}
|
{...props}
|
||||||
onSuccess={() => {
|
|
||||||
rest.onClose(true);
|
|
||||||
}}
|
|
||||||
Wrapper={FormDialog}
|
|
||||||
WrapperProps={{
|
|
||||||
title: payload
|
|
||||||
? t("title.edit_context_var")
|
|
||||||
: t("title.new_context_var"),
|
|
||||||
...rest,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user