Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Improve stories
dominik-zeglencb9f1c2208ef
diff --git a/saleor/static/dashboard-next/home/components/HomeNotificationTable/HomeNotificationTable.tsx b/saleor/static/dashboard-next/home/components/HomeNotificationTable/HomeNotificationTable.tsxindex 1024bccd9c..c43e2143f3 100644--- a/saleor/static/dashboard-next/home/components/HomeNotificationTable/HomeNotificationTable.tsx+++ b/saleor/static/dashboard-next/home/components/HomeNotificationTable/HomeNotificationTable.tsx@@ -10,7 +10,6 @@ import * as React from "react";import Skeleton from "../../../components/Skeleton";import i18n from "../../../i18n";-import { maybe } from "../../../misc";interface HomeNotificationTableProps {ordersToCapture: number;@@ -45,23 +44,21 @@ const HomeNotificationTable = decorate<HomeNotificationTableProps>(<TableBody className={classes.tableRow}><TableRow hover={true} onClick={onOrdersToFulfillClick}><TableCell>- {maybe(- () =>- ordersToFulfill === 0 ? (- <Typography>- {i18n.t("No orders ready to fulfill")}- </Typography>- ) : (- <Typography- dangerouslySetInnerHTML={{- __html: i18n.t(- "<b>{{ amount }} Orders</b> are ready to fulfill",- { amount: ordersToFulfill }- )- }}- />- ),+ {ordersToFulfill === undefined ? (<Skeleton />+ ) : ordersToFulfill === 0 ? (+ <Typography>+ {i18n.t("No orders ready to fulfill")}+ </Typography>+ ) : (+ <Typography+ dangerouslySetInnerHTML={{+ __html: i18n.t(+ "<b>{{ amount }} Orders</b> are ready to fulfill",+ { amount: ordersToFulfill }+ )+ }}+ />)}</TableCell><TableCell className={classes.arrowIcon}>@@ -70,23 +67,21 @@ const HomeNotificationTable = decorate<HomeNotificationTableProps>(</TableRow><TableRow hover={true} onClick={onOrdersToCaptureClick}><TableCell>- {maybe(- () =>- ordersToCapture === 0 ? (- <Typography>- {i18n.t("No payments waiting for capture")}- </Typography>- ) : (- <Typography- dangerouslySetInnerHTML={{- __html: i18n.t(- "<b>{{ amount }} Payments</b> to capture",- { amount: ordersToCapture }- )- }}- />- ),+ {ordersToCapture === undefined ? (<Skeleton />+ ) : ordersToCapture === 0 ? (+ <Typography>+ {i18n.t("No payments waiting for capture")}+ </Typography>+ ) : (+ <Typography+ dangerouslySetInnerHTML={{+ __html: i18n.t(+ "<b>{{ amount }} Payments</b> to capture",+ { amount: ordersToCapture }+ )+ }}+ />)}</TableCell><TableCell className={classes.arrowIcon}>@@ -95,23 +90,19 @@ const HomeNotificationTable = decorate<HomeNotificationTableProps>(</TableRow><TableRow hover={true} onClick={onProductsOutOfStockClick}><TableCell>- {maybe(- () =>- productsOutOfStock === 0 ? (- <Typography>- {i18n.t("No products out of stock")}- </Typography>- ) : (- <Typography- dangerouslySetInnerHTML={{- __html: i18n.t(- "<b>{{ amount }} Products</b> out of stock",- { amount: productsOutOfStock }- )- }}- />- ),+ {productsOutOfStock === undefined ? (<Skeleton />+ ) : productsOutOfStock === 0 ? (+ <Typography>{i18n.t("No products out of stock")}</Typography>+ ) : (+ <Typography+ dangerouslySetInnerHTML={{+ __html: i18n.t(+ "<b>{{ amount }} Products</b> out of stock",+ { amount: productsOutOfStock }+ )+ }}+ />)}</TableCell><TableCell className={classes.arrowIcon}>diff --git a/saleor/static/dashboard-next/home/fixtures.ts b/saleor/static/dashboard-next/home/fixtures.tsindex 27996d0d9c..da334de062 100644--- a/saleor/static/dashboard-next/home/fixtures.ts+++ b/saleor/static/dashboard-next/home/fixtures.ts@@ -1,95 +1,324 @@-import { HomePageProps } from "./components/HomePage";+import { OrderEvents } from "../types/globalTypes";+import { Home } from "./types/home";-export const shop: (placeholderImage: string) => HomePageProps = (+export const shop: (placeholderImage: string) => Home = (placeholderImage: string) => ({- activities: [- {- action: "published",- admin: false,- date: "2018-09-10T13:22:24.376193+00:00",- id: "1"- },- {- action: "published",- admin: false,- date: "2018-10-18T13:22:24.376193+00:00",- id: "2"- },- {- action: "created",- admin: false,- date: "2018-09-19T13:22:24.376193+00:00",- id: "3"- },- {- action: "added",- admin: true,- date: "2018-09-20T13:22:24.376193+00:00",- id: "4"- }- ],- daily: {- orders: {- amount: 1223- },- sales: {- amount: 12325,- currency: "PLN"- }- },- notifications: {- orders: 12,- payments: 10,- problems: 69,- productsOut: 2- },- onProductClick: () => undefined,- topProducts: [- {- id: "1",- name: "Lake Success",- orders: 123,- price: {- amount: 54,- currency: "PLN"+ activities: {+ __typename: "OrderEventCountableConnection",+ edges: [+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-09-14T16:10:27.137126+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDoxOA==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.PLACED_FROM_DRAFT,+ user: {+ __typename: "User",+ email: "[email protected]",+ id: "VXNlcjoyMQ=="+ }+ }+ },+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-03T13:28:46.325279+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDozNQ==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.PLACED,+ user: null+ }+ },+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-03T13:29:01.837496+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDozNw==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.ORDER_FULLY_PAID,+ user: null+ }+ },+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-04T01:01:51.243723+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDo1OA==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.PLACED_FROM_DRAFT,+ user: {+ __typename: "User",+ email: "[email protected]",+ id: "VXNlcjoyMQ=="+ }+ }+ },+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-04T19:36:18.831561+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDo2Nw==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.PLACED_FROM_DRAFT,+ user: {+ __typename: "User",+ email: "[email protected]",+ id: "VXNlcjoyMQ=="+ }+ }+ },+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-04T19:38:01.420365+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDo2OA==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.PLACED_FROM_DRAFT,+ user: {+ __typename: "User",+ email: "[email protected]",+ id: "VXNlcjoyMQ=="+ }+ }},- thumbnailUrl: placeholderImage,- variant: "Hardcover"- },- {- id: "2",- name: "The Sadness of Beautiful Things",- orders: 111,- price: {- amount: 23,- currency: "PLN"+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-05T12:30:57.268592+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDo3MQ==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.PLACED_FROM_DRAFT,+ user: {+ __typename: "User",+ email: "[email protected]",+ id: "VXNlcjoyMQ=="+ }+ }},- thumbnailUrl: placeholderImage,- variant: "Softcover"- },- {- id: "3",- name: "The Messy Middle",- orders: 93,- price: {- amount: 112,- currency: "PLN"+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-08T09:50:42.622253+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDo3Mw==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.PLACED,+ user: null+ }},- thumbnailUrl: placeholderImage,- variant: "Softcover"- },- {- id: "4",- name: "Everything's Trash",- orders: 32,- price: {- amount: 15,- currency: "PLN"+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-12T15:51:11.665838+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDo3Nw==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.PLACED_FROM_DRAFT,+ user: {+ __typename: "User",+ email: "[email protected]",+ id: "VXNlcjoyMQ=="+ }+ }},- thumbnailUrl: placeholderImage,- variant: "Hardcover"+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-25T11:25:58.843860+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDo3OA==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.PLACED,+ user: null+ }+ },+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-26T09:34:57.580167+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDo4MA==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.PLACED,+ user: null+ }+ },+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-26T09:38:02.440061+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDo4Mg==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.ORDER_FULLY_PAID,+ user: null+ }+ },+ {+ __typename: "OrderEventCountableEdge",+ node: {+ __typename: "OrderEvent",+ amount: null,+ composedId: null,+ date: "2018-10-26T09:38:02.467443+00:00",+ email: null,+ emailType: null,+ id: "T3JkZXJFdmVudDo4NA==",+ message: null,+ oversoldItems: null,+ quantity: null,+ type: OrderEvents.ORDER_FULLY_PAID,+ user: null+ }+ }+ ]+ },+ ordersToCapture: {+ __typename: "OrderCountableConnection",+ totalCount: 0+ },+ ordersToFulfill: {+ __typename: "OrderCountableConnection",+ totalCount: 1+ },+ ordersToday: {+ __typename: "OrderCountableConnection",+ totalCount: 1+ },+ productTopToday: {+ __typename: "ProductVariantCountableConnection",+ edges: [+ {+ __typename: "ProductVariantCountableEdge",+ node: {+ __typename: "ProductVariant",+ attributes: [+ {+ __typename: "SelectedAttribute",+ value: {+ __typename: "AttributeValue",+ id: "QXR0cmlidXRlVmFsdWU6OTI=",+ name: "XS",+ sortOrder: 0+ }+ }+ ],+ id: "UHJvZHVjdFZhcmlhbnQ6NDM=",+ product: {+ __typename: "Product",+ id: "UHJvZHVjdDo4",+ name: "Gardner-Martin",+ price: {+ __typename: "Money",+ amount: 37.65,+ currency: "USD"+ },+ thumbnailUrl: placeholderImage+ },+ quantityOrdered: 1,+ revenue: {+ __typename: "TaxedMoney",+ gross: {+ __typename: "Money",+ amount: 37.65,+ currency: "USD"+ }+ }+ }+ }+ ]+ },+ productsOutOfStock: {+ __typename: "ProductCountableConnection",+ totalCount: 0+ },+ salesToday: {+ __typename: "TaxedMoney",+ gross: {+ __typename: "Money",+ amount: 57.15,+ currency: "USD"}- ],- userName: "John Smith"+ }});diff --git a/saleor/static/dashboard-next/storybook/stories/home/HomePage.tsx b/saleor/static/dashboard-next/storybook/stories/home/HomePage.tsxindex 6be464000e..5d032a6720 100644--- a/saleor/static/dashboard-next/storybook/stories/home/HomePage.tsx+++ b/saleor/static/dashboard-next/storybook/stories/home/HomePage.tsx@@ -8,11 +8,18 @@ import Decorator from "../../Decorator";const shop = shopFixture(placeholderImage);const HomePageProps: HomePageProps = {- activities: shop.activities,- daily: shop.daily,+ activities: shop.activities.edges.map(edge => edge.node),+ onOrdersToCaptureClick: () => undefined,+ onOrdersToFulfillClick: () => undefined,onProductClick: () => undefined,- topProducts: shop.topProducts,- userName: shop.userName+ onProductsOutOfStockClick: () => undefined,+ orders: shop.ordersToday.totalCount,+ ordersToCapture: shop.ordersToCapture.totalCount,+ ordersToFulfill: shop.ordersToFulfill.totalCount,+ productsOutOfStock: shop.productsOutOfStock.totalCount,+ sales: shop.salesToday.gross,+ topProducts: shop.productTopToday.edges.map(edge => edge.node),+ userName: "[email protected]"};storiesOf("Views / HomePage", module)@@ -21,9 +28,13 @@ storiesOf("Views / HomePage", module).add("loading", () => (<HomePage{...HomePageProps}- topProducts={undefined}- daily={undefined}activities={undefined}+ orders={undefined}+ ordersToCapture={undefined}+ ordersToFulfill={undefined}+ productsOutOfStock={undefined}+ sales={undefined}+ topProducts={undefined}userName={undefined}/>))