
* Minor fixes for intl messages * Add esbuild-loader * switch from babel to esbuild-loader * use formatjs enforce-id linter * Generate ids for intl messages * id format defined by idInterpolationPattern * Modify intl messages extraction * remove react-intl-translations-manager * remove transpile-tx.js * use formatjs cli * Modify defaultMessages.json * modify ids in defaultMessages.json with defined idInterpolationPattern * Fix errors * Fix page crash * Use babel to transpile tests * Fix useStateFromProps * Improve render count * Add test to useStateFromProps * Fix reloading state buh * Do not check if form with channels is dirty * Stop blocking save if form has not changed * Remove debug code * Fix form disabling * Fix variant selection checkbox onClick * Update translations * Update messages * Use esbuild to build storybook Co-authored-by: Bartłomiej Wiaduch <tukan2can@gmail.com> Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import Container from "@saleor/components/Container";
|
|
import PageHeader from "@saleor/components/PageHeader";
|
|
import { MenuFragment } from "@saleor/graphql";
|
|
import { sectionNames } from "@saleor/intl";
|
|
import { Backlink, Button } from "@saleor/macaw-ui";
|
|
import { MenuListUrlSortField } from "@saleor/navigation/urls";
|
|
import { ListActions, PageListProps, SortPage } from "@saleor/types";
|
|
import React from "react";
|
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
|
|
import MenuList from "../MenuList";
|
|
|
|
export interface MenuListPageProps
|
|
extends PageListProps,
|
|
ListActions,
|
|
SortPage<MenuListUrlSortField> {
|
|
menus: MenuFragment[];
|
|
onBack: () => void;
|
|
onDelete: (id: string) => void;
|
|
}
|
|
|
|
const MenuListPage: React.FC<MenuListPageProps> = ({
|
|
onAdd,
|
|
onBack,
|
|
...listProps
|
|
}) => {
|
|
const intl = useIntl();
|
|
return (
|
|
<Container>
|
|
<Backlink onClick={onBack}>
|
|
{intl.formatMessage(sectionNames.configuration)}
|
|
</Backlink>
|
|
<PageHeader title={intl.formatMessage(sectionNames.navigation)}>
|
|
<Button variant="primary" onClick={onAdd} data-test-id="add-menu">
|
|
<FormattedMessage
|
|
id="JXRYQg"
|
|
defaultMessage="Create Menu"
|
|
description="button"
|
|
/>
|
|
</Button>
|
|
</PageHeader>
|
|
<MenuList {...listProps} />
|
|
</Container>
|
|
);
|
|
};
|
|
MenuListPage.displayName = "MenuListPage";
|
|
export default MenuListPage;
|