
* Create attribute class selector * Use ProductAttributeType to check if product is simple or with variants * Allow attribute class selection only during its creation * Update attribute type selection translations * Show only product attributes in columns picker on product list view * Cleanups in Attribute Organization component * Create Page Types list page * Create content management section in settings * Implement page types list view * Remove unused imports from page type list * Updatte page type list style * Remove legacy code from page type list component * Update PageTypeListPage component * Create Page Types details page * Fix page type attribute reordering * Implement PageType create view * Implement PageType update view * gUpdate page type details components * Fix page type update component * Update page type components stories * Update page type errors handling * Update page type details view * Create Page Types details page * Implement PageType create view * Update product attribute assignment mutations * Add page types attribute assignment mutations * Add page types attribute assignment handling * Temporarily fix page create mutation * Update page type error messages * Remove legacy storybook page type stories * Update attribute assignment dialogs stories * Update page type details error handling * Update props for page type components * Create attribute class selector * Implement page types list view * Add page type selector on page create and details views * Add attributes list to page details views * Update page types list * Use attribute errors for attributes muatations * Save attribute values on page create and update * Update messages for page view * Update page attributes fragment * Use AttributeError in AttributeBulkDelete * Update page type and its attribute selection * Handle page types deleting * Update page types deleting messages * Handle page types attribute reorder * Fix PageOrganizeContent component types * Update graphqql types * Fix page fixture * Update messages * Update test snapshots * Pass pageTypes to PageForm * Update changelog with page type addition note * Update package-lock * Update test snapshots * Fix malformed generated type * Update messages after rebase
247 lines
8.7 KiB
TypeScript
247 lines
8.7 KiB
TypeScript
import { attributeListUrl } from "@saleor/attributes/urls";
|
|
import { channelsListUrl } from "@saleor/channels/urls";
|
|
import { WindowTitle } from "@saleor/components/WindowTitle";
|
|
import useNavigator from "@saleor/hooks/useNavigator";
|
|
import useUser from "@saleor/hooks/useUser";
|
|
import Attributes from "@saleor/icons/Attributes";
|
|
import Channels from "@saleor/icons/Channels";
|
|
import Navigation from "@saleor/icons/Navigation";
|
|
import Pages from "@saleor/icons/Pages";
|
|
import PageTypes from "@saleor/icons/PageTypes";
|
|
import PermissionGroups from "@saleor/icons/PermissionGroups";
|
|
import Plugins from "@saleor/icons/Plugins";
|
|
import ProductTypes from "@saleor/icons/ProductTypes";
|
|
import ShippingMethods from "@saleor/icons/ShippingMethods";
|
|
import SiteSettings from "@saleor/icons/SiteSettings";
|
|
import StaffMembers from "@saleor/icons/StaffMembers";
|
|
import Taxes from "@saleor/icons/Taxes";
|
|
import Warehouses from "@saleor/icons/Warehouses";
|
|
import { sectionNames } from "@saleor/intl";
|
|
import { maybe } from "@saleor/misc";
|
|
import { menuListUrl } from "@saleor/navigation/urls";
|
|
import { pageListUrl } from "@saleor/pages/urls";
|
|
import { pageTypeListUrl } from "@saleor/pageTypes/urls";
|
|
import { permissionGroupListUrl } from "@saleor/permissionGroups/urls";
|
|
import { pluginListUrl } from "@saleor/plugins/urls";
|
|
import { productTypeListUrl } from "@saleor/productTypes/urls";
|
|
import { shippingZonesListUrl } from "@saleor/shipping/urls";
|
|
import { siteSettingsUrl } from "@saleor/siteSettings/urls";
|
|
import { staffListUrl } from "@saleor/staff/urls";
|
|
import { taxSection } from "@saleor/taxes/urls";
|
|
import { PermissionEnum } from "@saleor/types/globalTypes";
|
|
import { warehouseSection } from "@saleor/warehouses/urls";
|
|
import React from "react";
|
|
import { IntlShape, useIntl } from "react-intl";
|
|
|
|
import ConfigurationPage, { MenuSection } from "./ConfigurationPage";
|
|
|
|
export function createConfigurationMenu(intl: IntlShape): MenuSection[] {
|
|
return [
|
|
{
|
|
label: intl.formatMessage({
|
|
defaultMessage: "Attributes and Product Types"
|
|
}),
|
|
menuItems: [
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "Determine attributes used to create product types",
|
|
id: "configurationMenuAttributes"
|
|
}),
|
|
icon: <Attributes fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_PRODUCTS,
|
|
title: intl.formatMessage(sectionNames.attributes),
|
|
url: attributeListUrl()
|
|
},
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "Define types of products you sell",
|
|
id: "configurationMenuProductTypes"
|
|
}),
|
|
icon: <ProductTypes fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_PRODUCTS,
|
|
title: intl.formatMessage(sectionNames.productTypes),
|
|
url: productTypeListUrl()
|
|
}
|
|
]
|
|
},
|
|
{
|
|
label: intl.formatMessage({
|
|
defaultMessage: "Product Settings"
|
|
}),
|
|
menuItems: [
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "Manage how your store charges tax",
|
|
id: "configurationMenuTaxes"
|
|
}),
|
|
icon: <Taxes fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_SETTINGS,
|
|
title: intl.formatMessage(sectionNames.taxes),
|
|
url: taxSection
|
|
}
|
|
]
|
|
},
|
|
{
|
|
label: intl.formatMessage({
|
|
defaultMessage: "Staff Settings"
|
|
}),
|
|
menuItems: [
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "Manage your employees and their permissions",
|
|
id: "configurationMenuStaff"
|
|
}),
|
|
icon: <StaffMembers fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_STAFF,
|
|
title: intl.formatMessage(sectionNames.staff),
|
|
url: staffListUrl()
|
|
},
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage:
|
|
"Manage your permission groups and their permissions",
|
|
id: "configurationMenuPermissionGroups"
|
|
}),
|
|
icon: <PermissionGroups fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_STAFF,
|
|
title: intl.formatMessage(sectionNames.permissionGroups),
|
|
url: permissionGroupListUrl()
|
|
}
|
|
]
|
|
},
|
|
{
|
|
label: intl.formatMessage({
|
|
defaultMessage: "Shipping Settings"
|
|
}),
|
|
menuItems: [
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "Manage how you ship out orders",
|
|
id: "configurationMenuShipping"
|
|
}),
|
|
icon: <ShippingMethods fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_SHIPPING,
|
|
title: intl.formatMessage(sectionNames.shipping),
|
|
url: shippingZonesListUrl()
|
|
},
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "Manage and update your warehouse information",
|
|
id: "configurationMenuWarehouses"
|
|
}),
|
|
icon: <Warehouses fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_PRODUCTS,
|
|
title: intl.formatMessage(sectionNames.warehouses),
|
|
url: warehouseSection
|
|
}
|
|
]
|
|
},
|
|
{
|
|
label: intl.formatMessage({
|
|
defaultMessage: "Multichannel"
|
|
}),
|
|
menuItems: [
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "Define and manage your sales channels",
|
|
id: "configurationMenuChannels"
|
|
}),
|
|
icon: <Channels fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_CHANNELS,
|
|
title: intl.formatMessage(sectionNames.channels),
|
|
url: channelsListUrl()
|
|
}
|
|
]
|
|
},
|
|
{
|
|
label: intl.formatMessage({
|
|
defaultMessage: "Content Management"
|
|
}),
|
|
menuItems: [
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "Define types of content pages used in your store",
|
|
id: "configurationMenuPageTypes"
|
|
}),
|
|
icon: <PageTypes fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_PAGES,
|
|
title: intl.formatMessage(sectionNames.pageTypes),
|
|
url: pageTypeListUrl()
|
|
},
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "Manage and add additional pages",
|
|
id: "configurationMenuPages"
|
|
}),
|
|
icon: <Pages fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_PAGES,
|
|
title: intl.formatMessage(sectionNames.pages),
|
|
url: pageListUrl()
|
|
}
|
|
]
|
|
},
|
|
{
|
|
label: intl.formatMessage({
|
|
defaultMessage: "Miscellaneous"
|
|
}),
|
|
menuItems: [
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "Define how users can navigate through your store",
|
|
id: "configurationMenuNavigation"
|
|
}),
|
|
icon: <Navigation fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_MENUS,
|
|
title: intl.formatMessage(sectionNames.navigation),
|
|
url: menuListUrl()
|
|
},
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "View and update your site settings",
|
|
id: "configurationMenuSiteSettings"
|
|
}),
|
|
icon: <SiteSettings fontSize="inherit" viewBox="0 0 44 44" />,
|
|
permission: PermissionEnum.MANAGE_SETTINGS,
|
|
title: intl.formatMessage(sectionNames.siteSettings),
|
|
url: siteSettingsUrl()
|
|
},
|
|
{
|
|
description: intl.formatMessage({
|
|
defaultMessage: "View and update your plugins and their settings.",
|
|
id: "configurationPluginsPages"
|
|
}),
|
|
icon: (
|
|
<Plugins
|
|
fontSize="inherit"
|
|
viewBox="-8 -5 44 44"
|
|
preserveAspectRatio="xMinYMin meet"
|
|
/>
|
|
),
|
|
permission: PermissionEnum.MANAGE_PLUGINS,
|
|
title: intl.formatMessage(sectionNames.plugins),
|
|
url: pluginListUrl()
|
|
}
|
|
]
|
|
}
|
|
];
|
|
}
|
|
|
|
export const configurationMenuUrl = "/configuration/";
|
|
|
|
export const ConfigurationSection: React.FC = () => {
|
|
const navigate = useNavigator();
|
|
const user = useUser();
|
|
const intl = useIntl();
|
|
|
|
return (
|
|
<>
|
|
<WindowTitle title={intl.formatMessage(sectionNames.configuration)} />
|
|
<ConfigurationPage
|
|
menu={createConfigurationMenu(intl)}
|
|
user={maybe(() => user.user)}
|
|
onSectionClick={navigate}
|
|
/>
|
|
</>
|
|
);
|
|
};
|
|
export default ConfigurationSection;
|