mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix(frontend): move MenuFormData to menuForm component
This commit is contained in:
parent
5722ae0f05
commit
11cb5e8f3f
@ -19,14 +19,18 @@ import { useToast } from "@/hooks/useToast";
|
|||||||
import { useTranslate } from "@/hooks/useTranslate";
|
import { useTranslate } from "@/hooks/useTranslate";
|
||||||
import { EntityType } from "@/services/types";
|
import { EntityType } from "@/services/types";
|
||||||
import { ComponentFormProps } from "@/types/common/dialogs.types";
|
import { ComponentFormProps } from "@/types/common/dialogs.types";
|
||||||
import { IMenuItemAttributes, MenuType } from "@/types/menu.types";
|
import { IMenuItem, IMenuItemAttributes, MenuType } from "@/types/menu.types";
|
||||||
import { isAbsoluteUrl } from "@/utils/URL";
|
import { isAbsoluteUrl } from "@/utils/URL";
|
||||||
|
|
||||||
import { MenuFormDialogProps } from "./MenuFormDialog";
|
|
||||||
|
|
||||||
const DEFAULT_VALUES = { title: "", type: MenuType.web_url, url: undefined };
|
const DEFAULT_VALUES = { title: "", type: MenuType.web_url, url: undefined };
|
||||||
|
|
||||||
export const MenuForm: FC<ComponentFormProps<MenuFormDialogProps>> = ({
|
export type MenuFormData = {
|
||||||
|
row?: IMenuItem;
|
||||||
|
rowId?: string;
|
||||||
|
parentId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const MenuForm: FC<ComponentFormProps<MenuFormData>> = ({
|
||||||
data,
|
data,
|
||||||
Wrapper = Fragment,
|
Wrapper = Fragment,
|
||||||
WrapperProps,
|
WrapperProps,
|
||||||
|
|||||||
@ -8,18 +8,10 @@
|
|||||||
|
|
||||||
import { GenericFormDialog } from "@/app-components/dialogs";
|
import { GenericFormDialog } from "@/app-components/dialogs";
|
||||||
import { ComponentFormDialogProps } from "@/types/common/dialogs.types";
|
import { ComponentFormDialogProps } from "@/types/common/dialogs.types";
|
||||||
import { IMenuItem } from "@/types/menu.types";
|
|
||||||
|
|
||||||
import { MenuForm } from "./MenuForm";
|
import { MenuForm, MenuFormData } from "./MenuForm";
|
||||||
|
|
||||||
export type MenuFormDialogProps = {
|
export const MenuFormDialog = <T extends MenuFormData = MenuFormData>(
|
||||||
row?: IMenuItem;
|
|
||||||
rowId?: string;
|
|
||||||
parentId?: string;
|
|
||||||
};
|
|
||||||
export const MenuFormDialog = <
|
|
||||||
T extends MenuFormDialogProps = MenuFormDialogProps,
|
|
||||||
>(
|
|
||||||
props: ComponentFormDialogProps<T>,
|
props: ComponentFormDialogProps<T>,
|
||||||
) => (
|
) => (
|
||||||
<GenericFormDialog<T>
|
<GenericFormDialog<T>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user