Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add site settings to configuratio menu
dominik-zeglen5496dc05c015
diff --git a/saleor/static/dashboard-next/configuration/index.tsx b/saleor/static/dashboard-next/configuration/index.tsxindex 9ec88ff6c2..69cdeafb84 100644--- a/saleor/static/dashboard-next/configuration/index.tsx+++ b/saleor/static/dashboard-next/configuration/index.tsx@@ -12,6 +12,7 @@ import Navigation from "../icons/Navigation";import Pages from "../icons/Pages";import StoreMall from "../icons/StoreMall";import { productTypeListUrl } from "../productTypes";+import { siteSettingsUrl } from "../siteSettings";import { staffListUrl } from "../staff";import { PermissionEnum } from "../types/globalTypes";import ConfigurationPage, { MenuItem } from "./ConfigurationPage";@@ -59,7 +60,8 @@ export const configurationMenu: MenuItem[] = [description: i18n.t("View and update your site settings"),icon: <StoreMall fontSize="inherit" />,permission: PermissionEnum.MANAGE_SETTINGS,- title: i18n.t("Site Settings")+ title: i18n.t("Site Settings"),+ url: siteSettingsUrl},{description: i18n.t("Manage and add additional pages"),diff --git a/saleor/static/dashboard-next/index.tsx b/saleor/static/dashboard-next/index.tsxindex 87fccc7b8a..9fec85239f 100644--- a/saleor/static/dashboard-next/index.tsx+++ b/saleor/static/dashboard-next/index.tsx@@ -28,10 +28,10 @@ import OrdersSection from "./orders";import PageSection from "./pages";import ProductSection from "./products";import ProductTypesSection from "./productTypes";+import SiteSettingsSection from "./siteSettings";import StaffSection from "./staff";import theme from "./theme";-import { PermissionEnum } from './types/globalTypes';-+import { PermissionEnum } from "./types/globalTypes";const cookies = new Cookies();@@ -125,6 +125,11 @@ render(path="/staff"component={StaffSection}/>+ <SectionRoute+ permissions={[PermissionEnum.MANAGE_SETTINGS]}+ path="/siteSettings"+ component={SiteSettingsSection}+ />{configurationMenu.filter(menuItem =>hasPermission(menuItem.permission, user)).length > 0 && (diff --git a/saleor/static/dashboard-next/siteSettings/index.tsx b/saleor/static/dashboard-next/siteSettings/index.tsxnew file mode 100644index 0000000000..d3b45f90f2--- /dev/null+++ b/saleor/static/dashboard-next/siteSettings/index.tsx@@ -0,0 +1,11 @@+import * as React from "react";+import { Route, RouteComponentProps } from "react-router-dom";++import SiteSettings from "./views/";++export const siteSettingsUrl = "/siteSettings";++export const SiteSettingsSection: React.StatelessComponent<+ RouteComponentProps<{}>+> = ({ match }) => <Route path={match.url} component={SiteSettings} />;+export default SiteSettingsSection;diff --git a/saleor/static/dashboard-next/siteSettings/views/index.tsx b/saleor/static/dashboard-next/siteSettings/views/index.tsxnew file mode 100644index 0000000000..03a0b216e0--- /dev/null+++ b/saleor/static/dashboard-next/siteSettings/views/index.tsx@@ -0,0 +1,20 @@+import * as React from "react";+import { maybe } from "../../misc";+import SiteSettingsPage from "../components/SiteSettingsPage";+import { TypedSiteSettingsQuery } from "../queries";++export const SiteSettings: React.StatelessComponent<{}> = () => (+ <TypedSiteSettingsQuery>+ {({ data, loading }) => (+ <SiteSettingsPage+ disabled={loading}+ shop={maybe(() => data.shop)}+ onKeyAdd={() => undefined}+ onKeyClick={() => undefined}+ onKeyRemove={() => undefined}+ onSubmit={() => undefined}+ />+ )}+ </TypedSiteSettingsQuery>+);+export default SiteSettings;diff --git a/saleor/static/dashboard-next/storybook/stories/siteSettings/SiteSettingsPage.tsx b/saleor/static/dashboard-next/storybook/stories/siteSettings/SiteSettingsPage.tsxindex ee6ad1ea41..0df05f6baa 100644--- a/saleor/static/dashboard-next/storybook/stories/siteSettings/SiteSettingsPage.tsx+++ b/saleor/static/dashboard-next/storybook/stories/siteSettings/SiteSettingsPage.tsx@@ -9,6 +9,9 @@ import Decorator from "../../Decorator";const props: SiteSettingsPageProps = {disabled: false,+ onKeyAdd: () => undefined,+ onKeyClick: () => undefined,+ onKeyRemove: () => undefined,onSubmit: () => undefined,shop};@@ -16,4 +19,6 @@ const props: SiteSettingsPageProps = {storiesOf("Views / Site settings / Page", module).addDecorator(Decorator).add("default", () => <SiteSettingsPage {...props} />)- .add("loading", () => <SiteSettingsPage {...props} disabled={true} />);+ .add("loading", () => (+ <SiteSettingsPage {...props} disabled={true} shop={undefined} />+ ));