Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
wip
dominik-zeglen579da43d891a
diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetails/CollectionDetails.tsx b/saleor/static/dashboard-next/collections/components/CollectionDetails/CollectionDetails.tsxdeleted file mode 100644index dc37485fa7..0000000000--- a/saleor/static/dashboard-next/collections/components/CollectionDetails/CollectionDetails.tsx+++ /dev/null@@ -1,77 +0,0 @@-import Card from "@material-ui/core/Card";-import CardContent from "@material-ui/core/CardContent";-import { withStyles } from "@material-ui/core/styles";-import TextField from "@material-ui/core/TextField";-import Typography from "@material-ui/core/Typography";-import * as classNames from "classnames";-import * as React from "react";--import FileUpload from "../../../components/FileUpload";-import FormSpacer from "../../../components/FormSpacer";-import Skeleton from "../../../components/Skeleton";-import i18n from "../../../i18n";--interface CollectionDetailsProps {- collection?: {- backgroundImage: string;- };- data: {- name: string;- backgroundImage: string;- };- disabled: boolean;- onChange(event: React.ChangeEvent<any>);- onImageRemove();-}--const decorate = withStyles(theme => ({- image: {- width: "100%"- },- link: {- color: theme.palette.secondary.main,- cursor: "pointer" as "pointer"- }-}));-const CollectionDetails = decorate<CollectionDetailsProps>(- ({ classes, collection, data, disabled, onChange, onImageRemove }) => (- <Card>- <CardContent>- <TextField- disabled={disabled}- fullWidth- label={i18n.t("Name")}- name="name"- onChange={onChange}- value={data.name}- />- <FormSpacer />- {collection ? (- <>- <img src={collection.backgroundImage} className={classes.image} />- <Typography- variant="caption"- className={classNames({- [classes.link]: !disabled- })}- onClick={disabled ? undefined : onImageRemove}- >- {i18n.t("Remove")}- </Typography>- </>- ) : (- <Skeleton />- )}- <FormSpacer />- <FileUpload- disabled={disabled}- name="backgroundImage"- onChange={onChange}- value={data.backgroundImage}- />- </CardContent>- </Card>- )-);-CollectionDetails.displayName = "CollectionDetails";-export default CollectionDetails;diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetails/index.ts b/saleor/static/dashboard-next/collections/components/CollectionDetails/index.tsdeleted file mode 100644index 5f4e124e70..0000000000--- a/saleor/static/dashboard-next/collections/components/CollectionDetails/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default } from "./CollectionDetails";-export * from "./CollectionDetails";diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsxdeleted file mode 100644index a0a3603317..0000000000--- a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx+++ /dev/null@@ -1,218 +0,0 @@-import Button from "@material-ui/core/Button";-import DialogContentText from "@material-ui/core/DialogContentText";-import { withStyles } from "@material-ui/core/styles";-import * as React from "react";--import ActionDialog from "../../../components/ActionDialog";-import Container from "../../../components/Container";-import Form from "../../../components/Form";-import PageHeader from "../../../components/PageHeader";-import SaveButtonBar, {- SaveButtonBarState-} from "../../../components/SaveButtonBar";-import SeoForm from "../../../components/SeoForm";-import Toggle from "../../../components/Toggle";-import i18n from "../../../i18n";-import CollectionDetails from "../CollectionDetails";-import CollectionProducts from "../CollectionProducts";-import CollectionProperties from "../CollectionProperties";--interface CollectionForm {- name: string;- slug: string;- isPublished: boolean;- backgroundImage: string;- seoDescription?: string;- seoTitle?: string;-}-interface CollectionDetailsPageProps {- collection?: CollectionForm;- disabled?: boolean;- products?: Array<{- id: string;- name: string;- sku: string;- availability: {- available: boolean;- };- }>;- pageInfo?: {- hasNextPage: boolean;- hasPreviousPage: boolean;- };- saveButtonBarState?: SaveButtonBarState;- storefrontUrl: (slug: string) => string;- onBack: () => void;- onDelete: () => void;- onImageRemove: () => void;- onNextPage: () => void;- onPreviousPage: () => void;- onProductAdd: () => void;- onProductClick: (id: string) => () => void;- onProductRemove: (id: string) => () => void;- onSeoClick?: (slug: string) => () => void;- onShow: () => void;- onSubmit: (data: CollectionForm) => void;-}--const decorate = withStyles(theme => ({- cardSpacer: {- marginTop: theme.spacing.unit * 2,- [theme.breakpoints.down("md")]: {- marginTop: theme.spacing.unit- }- },- root: {- display: "grid" as "grid",- gridColumnGap: theme.spacing.unit * 2 + "px",- gridTemplateColumns: "3fr 2fr"- }-}));-const CollectionDetailsPage = decorate<CollectionDetailsPageProps>(- ({- classes,- collection,- disabled,- pageInfo,- products,- saveButtonBarState,- storefrontUrl,- onBack,- onDelete,- onImageRemove,- onNextPage,- onPreviousPage,- onProductAdd,- onProductClick,- onProductRemove,- onSeoClick,- onShow,- onSubmit- }) => (- <Toggle>- {(openedRemoveDialog, { toggle: toggleRemoveDialog }) => (- <Toggle>- {(openedImageRemoveDialog, { toggle: toggleImageRemoveDialog }) => (- <>- <Form- initial={{- backgroundImage: "",- isPublished: collection ? collection.isPublished : false,- name: collection ? collection.name : "",- seoDescription: collection ? collection.seoDescription : "",- seoTitle: collection ? collection.seoTitle : "",- slug: collection ? collection.slug : ""- }}- onSubmit={onSubmit}- >- {({ change, data, hasChanged, submit }) => (- <Container width="md">- <PageHeader- title={collection ? collection.name : undefined}- onBack={onBack}- >- <Button- color="secondary"- variant="flat"- disabled={disabled}- onClick={onShow}- >- {i18n.t("Show on storefront")}- </Button>- </PageHeader>- <div className={classes.root}>- <div>- <CollectionDetails- collection={collection}- disabled={disabled}- data={data}- onChange={change}- onImageRemove={toggleImageRemoveDialog}- />- <CollectionProducts- products={products}- pageInfo={pageInfo}- disabled={disabled}- onNextPage={onNextPage}- onPreviousPage={onPreviousPage}- onProductAdd={onProductAdd}- onProductClick={onProductClick}- onProductRemove={onProductRemove}- />- <div className={classes.cardSpacer} />- <SeoForm- helperText={i18n.t(- "Add search engine title and description to make this collection easier to find"- )}- description={data.seoDescription}- descriptionPlaceholder={- collection && collection.seoDescription- ? collection.seoDescription- : i18n.t("No description provided")- }- onChange={change}- onClick={- !!onSeoClick ? onSeoClick(data.seoTitle) : undefined- }- storefrontUrl={storefrontUrl(data.slug)}- title={data.seoTitle}- titlePlaceholder={data.name}- />- </div>- <div>- <CollectionProperties- collection={collection}- data={data}- onChange={change}- disabled={disabled}- />- </div>- </div>- <SaveButtonBar- onCancel={onBack}- onDelete={toggleRemoveDialog}- onSave={submit}- disabled={disabled || !onSubmit || !hasChanged}- state={saveButtonBarState}- />- </Container>- )}- </Form>- <ActionDialog- onClose={toggleRemoveDialog}- onConfirm={onDelete}- open={openedRemoveDialog}- title={i18n.t("Remove collection")}- variant="delete"- >- <DialogContentText- dangerouslySetInnerHTML={{- __html: i18n.t(- "Are you sure you want to remove <strong>{{ name }}</strong>?",- { name: collection ? collection.name : undefined }- )- }}- />- </ActionDialog>- <ActionDialog- onClose={toggleImageRemoveDialog}- onConfirm={onImageRemove}- open={openedImageRemoveDialog}- title={i18n.t("Remove image")}- variant="delete"- >- <DialogContentText>- {i18n.t(- "Are you sure you want to remove collection's image?"- )}- </DialogContentText>- </ActionDialog>- </>- )}- </Toggle>- )}- </Toggle>- )-);-CollectionDetailsPage.displayName = "CollectionDetailsPage";-export default CollectionDetailsPage;diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/index.ts b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/index.tsdeleted file mode 100644index 641c72a745..0000000000--- a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default } from "./CollectionDetailsPage";-export * from "./CollectionDetailsPage";diff --git a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsxindex 9f6e925f1c..01135484b3 100644--- a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx+++ b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx@@ -1,128 +1,9 @@-import Card from "@material-ui/core/Card";import { withStyles } from "@material-ui/core/styles";-import Table from "@material-ui/core/Table";-import TableBody from "@material-ui/core/TableBody";-import TableCell from "@material-ui/core/TableCell";-import TableFooter from "@material-ui/core/TableFooter";-import TableHead from "@material-ui/core/TableHead";-import TableRow from "@material-ui/core/TableRow";-import * as classNames from "classnames";import * as React from "react";-import { ListProps } from "../../..";-import Skeleton from "../../../components/Skeleton";-import StatusLabel from "../../../components/StatusLabel";-import TablePagination from "../../../components/TablePagination";-import i18n from "../../../i18n";-import { renderCollection } from "../../../misc";+interface CollectionListProps {}-interface CollectionListProps extends ListProps {- collections?: Array<{- id: string;- name: string;- slug: string;- isPublished: boolean;- products: {- totalCount: number;- };- }>;-}--const decorate = withStyles(theme => ({- link: {- color: theme.palette.secondary.main,- cursor: "pointer" as "pointer"- },- textRight: {- textAlign: "right" as "right"- }-}));-const CollectionList = decorate<CollectionListProps>(- ({- classes,- disabled,- collections,- pageInfo,- onRowClick,- onNextPage,- onPreviousPage- }) => (- <Card>- <Table>- <TableHead>- <TableRow>- <TableCell>{i18n.t("Name", { context: "object" })}</TableCell>- <TableCell>{i18n.t("Visibility", { context: "object" })}</TableCell>- <TableCell className={classes.textRight}>- {i18n.t("Products", { context: "object" })}- </TableCell>- </TableRow>- </TableHead>- <TableFooter>- <TableRow>- <TablePagination- colSpan={3}- hasNextPage={pageInfo && !disabled ? pageInfo.hasNextPage : false}- onNextPage={onNextPage}- hasPreviousPage={- pageInfo && !disabled ? pageInfo.hasPreviousPage : false- }- onPreviousPage={onPreviousPage}- />- </TableRow>- </TableFooter>- <TableBody>- {renderCollection(- collections,- collection => (- <TableRow key={collection ? collection.id : "skeleton"}>- <TableCell- onClick={- collection && onRowClick- ? onRowClick(collection.id)- : undefined- }- className={classNames({- [classes.link]: collection- })}- >- {collection ? collection.name : <Skeleton />}- </TableCell>- <TableCell>- {collection ? (- <StatusLabel- status={collection.isPublished ? "success" : "error"}- label={- collection.isPublished- ? i18n.t("Published")- : i18n.t("Not published")- }- />- ) : (- <Skeleton />- )}- </TableCell>- <TableCell className={classes.textRight}>- {collection && collection.products ? (- collection.products.totalCount- ) : (- <Skeleton />- )}- </TableCell>- </TableRow>- ),- () => (- <TableRow>- <TableCell colSpan={3}>- {i18n.t("No collections found")}- </TableCell>- </TableRow>- )- )}- </TableBody>- </Table>- </Card>- )-);+const decorate = withStyles(theme => ({ root: {} }));+const CollectionList = decorate<CollectionListProps>(({ classes }) => <div />);CollectionList.displayName = "CollectionList";export default CollectionList;diff --git a/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsx b/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsxindex 7baa1e255c..186df613e0 100644--- a/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsx+++ b/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsx@@ -6,48 +6,29 @@ import { PageListProps } from "../../..";import { Container } from "../../../components/Container";import PageHeader from "../../../components/PageHeader";import i18n from "../../../i18n";-import CollectionList from "../CollectionList/CollectionList";+import { CollectionList_collections_edges_node } from "../../types/CollectionList";interface CollectionListPageProps extends PageListProps {- collections?: Array<{- id: string;- name: string;- slug: string;- isPublished: boolean;- products: {- totalCount: number;- };- }>;+ collections: CollectionList_collections_edges_node[];}const CollectionListPage: React.StatelessComponent<CollectionListPageProps> = ({- collections,disabled,- pageInfo,onAdd,- onNextPage,- onPreviousPage,- onRowClick+ ...listProps}) => (<Container width="md">- <PageHeader title={i18n.t("Collections")}>+ <PageHeader title={i18n.t("Collections", { context: "page title" })}><Buttoncolor="secondary"- variant="contained"disabled={disabled}+ variant="contained"onClick={onAdd}>- {i18n.t("Add collection")} <AddIcon />+ {i18n.t("Add collections", { context: "button" })}+ <AddIcon /></Button></PageHeader>- <CollectionList- collections={collections}- disabled={disabled}- pageInfo={pageInfo}- onRowClick={onRowClick}- onNextPage={onNextPage}- onPreviousPage={onPreviousPage}- /></Container>);CollectionListPage.displayName = "CollectionListPage";diff --git a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx b/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsxdeleted file mode 100644index b35296c9f1..0000000000--- a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx+++ /dev/null@@ -1,144 +0,0 @@-import Button from "@material-ui/core/Button";-import Card from "@material-ui/core/Card";-import { withStyles } from "@material-ui/core/styles";-import Table from "@material-ui/core/Table";-import TableBody from "@material-ui/core/TableBody";-import TableCell from "@material-ui/core/TableCell";-import TableFooter from "@material-ui/core/TableFooter";-import TableHead from "@material-ui/core/TableHead";-import TableRow from "@material-ui/core/TableRow";-import * as React from "react";--import CardTitle from "../../../components/CardTitle";-import Skeleton from "../../../components/Skeleton";-import StatusLabel from "../../../components/StatusLabel";-import TablePagination from "../../../components/TablePagination";-import i18n from "../../../i18n";-import { renderCollection } from "../../../misc";--interface CollectionProductsProps {- disabled?: boolean;- pageInfo?: {- hasNextPage: boolean;- hasPreviousPage: boolean;- };- products: Array<{- id: string;- name: string;- sku: string;- availability: {- available: boolean;- };- }>;- onNextPage();- onPreviousPage();- onProductAdd?();- onProductClick?(id: string): () => void;- onProductRemove?(id: string): () => void;-}--const decorate = withStyles(theme => ({- link: {- color: theme.palette.secondary.main,- cursor: "pointer" as "pointer"- },- root: {- marginTop: theme.spacing.unit * 2,- [theme.breakpoints.down("md")]: {- marginTop: theme.spacing.unit- }- }-}));-const CollectionProducts = decorate<CollectionProductsProps>(- ({- classes,- disabled,- pageInfo,- products,- onProductAdd,- onNextPage,- onPreviousPage,- onProductClick- }) => (- <Card className={classes.root}>- <CardTitle- title={i18n.t("Products")}- toolbar={- <Button- color="secondary"- variant="flat"- disabled={disabled}- onClick={onProductAdd}- >- {i18n.t("Add product")}- </Button>- }- />- <Table>- <TableHead>- <TableRow>- <TableCell>{i18n.t("Name", { context: "object" })}</TableCell>- <TableCell>{i18n.t("SKU", { context: "object" })}</TableCell>- <TableCell>{i18n.t("Status", { context: "object" })}</TableCell>- </TableRow>- </TableHead>- <TableFooter>- <TableRow>- <TablePagination- colSpan={3}- hasNextPage={pageInfo ? pageInfo.hasNextPage : false}- onNextPage={onNextPage}- hasPreviousPage={pageInfo ? pageInfo.hasPreviousPage : false}- onPreviousPage={onPreviousPage}- />- </TableRow>- </TableFooter>- <TableBody>- {renderCollection(- products,- product => (- <TableRow key={product ? product.id : "skeleton"}>- <TableCell- onClick={- product && onProductClick && onProductClick(product.id)- }- className={classes.link}- >- {product ? product.name : <Skeleton />}- </TableCell>- <TableCell>{product ? product.sku : <Skeleton />}</TableCell>- <TableCell>- {product ? (- <StatusLabel- status={- product.availability && product.availability.available- ? "success"- : "error"- }- label={- product.availability && product.availability.available- ? i18n.t("Published")- : i18n.t("Not published")- }- />- ) : (- <Skeleton />- )}- </TableCell>- </TableRow>- ),- () => (- <TableRow>- <TableCell colSpan={3}>- {i18n.t("This collection has no products")}- </TableCell>- </TableRow>- )- )}- </TableBody>- </Table>- </Card>- )-);-CollectionProducts.displayName = "CollectionProducts";-export default CollectionProducts;diff --git a/saleor/static/dashboard-next/collections/components/CollectionProducts/index.ts b/saleor/static/dashboard-next/collections/components/CollectionProducts/index.tsdeleted file mode 100644index 3f37d0ff8b..0000000000--- a/saleor/static/dashboard-next/collections/components/CollectionProducts/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default } from "./CollectionProducts";-export * from "./CollectionProducts";diff --git a/saleor/static/dashboard-next/collections/components/CollectionProperties/CollectionProperties.tsx b/saleor/static/dashboard-next/collections/components/CollectionProperties/CollectionProperties.tsxdeleted file mode 100644index e0b50148b6..0000000000--- a/saleor/static/dashboard-next/collections/components/CollectionProperties/CollectionProperties.tsx+++ /dev/null@@ -1,61 +0,0 @@-import Card from "@material-ui/core/Card";-import CardContent from "@material-ui/core/CardContent";-import { withStyles } from "@material-ui/core/styles";-import TextField from "@material-ui/core/TextField";-import * as React from "react";--import CardTitle from "../../../components/CardTitle";-import ControlledCheckbox from "../../../components/ControlledCheckbox";-import FormSpacer from "../../../components/FormSpacer";-import i18n from "../../../i18n";--interface CollectionPropertiesProps {- collection?: {- isPublished: boolean;- slug: string;- };- data: {- isPublished: boolean;- slug: string;- };- disabled?: boolean;- onChange?(event: React.ChangeEvent<any>);-}--const decorate = withStyles(theme => ({- root: {- marginBottom: theme.spacing.unit * 2,- [theme.breakpoints.down("md")]: { marginBottom: theme.spacing.unit }- }-}));-const CollectionProperties = decorate<CollectionPropertiesProps>(- ({ classes, collection, data, disabled, onChange }) => (- <Card className={classes.root}>- <CardTitle title={i18n.t("Properties")} />- <CardContent>- <ControlledCheckbox- checked={data.isPublished}- disabled={disabled}- label={i18n.t("Published")}- name="isPublished"- onChange={onChange}- />- <FormSpacer />- <TextField- disabled={disabled}- fullWidth- helperText={i18n.t(- "Slugs are used to create nice URLs for collection pages"- )}- label={i18n.t("Slug")}- name="slug"- onChange={onChange}- placeholder={collection ? collection.slug : ""}- value={data.slug}- />- </CardContent>- </Card>- )-);-CollectionProperties.displayName = "CollectionProperties";-export default CollectionProperties;diff --git a/saleor/static/dashboard-next/collections/components/CollectionProperties/index.ts b/saleor/static/dashboard-next/collections/components/CollectionProperties/index.tsdeleted file mode 100644index 6ea1a7d9b4..0000000000--- a/saleor/static/dashboard-next/collections/components/CollectionProperties/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default } from "./CollectionProperties";-export * from "./CollectionProperties";diff --git a/saleor/static/dashboard-next/collections/fixtures.ts b/saleor/static/dashboard-next/collections/fixtures.tsdeleted file mode 100644index f76f6128de..0000000000--- a/saleor/static/dashboard-next/collections/fixtures.ts+++ /dev/null@@ -1,492 +0,0 @@-export const collections = (placeholderImage: string) => [- {- backgroundImage: placeholderImage,- id: "col73193",- isPublished: true,- name: "Music",- products: {- edges: [- {- node: {- availability: { available: true },- id: "p61840",- name: "Incredible Frozen Cheese",- sku: "88720"- }- },- {- node: {- availability: { available: false },- id: "p96004",- name: "Unbranded Granite Mouse",- sku: "40275"- }- },- {- node: {- availability: { available: true },- id: "p33576",- name: "Tasty Fresh Cheese",- sku: "22544"- }- },- {- node: {- availability: { available: true },- id: "p72278",- name: "Sleek Fresh Table",- sku: "12875"- }- },- {- node: {- availability: { available: true },- id: "p84528",- name: "Licensed Frozen Salad",- sku: "11442"- }- }- ],- totalCount: 5- },- seoDescription: "",- seoTitle: "Music",- slug: "Music"- },- {- backgroundImage: placeholderImage,- id: "col78742",- isPublished: false,- name: "Outdoors",- products: {- edges: [- {- node: {- availability: { available: true },- id: "p32729",- name: "Rustic Steel Sausages",- sku: "86875"- }- }- ],- totalCount: 1- },- seoDescription: "",- seoTitle: "Outdoors",- slug: "Outdoors"- },- {- backgroundImage: placeholderImage,- id: "col21309",- isPublished: false,- name: "Electronics",- products: {- edges: [- {- node: {- availability: { available: true },- id: "p21203",- name: "Practical Rubber Hat",- sku: "73956"- }- },- {- node: {- availability: { available: true },- id: "p52073",- name: "Rustic Fresh Gloves",- sku: "92384"- }- },- {- node: {- availability: { available: true },- id: "p28092",- name: "Handmade Rubber Chair",- sku: "84522"- }- },- {- node: {- availability: { available: true },- id: "p29858",- name: "Small Frozen Sausages",- sku: "56909"- }- },- {- node: {- availability: { available: true },- id: "p69907",- name: "Fantastic Plastic Bacon",- sku: "65308"- }- },- {- node: {- availability: { available: true },- id: "p59266",- name: "Incredible Frozen Chair",- sku: "51391"- }- },- {- node: {- availability: { available: false },- id: "p70014",- name: "Ergonomic Steel Bacon",- sku: "15166"- }- },- {- node: {- availability: { available: true },- id: "p6068",- name: "Fantastic Plastic Hat",- sku: "66611"- }- },- {- node: {- availability: { available: false },- id: "p37064",- name: "Sleek Steel Salad",- sku: "21716"- }- }- ],- totalCount: 9- },- seoDescription: "",- seoTitle: "Electronics",- slug: "Electronics"- },- {- backgroundImage: placeholderImage,- id: "col66888",- isPublished: true,- name: "Automotive",- products: {- edges: [- {- node: {- availability: { available: false },- id: "p76134",- name: "Small Frozen Shoes",- sku: "23059"- }- },- {- node: {- availability: { available: false },- id: "p61397",- name: "Intelligent Plastic Bike",- sku: "97775"- }- },- {- node: {- availability: { available: false },- id: "p73134",- name: "Tasty Soft Chair",- sku: "92727"- }- },- {- node: {- availability: { available: false },- id: "p48359",- name: "Sleek Steel Sausages",- sku: "71009"- }- },- {- node: {- availability: { available: true },- id: "p95330",- name: "Ergonomic Concrete Keyboard",- sku: "82249"- }- }- ],- totalCount: 5- },- seoDescription:- "Id adipisci et. Officiis corrupti eveniet tempora explicabo occaecati et est.",- seoTitle: "Automotive",- slug: "Automotive"- },- {- backgroundImage: placeholderImage,- id: "col39785",- isPublished: true,- name: "Baby",- products: {- edges: [- {- node: {- availability: { available: true },- id: "p22330",- name: "Practical Wooden Keyboard",- sku: "12110"- }- },- {- node: {- availability: { available: true },- id: "p80153",- name: "Gorgeous Soft Table",- sku: "76328"- }- },- {- node: {- availability: { available: true },- id: "p18907",- name: "Intelligent Steel Towels",- sku: "38557"- }- },- {- node: {- availability: { available: true },- id: "p83499",- name: "Handmade Frozen Pizza",- sku: "50026"- }- },- {- node: {- availability: { available: true },- id: "p46072",- name: "Practical Plastic Pants",- sku: "55955"- }- },- {- node: {- availability: { available: false },- id: "p66784",- name: "Generic Concrete Keyboard",- sku: "82909"- }- }- ],- totalCount: 6- },- seoDescription:- "Pariatur dolores architecto. Dolores vel voluptatem corporis aut itaque omnis et.",- seoTitle: "Baby",- slug: "Baby"- },- {- backgroundImage: placeholderImage,- id: "col96888",- isPublished: false,- name: "Home",- products: { edges: [], totalCount: 0 },- seoDescription: "",- seoTitle: "Home",- slug: "Home"- },- {- backgroundImage: placeholderImage,- id: "col44906",- isPublished: true,- name: "Shoes",- products: {- edges: [- {- node: {- availability: { available: true },- id: "p3376",- name: "Practical Steel Sausages",- sku: "2292"- }- },- {- node: {- availability: { available: false },- id: "p85245",- name: "Generic Metal Pants",- sku: "932"- }- },- {- node: {- availability: { available: true },- id: "p46338",- name: "Small Steel Towels",- sku: "75074"- }- },- {- node: {- availability: { available: true },- id: "p30422",- name: "Unbranded Granite Hat",- sku: "23686"- }- },- {- node: {- availability: { available: true },- id: "p57742",- name: "Ergonomic Steel Ball",- sku: "68738"- }- },- {- node: {- availability: { available: false },- id: "p10458",- name: "Small Fresh Salad",- sku: "67682"- }- },- {- node: {- availability: { available: true },- id: "p91478",- name: "Incredible Soft Gloves",- sku: "41371"- }- },- {- node: {- availability: { available: true },- id: "p45089",- name: "Unbranded Metal Bike",- sku: "52220"- }- }- ],- totalCount: 8- },- seoDescription: "",- seoTitle: "Shoes",- slug: "Shoes"- },- {- backgroundImage: placeholderImage,- id: "col56511",- isPublished: false,- name: "Shoes",- products: {- edges: [- {- node: {- availability: { available: true },- id: "p47853",- name: "Gorgeous Concrete Bacon",- sku: "40721"- }- },- {- node: {- availability: { available: true },- id: "p83490",- name: "Small Cotton Chair",- sku: "71351"- }- }- ],- totalCount: 2- },- seoDescription: "",- seoTitle: "Shoes",- slug: "Shoes"- },- {- backgroundImage: placeholderImage,- id: "col28697",- isPublished: true,- name: "Electronics",- products: {- edges: [- {- node: {- availability: { available: true },- id: "p91492",- name: "Incredible Steel Chair",- sku: "29027"- }- },- {- node: {- availability: { available: false },- id: "p79477",- name: "Sleek Rubber Chair",- sku: "17432"- }- },- {- node: {- availability: { available: false },- id: "p53072",- name: "Generic Rubber Gloves",- sku: "17569"- }- },- {- node: {- availability: { available: true },- id: "p71826",- name: "Ergonomic Soft Cheese",- sku: "81642"- }- }- ],- totalCount: 4- },- seoDescription: "",- seoTitle: "Electronics",- slug: "Electronics"- },- {- backgroundImage: placeholderImage,- id: "col59691",- isPublished: true,- name: "Jewelery",- products: {- edges: [- {- node: {- availability: { available: true },- id: "p45012",- name: "Practical Granite Gloves",- sku: "87399"- }- },- {- node: {- availability: { available: true },- id: "p61262",- name: "Sleek Granite Hat",- sku: "46821"- }- },- {- node: {- availability: { available: true },- id: "p67158",- name: "Ergonomic Plastic Ball",- sku: "88963"- }- },- {- node: {- availability: { available: true },- id: "p36969",- name: "Incredible Frozen Mouse",- sku: "32377"- }- }- ],- totalCount: 4- },- seoDescription: "",- seoTitle: "Jewelery",- slug: "Jewelery"- }-];diff --git a/saleor/static/dashboard-next/collections/index.ts b/saleor/static/dashboard-next/collections/index.tsdeleted file mode 100644index c3f8d918aa..0000000000--- a/saleor/static/dashboard-next/collections/index.ts+++ /dev/null@@ -1,4 +0,0 @@-// FIXME: at this moment it is not clear if storefront url should contain-// PostgreSQL ID or just slug, to for now it's only placeholder-export const storefrontUrl = (slug: string) =>- `/products/collection/${slug}-1/`;diff --git a/saleor/static/dashboard-next/collections/queries.ts b/saleor/static/dashboard-next/collections/queries.tsnew file mode 100644index 0000000000..6fced27fbf--- /dev/null+++ b/saleor/static/dashboard-next/collections/queries.ts@@ -0,0 +1,90 @@+import gql from "graphql-tag";++import { TypedQuery } from "../queries";+import {+ CollectionDetails,+ CollectionDetailsVariables+} from "./types/CollectionDetails";+import {+ CollectionList,+ CollectionListVariables+} from "./types/CollectionList";++export const collectionFragment = gql`+ fragment CollectionFragment on Collection {+ id+ isPublished+ name+ products {+ totalCount+ }+ }+`;++export const collectionDetailsFragment = gql`+ ${collectionFragment}+ fragment CollectionDetailsFragment on Collection {+ backgroundImage {+ url+ }+ seoDescription+ seoTitle+ isPublished+ }+`;++export const collectionList = gql`+ ${collectionFragment}+ query CollectionList(+ $first: Int+ $after: String+ $last: Int+ $before: String+ ) {+ collections(first: $first, after: $after, before: $before, last: $last) {+ edges {+ node {+ ...CollectionFragment+ }+ }+ }+ }+`;+export const TypedCollectionListQuery = TypedQuery<+ CollectionList,+ CollectionListVariables+>(collectionList);++export const collectionDetails = gql`+ ${collectionDetailsFragment}+ query CollectionDetails(+ $id: ID!+ $first: Int+ $after: String+ $last: Int+ $before: String+ ) {+ collection(id: $id) {+ ...CollectionDetailsFragment+ products(first: $first, after: $after, before: $before, last: $last) {+ edges {+ cursor+ node {+ id+ isPublished+ name+ productType {+ id+ name+ }+ thumbnailUrl+ }+ }+ }+ }+ }+`;+export const TypedCollectionDetailsQuery = TypedQuery<+ CollectionDetails,+ CollectionDetailsVariables+>(collectionDetails);diff --git a/saleor/static/dashboard-next/collections/types/CollectionDetails.ts b/saleor/static/dashboard-next/collections/types/CollectionDetails.tsnew file mode 100644index 0000000000..a515fbb84b--- /dev/null+++ b/saleor/static/dashboard-next/collections/types/CollectionDetails.ts@@ -0,0 +1,58 @@+/* tslint:disable */+// This file was automatically generated and should not be edited.++// ====================================================+// GraphQL query operation: CollectionDetails+// ====================================================++export interface CollectionDetails_collection_backgroundImage {+ __typename: "Image";+ url: string;+}++export interface CollectionDetails_collection_products_edges_node_productType {+ __typename: "ProductType";+ id: string;+ name: string;+}++export interface CollectionDetails_collection_products_edges_node {+ __typename: "Product";+ id: string;+ isPublished: boolean;+ name: string;+ productType: CollectionDetails_collection_products_edges_node_productType;+ thumbnailUrl: string | null;+}++export interface CollectionDetails_collection_products_edges {+ __typename: "ProductCountableEdge";+ cursor: string;+ node: CollectionDetails_collection_products_edges_node;+}++export interface CollectionDetails_collection_products {+ __typename: "ProductCountableConnection";+ edges: CollectionDetails_collection_products_edges[];+}++export interface CollectionDetails_collection {+ __typename: "Collection";+ backgroundImage: CollectionDetails_collection_backgroundImage | null;+ seoDescription: string | null;+ seoTitle: string | null;+ isPublished: boolean;+ products: CollectionDetails_collection_products | null;+}++export interface CollectionDetails {+ collection: CollectionDetails_collection | null;+}++export interface CollectionDetailsVariables {+ id: string;+ first?: number | null;+ after?: string | null;+ last?: number | null;+ before?: string | null;+}diff --git a/saleor/static/dashboard-next/collections/types/CollectionDetailsFragment.ts b/saleor/static/dashboard-next/collections/types/CollectionDetailsFragment.tsnew file mode 100644index 0000000000..3f8b8b4b74--- /dev/null+++ b/saleor/static/dashboard-next/collections/types/CollectionDetailsFragment.ts@@ -0,0 +1,19 @@+/* tslint:disable */+// This file was automatically generated and should not be edited.++// ====================================================+// GraphQL fragment: CollectionDetailsFragment+// ====================================================++export interface CollectionDetailsFragment_backgroundImage {+ __typename: "Image";+ url: string;+}++export interface CollectionDetailsFragment {+ __typename: "Collection";+ backgroundImage: CollectionDetailsFragment_backgroundImage | null;+ seoDescription: string | null;+ seoTitle: string | null;+ isPublished: boolean;+}diff --git a/saleor/static/dashboard-next/collections/types/CollectionFragment.ts b/saleor/static/dashboard-next/collections/types/CollectionFragment.tsnew file mode 100644index 0000000000..3f9814ad4e--- /dev/null+++ b/saleor/static/dashboard-next/collections/types/CollectionFragment.ts@@ -0,0 +1,19 @@+/* tslint:disable */+// This file was automatically generated and should not be edited.++// ====================================================+// GraphQL fragment: CollectionFragment+// ====================================================++export interface CollectionFragment_products {+ __typename: "ProductCountableConnection";+ totalCount: number | null;+}++export interface CollectionFragment {+ __typename: "Collection";+ id: string;+ isPublished: boolean;+ name: string;+ products: CollectionFragment_products | null;+}diff --git a/saleor/static/dashboard-next/collections/types/CollectionList.ts b/saleor/static/dashboard-next/collections/types/CollectionList.tsnew file mode 100644index 0000000000..6556851aea--- /dev/null+++ b/saleor/static/dashboard-next/collections/types/CollectionList.ts@@ -0,0 +1,40 @@+/* tslint:disable */+// This file was automatically generated and should not be edited.++// ====================================================+// GraphQL query operation: CollectionList+// ====================================================++export interface CollectionList_collections_edges_node_products {+ __typename: "ProductCountableConnection";+ totalCount: number | null;+}++export interface CollectionList_collections_edges_node {+ __typename: "Collection";+ id: string;+ isPublished: boolean;+ name: string;+ products: CollectionList_collections_edges_node_products | null;+}++export interface CollectionList_collections_edges {+ __typename: "CollectionCountableEdge";+ node: CollectionList_collections_edges_node;+}++export interface CollectionList_collections {+ __typename: "CollectionCountableConnection";+ edges: CollectionList_collections_edges[];+}++export interface CollectionList {+ collections: CollectionList_collections | null;+}++export interface CollectionListVariables {+ first?: number | null;+ after?: string | null;+ last?: number | null;+ before?: string | null;+}diff --git a/saleor/static/dashboard-next/storybook/config.js b/saleor/static/dashboard-next/storybook/config.jsindex 68aaa6cdcb..08a5a3eba7 100644--- a/saleor/static/dashboard-next/storybook/config.js+++ b/saleor/static/dashboard-next/storybook/config.js@@ -39,7 +39,7 @@ function loadStories() {require("./stories/categories/CategoryListPage");// Collections- require("./stories/collections/CollectionDetailsPage");+ // require("./stories/collections/CollectionDetailsPage");require("./stories/collections/CollectionListPage");// Configurationdiff --git a/saleor/static/dashboard-next/storybook/stories/collections/CollectionListPage.tsx b/saleor/static/dashboard-next/storybook/stories/collections/CollectionListPage.tsxindex e8e457e298..8bc728a4a0 100644--- a/saleor/static/dashboard-next/storybook/stories/collections/CollectionListPage.tsx+++ b/saleor/static/dashboard-next/storybook/stories/collections/CollectionListPage.tsx@@ -2,15 +2,9 @@ import { storiesOf } from "@storybook/react";import * as React from "react";import CollectionListPage from "../../../collections/components/CollectionListPage";-import { collections as collectionsFixture } from "../../../collections/fixtures";-import { pageListProps } from "../../../fixtures";import Decorator from "../../Decorator";-const collections = collectionsFixture("");--storiesOf("Views / Collections / Collection list", module)+storiesOf("Collections / CollectionListPage", module).addDecorator(Decorator)- .add("default", () => (- <CollectionListPage collections={collections} {...pageListProps.default} />- ))- .add("when loading", () => <CollectionListPage {...pageListProps.loading} />);+ .add("default", () => <CollectionListPage />)+ .add("other", () => <CollectionListPage />);