Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add configuration page component
dominik-zeglen6328180b2d37
diff --git a/saleor/static/dashboard-next/configuration/ConfigurationPage.tsx b/saleor/static/dashboard-next/configuration/ConfigurationPage.tsxnew file mode 100644index 0000000000..954a5833b3--- /dev/null+++ b/saleor/static/dashboard-next/configuration/ConfigurationPage.tsx@@ -0,0 +1,94 @@+import Card from "@material-ui/core/Card";+import CardContent from "@material-ui/core/CardContent";+import { withStyles } from "@material-ui/core/styles";+import Typography from "@material-ui/core/Typography";+import * as React from "react";++import { IconProps } from "@material-ui/core/Icon";+import Container from "../components/Container";+import PageHeader from "../components/PageHeader";+import i18n from "../i18n";++interface ConfigurationPageProps {+ menu: Array<{+ description: string;+ disabled: boolean;+ icon: () => React.Component<IconProps>;+ title: string;+ url: string;+ }>;+ onSectionClick: (sectionName: string) => void;+}++const decorate = withStyles(theme => ({+ card: {+ "&:hover": {+ boxShadow: "0 12px 12px rgba(0, 0, 0, 0.1)"+ },+ cursor: "pointer" as "pointer",+ marginBottom: theme.spacing.unit * 3,+ transition: theme.transitions.duration.standard + "ms"+ },+ cardContent: {+ // Overrides Material-UI default theme+ "&:last-child": {+ paddingBottom: 16+ },+ display: "grid" as "grid",+ gridColumnGap: theme.spacing.unit * 4 + "px",+ gridTemplateColumns: "48px 1fr"+ },+ cardDisabled: {+ "& $icon, & $sectionTitle, & $sectionDescription": {+ color: theme.palette.text.disabled+ },+ marginBottom: theme.spacing.unit * 3+ },+ icon: {+ color: theme.palette.primary.main,+ height: 48,+ width: 48+ },+ root: {+ display: "grid" as "grid",+ gridColumnGap: theme.spacing.unit * 4 + "px",+ gridTemplateColumns: "1fr 1fr"+ },+ sectionDescription: {},+ sectionTitle: {+ fontWeight: 600 as 600,+ marginBottom: 4+ }+}));+export const ConfigurationPage = decorate<ConfigurationPageProps>(+ ({ classes, menu, onSectionClick }) => (+ <Container width="md">+ <PageHeader title={i18n.t("Configure")} />+ <div className={classes.root}>+ {menu.map(menuItem => {+ const Icon = menuItem.icon;+ return (+ <Card+ className={+ menuItem.disabled ? classes.cardDisabled : classes.card+ }+ >+ <CardContent className={classes.cardContent}>+ <Icon className={classes.icon} />+ <div>+ <Typography className={classes.sectionTitle} color="primary">+ {menuItem.title}+ </Typography>+ <Typography className={classes.sectionDescription}>+ {menuItem.description}+ </Typography>+ </div>+ </CardContent>+ </Card>+ );+ })}+ </div>+ </Container>+ )+);+export default ConfigurationPage;diff --git a/saleor/static/dashboard-next/configuration/index.tsx b/saleor/static/dashboard-next/configuration/index.tsxnew file mode 100644index 0000000000..916a5d96e9--- /dev/null+++ b/saleor/static/dashboard-next/configuration/index.tsx@@ -0,0 +1,70 @@+import * as React from "react";+import i18n from "../i18n";++import AccountCircle from "../icons/AccountCircle";+import Ballot from "../icons/Ballot";+import Folder from "../icons/Folder";+import LocalShipping from "../icons/LocalShipping";+import Monetization from "../icons/Monetization";+import Navigation from "../icons/Navigation";+import Pages from "../icons/Pages";+import StoreMall from "../icons/StoreMall";++export const configurationMenu = [+ {+ description: i18n.t("Define types of products you sell"),+ disabled: true,+ icon: Folder,+ title: i18n.t("Product Types"),+ url: "/product/"+ },+ {+ description: i18n.t("Define attributes of products yousell"),+ disabled: true,+ icon: Ballot,+ title: i18n.t("Attributes"),+ url: "/attributes/"+ },+ {+ description: i18n.t("Manage your employees and their permissions"),+ disabled: true,+ icon: AccountCircle,+ title: i18n.t("Staff Members"),+ url: "/staff/"+ },+ {+ description: i18n.t("Manage how you ship out orders."),+ disabled: true,+ icon: LocalShipping,+ title: i18n.t("Shipping Methods"),+ url: "/shipping/"+ },+ {+ description: i18n.t("Manage how your store charges tax"),+ disabled: true,+ icon: Monetization,+ title: i18n.t("Taxes"),+ url: "/taxes/"+ },+ {+ description: i18n.t("Define how users can navigate through your store"),+ disabled: true,+ icon: Navigation,+ title: i18n.t("Navigation"),+ url: "/navigation/"+ },+ {+ description: i18n.t("View and update your site settings"),+ disabled: true,+ icon: StoreMall,+ title: i18n.t("Site Settings"),+ url: "/settings/"+ },+ {+ description: i18n.t("Manage and add additional pages"),+ disabled: false,+ icon: Pages,+ title: i18n.t("Pages"),+ url: "/pages/"+ }+];diff --git a/saleor/static/dashboard-next/icons/AccountCircle.tsx b/saleor/static/dashboard-next/icons/AccountCircle.tsxnew file mode 100644index 0000000000..330b37c547--- /dev/null+++ b/saleor/static/dashboard-next/icons/AccountCircle.tsx@@ -0,0 +1,20 @@+import createSvgIcon from "@material-ui/icons/utils/createSvgIcon";+import * as React from "react";++export const AccountCircle = createSvgIcon(+ <>+ <rect width="24" height="24" fill-opacity="0" />+ <rect width="20" height="20" fill-opacity="0" transform="translate(2 2)" />+ <rect+ width="20"+ height="20"+ fill="black"+ fill-opacity="0"+ transform="translate(2 2)"+ />+ <path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM7.07 18.28C7.5 17.38 10.12 16.5 12 16.5C13.88 16.5 16.51 17.38 16.93 18.28C15.57 19.36 13.86 20 12 20C10.14 20 8.43 19.36 7.07 18.28ZM18.36 16.83C16.93 15.09 13.46 14.5 12 14.5C10.54 14.5 7.07 15.09 5.64 16.83C4.62 15.49 4 13.82 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 13.82 19.38 15.49 18.36 16.83Z" />+ <path d="M12 6C10.06 6 8.5 7.56 8.5 9.5C8.5 11.44 10.06 13 12 13C13.94 13 15.5 11.44 15.5 9.5C15.5 7.56 13.94 6 12 6ZM12 11C11.17 11 10.5 10.33 10.5 9.5C10.5 8.67 11.17 8 12 8C12.83 8 13.5 8.67 13.5 9.5C13.5 10.33 12.83 11 12 11Z" />+ </>+);+AccountCircle.displayName = "AccountCircle";+export default AccountCircle;diff --git a/saleor/static/dashboard-next/icons/Ballot.tsx b/saleor/static/dashboard-next/icons/Ballot.tsxnew file mode 100644index 0000000000..35c125a3b7--- /dev/null+++ b/saleor/static/dashboard-next/icons/Ballot.tsx@@ -0,0 +1,17 @@+import createSvgIcon from "@material-ui/icons/utils/createSvgIcon";+import * as React from "react";++export const Ballot = createSvgIcon(+ <>+ <rect width="24" height="24" fill="black" fill-opacity="0" />+ <rect width="18" height="18" fill-opacity="0" transform="translate(3 3)" />+ <rect width="18" fill="black" fill-opacity="0" transform="translate(3 3)" />+ <path d="M18 7.5H13V9.5H18V7.5Z" />+ <path d="M18 14.5H13V16.5H18V14.5Z" />+ <path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19Z" />+ <path d="M11 6H6V11H11V6ZM10 10H7V7H10V10Z" />+ <path d="M11 13H6V18H11V13ZM10 17H7V14H10V17Z" />+ </>+);+Ballot.displayName = "Ballot";+export default Ballot;diff --git a/saleor/static/dashboard-next/icons/Folder.tsx b/saleor/static/dashboard-next/icons/Folder.tsxnew file mode 100644index 0000000000..110cae6463--- /dev/null+++ b/saleor/static/dashboard-next/icons/Folder.tsx@@ -0,0 +1,12 @@+import createSvgIcon from "@material-ui/icons/utils/createSvgIcon";+import * as React from "react";++export const Folder = createSvgIcon(+ <>+ <rect width="24" height="24" fill-opacity="0" />+ <rect width="20" height="16" fill-opacity="0" transform="translate(2 4)" />+ <path d="M9.17 6L11.17 8H20V18H4V6H9.17ZM10 4H4C2.9 4 2.01 4.9 2.01 6L2 18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V8C22 6.9 21.1 6 20 6H12L10 4Z" />+ </>+);+Folder.displayName = "Folder";+export default Folder;diff --git a/saleor/static/dashboard-next/icons/LocalShipping.tsx b/saleor/static/dashboard-next/icons/LocalShipping.tsxnew file mode 100644index 0000000000..9a89e0559e--- /dev/null+++ b/saleor/static/dashboard-next/icons/LocalShipping.tsx@@ -0,0 +1,12 @@+import createSvgIcon from "@material-ui/icons/utils/createSvgIcon";+import * as React from "react";++export const LocalShipping = createSvgIcon(+ <>+ <rect width="24" height="24" fill-opacity="0" />+ <rect width="22" height="16" fill-opacity="0" transform="translate(1 4)" />+ <path d="M20 8H17V4H3C1.9 4 1 4.9 1 6V17H3C3 18.66 4.34 20 6 20C7.66 20 9 18.66 9 17H15C15 18.66 16.34 20 18 20C19.66 20 21 18.66 21 17H23V12L20 8ZM19.5 9.5L21.46 12H17V9.5H19.5ZM6 18C5.45 18 5 17.55 5 17C5 16.45 5.45 16 6 16C6.55 16 7 16.45 7 17C7 17.55 6.55 18 6 18ZM8.22 15C7.67 14.39 6.89 14 6 14C5.11 14 4.33 14.39 3.78 15H3V6H15V15H8.22ZM18 18C17.45 18 17 17.55 17 17C17 16.45 17.45 16 18 16C18.55 16 19 16.45 19 17C19 17.55 18.55 18 18 18Z" />+ </>+);+LocalShipping.displayName = "LocalShipping";+export default LocalShipping;diff --git a/saleor/static/dashboard-next/icons/Monetization.tsx b/saleor/static/dashboard-next/icons/Monetization.tsxnew file mode 100644index 0000000000..f848366ec4--- /dev/null+++ b/saleor/static/dashboard-next/icons/Monetization.tsx@@ -0,0 +1,14 @@+import createSvgIcon from "@material-ui/icons/utils/createSvgIcon";+import * as React from "react";++export const Monetization = createSvgIcon(+ <>+ <rect width="24" height="24" fill="black" fill-opacity="0" />+ <rect width="20" height="20" fill-opacity="0" transform="translate(2 2)" />+ <rect width="20" height="20" fill-opacity="0" transform="translate(2 2)" />+ <path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z" />+ <path d="M12.31 11.14C10.54 10.69 9.97004 10.2 9.97004 9.47C9.97004 8.63 10.76 8.04 12.07 8.04C13.45 8.04 13.97 8.7 14.01 9.68H15.72C15.67 8.34 14.85 7.11 13.23 6.71V5H10.9V6.69C9.39004 7.01 8.18004 7.99 8.18004 9.5C8.18004 11.29 9.67004 12.19 11.84 12.71C13.79 13.17 14.18 13.86 14.18 14.58C14.18 15.11 13.79 15.97 12.08 15.97C10.48 15.97 9.85004 15.25 9.76004 14.33H8.04004C8.14004 16.03 9.40004 16.99 10.9 17.3V19H13.24V17.33C14.76 17.04 15.96 16.17 15.97 14.56C15.96 12.36 14.07 11.6 12.31 11.14Z" />+ </>+);+Monetization.displayName = "Monetization";+export default Monetization;diff --git a/saleor/static/dashboard-next/icons/Navigation.tsx b/saleor/static/dashboard-next/icons/Navigation.tsxnew file mode 100644index 0000000000..3d4d5fb86c--- /dev/null+++ b/saleor/static/dashboard-next/icons/Navigation.tsx@@ -0,0 +1,17 @@+import createSvgIcon from "@material-ui/icons/utils/createSvgIcon";+import * as React from "react";++export const Navigation = createSvgIcon(+ <>+ <rect width="24" height="24" fill-opacity="0" />+ <rect+ width="15"+ height="19"+ fill-opacity="0"+ transform="translate(4.5 2)"+ />+ <path d="M12 7.27L16.28 17.7L12.81 16.17L12 15.81L11.19 16.17L7.72 17.7L12 7.27ZM12 2L4.5 20.29L5.21 21L12 18L18.79 21L19.5 20.29L12 2Z" />+ </>+);+Navigation.displayName = "Navigation";+export default Navigation;diff --git a/saleor/static/dashboard-next/icons/Pages.tsx b/saleor/static/dashboard-next/icons/Pages.tsxnew file mode 100644index 0000000000..6c2b25450b--- /dev/null+++ b/saleor/static/dashboard-next/icons/Pages.tsx@@ -0,0 +1,12 @@+import createSvgIcon from "@material-ui/icons/utils/createSvgIcon";+import * as React from "react";++export const Pages = createSvgIcon(+ <>+ <rect width="24" height="24" fill-opacity="0" />+ <rect width="18" height="18" fill-opacity="0" transform="translate(3 3)" />+ <path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V12V5C21 3.9 20.1 3 19 3ZM13 5H19V11H16L17 7L13 8V5ZM5 5H11V8L7 7L8 11H5V5ZM11 19H5V13H8L7 17L11 16V19ZM19 19H13V16L17 17L16 13H19V19ZM14.63 14.63L12 13.72L9.37 14.63L10.28 12L9.37 9.37L12 10.28L14.63 9.37L13.72 12L14.63 14.63Z" />+ </>+);+Pages.displayName = "Pages";+export default Pages;diff --git a/saleor/static/dashboard-next/icons/StoreMall.tsx b/saleor/static/dashboard-next/icons/StoreMall.tsxnew file mode 100644index 0000000000..2c7ca12491--- /dev/null+++ b/saleor/static/dashboard-next/icons/StoreMall.tsx@@ -0,0 +1,12 @@+import createSvgIcon from "@material-ui/icons/utils/createSvgIcon";+import * as React from "react";++export const StoreMall = createSvgIcon(+ <>+ <rect width="24" height="24" fill-opacity="0" />+ <rect width="18" height="16" fill-opacity="0" transform="translate(3 4)" />+ <path d="M18.36 9L18.96 12H5.04L5.64 9H18.36ZM20 4H4V6H20V4ZM20 7H4L3 12V14H4V20H14V14H18V20H20V14H21V12L20 7ZM6 18V14H12V18H6Z" />+ </>+);+StoreMall.displayName = "StoreMall";+export default StoreMall;diff --git a/saleor/static/dashboard-next/storybook/config.js b/saleor/static/dashboard-next/storybook/config.jsindex 4f3f7d1bf0..9e1e035966 100644--- a/saleor/static/dashboard-next/storybook/config.js+++ b/saleor/static/dashboard-next/storybook/config.js@@ -42,6 +42,9 @@ function loadStories() {require("./stories/collections/CollectionDetailsPage");require("./stories/collections/CollectionListPage");+ // Configuration+ require("./stories/configuration/ConfigurationPage");+// Customersrequire("./stories/customers/CustomerDetailsPage");require("./stories/customers/CustomerEditPage");diff --git a/saleor/static/dashboard-next/storybook/stories/configuration/ConfigurationPage.tsx b/saleor/static/dashboard-next/storybook/stories/configuration/ConfigurationPage.tsxnew file mode 100644index 0000000000..0c5f0dfb5d--- /dev/null+++ b/saleor/static/dashboard-next/storybook/stories/configuration/ConfigurationPage.tsx@@ -0,0 +1,15 @@+import { storiesOf } from "@storybook/react";+import * as React from "react";++import { configurationMenu } from "../../../configuration";+import ConfigurationPage from "../../../configuration/ConfigurationPage";+import Decorator from "../../Decorator";++storiesOf("Views / Configuration", module)+ .addDecorator(Decorator)+ .add("default", () => (+ <ConfigurationPage+ menu={configurationMenu}+ onSectionClick={() => undefined}+ />+ ));