2023-02-22 13:00:03 +00:00
|
|
|
import {
|
|
|
|
borderHeight,
|
|
|
|
topBarHeight,
|
|
|
|
} from "@dashboard/components/AppLayout/consts";
|
2023-02-20 15:21:28 +00:00
|
|
|
import { TopNav } from "@dashboard/components/AppLayout/TopNav";
|
2023-01-16 09:45:12 +00:00
|
|
|
import { Button } from "@dashboard/components/Button";
|
|
|
|
import { configurationMenuUrl } from "@dashboard/configuration";
|
|
|
|
import { MenuFragment } from "@dashboard/graphql";
|
|
|
|
import { sectionNames } from "@dashboard/intl";
|
|
|
|
import { menuListUrl, MenuListUrlSortField } from "@dashboard/navigation/urls";
|
|
|
|
import { ListActions, PageListProps, SortPage } from "@dashboard/types";
|
2023-02-22 13:00:03 +00:00
|
|
|
import { Box } from "@saleor/macaw-ui/next";
|
2020-05-14 09:30:32 +00:00
|
|
|
import React from "react";
|
|
|
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
|
|
|
2019-06-19 14:40:52 +00:00
|
|
|
import MenuList from "../MenuList";
|
|
|
|
|
2019-12-17 17:13:56 +00:00
|
|
|
export interface MenuListPageProps
|
|
|
|
extends PageListProps,
|
|
|
|
ListActions,
|
|
|
|
SortPage<MenuListUrlSortField> {
|
2022-03-09 08:56:55 +00:00
|
|
|
menus: MenuFragment[];
|
2019-06-19 14:40:52 +00:00
|
|
|
onDelete: (id: string) => void;
|
|
|
|
}
|
|
|
|
|
2022-05-06 08:59:55 +00:00
|
|
|
const MenuListPage: React.FC<MenuListPageProps> = ({ ...listProps }) => {
|
2019-08-26 14:51:47 +00:00
|
|
|
const intl = useIntl();
|
2022-05-06 08:59:55 +00:00
|
|
|
const addUrl = menuListUrl({
|
2022-06-21 09:36:55 +00:00
|
|
|
action: "add",
|
2022-05-06 08:59:55 +00:00
|
|
|
});
|
|
|
|
|
2019-08-26 14:51:47 +00:00
|
|
|
return (
|
2023-02-20 15:21:28 +00:00
|
|
|
<>
|
|
|
|
<TopNav
|
|
|
|
href={configurationMenuUrl}
|
|
|
|
title={intl.formatMessage(sectionNames.navigation)}
|
|
|
|
>
|
2022-05-06 08:59:55 +00:00
|
|
|
<Button variant="primary" href={addUrl} data-test-id="add-menu">
|
2019-08-26 14:51:47 +00:00
|
|
|
<FormattedMessage
|
2022-05-05 07:54:28 +00:00
|
|
|
id="JXRYQg"
|
2019-09-05 13:33:50 +00:00
|
|
|
defaultMessage="Create Menu"
|
2019-08-26 14:51:47 +00:00
|
|
|
description="button"
|
|
|
|
/>
|
|
|
|
</Button>
|
2023-02-20 15:21:28 +00:00
|
|
|
</TopNav>
|
2023-02-22 13:00:03 +00:00
|
|
|
<Box __height={`calc(100vh - ${topBarHeight} - ${borderHeight})`}>
|
|
|
|
<MenuList {...listProps} />
|
|
|
|
</Box>
|
2023-02-20 15:21:28 +00:00
|
|
|
</>
|
2019-08-26 14:51:47 +00:00
|
|
|
);
|
|
|
|
};
|
2019-06-19 14:40:52 +00:00
|
|
|
MenuListPage.displayName = "MenuListPage";
|
|
|
|
export default MenuListPage;
|