Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Delete old components

dominik-zeglen5b21411f4a1c
diff --git a/saleor/static/dashboard-next/pages/components/PageContent/PageContent.tsx b/saleor/static/dashboard-next/pages/components/PageContent/PageContent.tsx
deleted file mode 100644
index 43b5bb8ba8..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageContent/PageContent.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import Card from "@material-ui/core/Card";
-import CardContent from "@material-ui/core/CardContent";
-import {
- createStyles,
- Theme,
- withStyles,
- WithStyles
-} from "@material-ui/core/styles";
-import TextField from "@material-ui/core/TextField";
-import * as classNames from "classnames";
-import * as React from "react";
-
-import FormSpacer from "../../../components/FormSpacer";
-import RichTextEditor from "../../../components/RichTextEditor";
-import i18n from "../../../i18n";
-
-const styles = (theme: Theme) =>
- createStyles({
- addHelperTextPadding: {
- [theme.breakpoints.up("md")]: {
- paddingBottom: theme.spacing.unit * 2.5
- }
- }
- });
-
-interface PageContentProps extends WithStyles<typeof styles> {
- content: string;
- errors: {
- content?: string;
- title?: string;
- };
- loading?: boolean;
- title: string;
- onChange?(event: React.ChangeEvent<any>);
-}
-
-const PageContent = withStyles(styles, { name: "PageContent" })(
- ({
- classes,
- content,
- errors,
- loading,
- title,
- onChange
- }: PageContentProps) => (
- <Card>
- <CardContent>
- <TextField
- autoFocus
- disabled={loading}
- name="title"
- label={i18n.t("Title", { context: "object" })}
- value={title}
- onChange={onChange}
- className={classNames({
- [classes.addHelperTextPadding]: !errors.title
- })}
- error={!!errors.title}
- helperText={errors.title ? errors.title : undefined}
- fullWidth
- />
- <FormSpacer />
- <RichTextEditor
- disabled={loading}
- value={content}
- name="content"
- label={i18n.t("Content", { context: "object" })}
- helperText={
- errors.content
- ? errors.content
- : i18n.t("Select text to enable text-formatting tools.", {
- context: "object"
- })
- }
- onChange={onChange}
- error={!!errors.content}
- fullWidth
- />
- </CardContent>
- </Card>
- )
-);
-PageContent.displayName = "PageContent";
-export default PageContent;
diff --git a/saleor/static/dashboard-next/pages/components/PageContent/index.ts b/saleor/static/dashboard-next/pages/components/PageContent/index.ts
deleted file mode 100644
index 181cfe053d..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageContent/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from "./PageContent";
-export * from "./PageContent";
diff --git a/saleor/static/dashboard-next/pages/components/PageDeleteDialog/PageDeleteDialog.tsx b/saleor/static/dashboard-next/pages/components/PageDeleteDialog/PageDeleteDialog.tsx
deleted file mode 100644
index de48e3eed5..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageDeleteDialog/PageDeleteDialog.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import Button from "@material-ui/core/Button";
-import Dialog from "@material-ui/core/Dialog";
-import DialogActions from "@material-ui/core/DialogActions";
-import DialogContent from "@material-ui/core/DialogContent";
-import DialogContentText from "@material-ui/core/DialogContentText";
-import DialogTitle from "@material-ui/core/DialogTitle";
-import {
- createStyles,
- Theme,
- withStyles,
- WithStyles
-} from "@material-ui/core/styles";
-import * as React from "react";
-
-import i18n from "../../../i18n";
-
-const styles = (theme: Theme) =>
- createStyles({
- deleteButton: {
- "&:hover": {
- backgroundColor: theme.palette.error.main
- },
- backgroundColor: theme.palette.error.main,
- color: theme.palette.error.contrastText
- }
- });
-
-interface PageDeleteDialogProps extends WithStyles<typeof styles> {
- children?: React.ReactNode;
- opened?: boolean;
- title: string;
- onClose?();
- onConfirm?();
-}
-
-const PageDeleteDialog = withStyles(styles, { name: "PageDeleteDialog" })(
- ({
- children,
- classes,
- opened,
- title,
- onConfirm,
- onClose,
- ...dialogProps
- }: PageDeleteDialogProps) => (
- <Dialog open={opened} {...dialogProps}>
- <DialogTitle>{i18n.t("Delete page", { context: "title" })}</DialogTitle>
- <DialogContent>
- <DialogContentText
- dangerouslySetInnerHTML={{
- __html: i18n.t(
- "Are you sure you want to remove <strong>{{name}}</strong>?",
- { name: title }
- )
- }}
- />
- </DialogContent>
- <DialogActions>
- <Button onClick={onClose}>
- {i18n.t("Cancel", { context: "button" })}
- </Button>
- <Button
- className={classes.deleteButton}
- variant="contained"
- onClick={onConfirm}
- >
- {i18n.t("Delete page", { context: "button" })}
- </Button>
- </DialogActions>
- </Dialog>
- )
-);
-PageDeleteDialog.displayName = "PageDeleteDialog";
-export default PageDeleteDialog;
diff --git a/saleor/static/dashboard-next/pages/components/PageDeleteDialog/index.ts b/saleor/static/dashboard-next/pages/components/PageDeleteDialog/index.ts
deleted file mode 100644
index 44f9256bb3..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageDeleteDialog/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from "./PageDeleteDialog";
-export * from "./PageDeleteDialog";
diff --git a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
deleted file mode 100644
index c8cf932859..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
+++ /dev/null
@@ -1,114 +0,0 @@
-import * as React from "react";
-
-import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
-import { Container } from "../../../components/Container";
-import Form, { FormProps } from "../../../components/Form";
-import Grid from "../../../components/Grid";
-import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar from "../../../components/SaveButtonBar";
-import Toggle from "../../../components/Toggle";
-import PageContent from "../PageContent";
-import PageDeleteDialog from "../PageDeleteDialog";
-import PageProperties from "../PageProperties";
-
-interface PageInput {
- title: string;
- content: string;
- slug: string;
- publicationDate: string;
- isPublished: boolean;
-}
-
-const defaultPage = {
- content: "",
- isPublished: false,
- publicationDate: "",
- slug: "",
- title: ""
-};
-
-const PageForm: React.ComponentType<FormProps<PageInput>> = Form;
-
-export interface PageDetailsPageProps {
- page?: PageInput & {
- created?: string;
- };
- errors?: Array<{
- field: string;
- message: string;
- }>;
- disabled?: boolean;
- title?: string;
- saveButtonBarState: ConfirmButtonTransitionState;
- onBack?();
- onDelete?();
- onSubmit(data: PageInput);
-}
-
-const PageDetailsPage: React.StatelessComponent<PageDetailsPageProps> = ({
- errors,
- disabled,
- page,
- title,
- saveButtonBarState,
- onBack,
- onDelete,
- onSubmit
-}: PageDetailsPageProps) => (
- <PageForm
- errors={errors}
- key={page ? "ready" : "loading"}
- initial={page ? page : defaultPage}
- onSubmit={onSubmit}
- >
- {({ change, data, errors, hasChanged, submit }) => (
- <Toggle>
- {(opened, { toggle: togglePageDeleteDialog }) => (
- <Container width="md">
- <>
- <PageHeader onBack={onBack} title={title} />
- <Grid>
- <div>
- <PageContent
- errors={errors}
- loading={disabled}
- onChange={change}
- content={data.content}
- title={data.title}
- />
- </div>
- <div>
- <PageProperties
- publicationDate={data.publicationDate}
- created={page ? page.created : undefined}
- isPublished={data.isPublished}
- loading={disabled}
- onChange={change}
- slug={data.slug}
- />
- </div>
- </Grid>
- <SaveButtonBar
- disabled={disabled || !onSubmit || !hasChanged}
- state={saveButtonBarState}
- onCancel={onBack}
- onDelete={togglePageDeleteDialog}
- onSave={submit}
- />
- {!disabled && (
- <PageDeleteDialog
- opened={opened}
- onConfirm={onDelete}
- onClose={togglePageDeleteDialog}
- title={page.title}
- />
- )}
- </>
- </Container>
- )}
- </Toggle>
- )}
- </PageForm>
-);
-PageDetailsPage.displayName = "PageDetailsPage";
-export default PageDetailsPage;
diff --git a/saleor/static/dashboard-next/pages/components/PageDetailsPage/index.ts b/saleor/static/dashboard-next/pages/components/PageDetailsPage/index.ts
deleted file mode 100644
index 20a714c9cc..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageDetailsPage/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from "./PageDetailsPage";
-export * from "./PageDetailsPage";
diff --git a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
deleted file mode 100644
index deeb1a40cc..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
+++ /dev/null
@@ -1,116 +0,0 @@
-import Card from "@material-ui/core/Card";
-import {
- createStyles,
- Theme,
- withStyles,
- 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 Skeleton from "../../../components/Skeleton";
-import StatusLabel from "../../../components/StatusLabel";
-import TablePagination from "../../../components/TablePagination";
-import i18n from "../../../i18n";
-import { renderCollection } from "../../../misc";
-import { ListProps } from "../../../types";
-
-const styles = (theme: Theme) =>
- createStyles({
- link: {
- color: theme.palette.secondary.main,
- cursor: "pointer",
- textDecoration: "none"
- },
- textRight: {
- textAlign: "right"
- }
- });
-
-interface PageListProps extends ListProps, WithStyles<typeof styles> {
- pages?: Array<{
- id: string;
- title: string;
- slug: string;
- isPublished: boolean;
- }>;
-}
-
-export const PageList = withStyles(styles, { name: "PageList" })(
- ({
- classes,
- disabled,
- pageInfo,
- pages,
- onNextPage,
- onPreviousPage,
- onRowClick
- }: PageListProps) => (
- <Card>
- <Table>
- <TableHead>
- <TableRow>
- <TableCell>{i18n.t("Name", { context: "object" })}</TableCell>
- <TableCell>{i18n.t("Url", { context: "object" })}</TableCell>
- <TableCell>{i18n.t("Visibility", { context: "object" })}</TableCell>
- </TableRow>
- </TableHead>
- <TableFooter>
- <TableRow>
- <TablePagination
- colSpan={3}
- hasNextPage={pageInfo && !disabled ? pageInfo.hasNextPage : false}
- hasPreviousPage={
- pageInfo && !disabled ? pageInfo.hasPreviousPage : false
- }
- onNextPage={onNextPage}
- onPreviousPage={onPreviousPage}
- />
- </TableRow>
- </TableFooter>
- <TableBody>
- {renderCollection(
- pages,
- page => (
- <TableRow key={page ? page.id : "skeleton"}>
- <TableCell
- onClick={page && onRowClick(page.id)}
- className={classes.link}
- >
- {page ? page.title : <Skeleton />}
- </TableCell>
- <TableCell>{page ? `/${page.slug}` : <Skeleton />}</TableCell>
- <TableCell>
- {page ? (
- <StatusLabel
- label={
- page.isPublished
- ? i18n.t("Published", { context: "object" })
- : i18n.t("Not published", { context: "object" })
- }
- status={page.isPublished ? "success" : "error"}
- />
- ) : (
- <Skeleton />
- )}
- </TableCell>
- </TableRow>
- ),
- () => (
- <TableRow>
- <TableCell colSpan={3}>{i18n.t("No pages found")}</TableCell>
- </TableRow>
- )
- )}
- </TableBody>
- </Table>
- </Card>
- )
-);
-PageList.displayName = "PageList";
-export default PageList;
diff --git a/saleor/static/dashboard-next/pages/components/PageList/index.ts b/saleor/static/dashboard-next/pages/components/PageList/index.ts
deleted file mode 100644
index ceef274c33..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageList/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from "./PageList";
-export * from "./PageList";
diff --git a/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx b/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx
deleted file mode 100644
index 1ce41b7ac9..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import IconButton from "@material-ui/core/IconButton";
-import AddIcon from "@material-ui/icons/Add";
-import * as React from "react";
-
-import Container from "../../../components/Container";
-import PageHeader from "../../../components/PageHeader";
-import i18n from "../../../i18n";
-import { PageListProps } from "../../../types";
-import PageList from "../../components/PageList";
-
-interface PageListPageProps extends PageListProps {
- pages?: Array<{
- id: string;
- title: string;
- slug: string;
- isPublished: boolean;
- }>;
-}
-
-const PageListPage: React.StatelessComponent<PageListPageProps> = ({
- disabled,
- pages,
- pageInfo,
- onAdd,
- onNextPage,
- onPreviousPage,
- onRowClick
-}) => (
- <Container width="md">
- <PageHeader
- title={i18n.t("Pages", {
- context: "title"
- })}
- >
- <IconButton disabled={disabled} onClick={onAdd}>
- <AddIcon />
- </IconButton>
- </PageHeader>
- <PageList
- disabled={disabled}
- pageInfo={pageInfo}
- pages={pages}
- onNextPage={onNextPage}
- onPreviousPage={onPreviousPage}
- onRowClick={onRowClick}
- />
- </Container>
-);
-PageListPage.displayName = "PageListPage";
-export default PageListPage;
diff --git a/saleor/static/dashboard-next/pages/components/PageListPage/index.ts b/saleor/static/dashboard-next/pages/components/PageListPage/index.ts
deleted file mode 100644
index f91170df48..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageListPage/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from "./PageListPage";
-export * from "./PageListPage";
diff --git a/saleor/static/dashboard-next/pages/components/PageProperties/PageProperties.tsx b/saleor/static/dashboard-next/pages/components/PageProperties/PageProperties.tsx
deleted file mode 100644
index 7a40655f95..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageProperties/PageProperties.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import Card from "@material-ui/core/Card";
-import CardContent from "@material-ui/core/CardContent";
-import TextField from "@material-ui/core/TextField";
-import Typography from "@material-ui/core/Typography";
-import * as React from "react";
-
-import ControlledCheckbox from "../../../components/ControlledCheckbox";
-import { DateTime } from "../../../components/Date";
-import FormSpacer from "../../../components/FormSpacer";
-import i18n from "../../../i18n";
-
-interface PagePropertiesProps {
- publicationDate: string;
- created?: string;
- errors?: Array<{ field: string; message: string }>;
- isPublished: boolean;
- loading?: boolean;
- slug?: string;
- onChange?(event: React.ChangeEvent<any>);
-}
-
-const PageProperties: React.StatelessComponent<PagePropertiesProps> = ({
- created,
- errors,
- slug,
- publicationDate,
- loading,
- isPublished,
- onChange
-}) => {
- const errorList: { [key: string]: string } = errors
- ? errors.reduce((acc, curr) => {
- acc[curr.field] = curr.message;
- return acc;
- }, {})
- : {};
- return (
- <Card>
- <CardContent>
- <TextField
- disabled={loading}
- name="slug"
- label={i18n.t("Slug", { context: "object" })}
- value={slug}
- helperText={
- errorList && errorList.slug
- ? errorList.slug
- : i18n.t("Slug is being used to create page URL", {
- context: "object"
- })
- }
- onChange={onChange}
- error={!!(errorList && errorList.slug)}
- fullWidth
- />
- <FormSpacer />
- <TextField
- disabled={loading}
- name="publicationDate"
- label={i18n.t("Publication date", { context: "label" })}
- type="date"
- value={publicationDate}
- onChange={onChange}
- InputLabelProps={{
- shrink: true
- }}
- helperText={
- errorList && errorList.publicationDate ? errorList.publicationDate : ""
- }
- error={!!(errorList && errorList.publicationDate)}
- fullWidth
- />
- <FormSpacer />
- {created && (
- <div>
- <Typography variant="body1">
- {i18n.t("Created:")} <DateTime date={created} />
- </Typography>
- </div>
- )}
- <FormSpacer />
- <ControlledCheckbox
- checked={isPublished}
- disabled={loading}
- label={i18n.t("Published", { context: "label" })}
- name="isPublished"
- onChange={onChange}
- />
- </CardContent>
- </Card>
- );
-};
-PageProperties.displayName = "PageProperties";
-export default PageProperties;
diff --git a/saleor/static/dashboard-next/pages/components/PageProperties/index.ts b/saleor/static/dashboard-next/pages/components/PageProperties/index.ts
deleted file mode 100644
index dc1d91027f..0000000000
--- a/saleor/static/dashboard-next/pages/components/PageProperties/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from "./PageProperties";
-export * from "./PageProperties";
diff --git a/saleor/static/dashboard-next/pages/fixtures.ts b/saleor/static/dashboard-next/pages/fixtures.ts
deleted file mode 100644
index d52e99c255..0000000000
--- a/saleor/static/dashboard-next/pages/fixtures.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-export const pages = [
- {
- id: "UGFnZTox",
- isPublished: true,
- slug: "about",
- title: "About"
- },
- {
- id: "UGFnZToy",
- isPublished: false,
- slug: "terms-of-use",
- title: "Terms of use"
- }
-];
-export const page = {
- content:
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin bibendum et justo sit amet viverra. Maecenas euismod auctor nisi et tincidunt. Maecenas ante urna, aliquet at odio sed, gravida efficitur purus. Morbi ut dapibus ante. Nulla eu neque sit amet odio tincidunt porttitor eu quis purus. Aliquam at diam sit amet turpis varius semper vitae non lectus. Vivamus lectus ligula, molestie eu augue eu, cursus tincidunt sem. Nam ornare egestas tincidunt.",
- createdAt: "2018-03-13T16:39:08.850105+00:00",
- isPublished: true,
- publicationDate: "2018-03-20T16:39:08.850105+00:00",
- slug: "lorem-ipsum-dolor",
- title: "Lorem Ipsum"
-};
diff --git a/saleor/static/dashboard-next/pages/index.tsx b/saleor/static/dashboard-next/pages/index.tsx
deleted file mode 100644
index 4ef0b2e220..0000000000
--- a/saleor/static/dashboard-next/pages/index.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import { parse as parseQs } from "qs";
-import * as React from "react";
-import { Route, RouteComponentProps, Switch } from "react-router-dom";
-
-import { WindowTitle } from "../components/WindowTitle";
-import i18n from "../i18n";
-import { pageAddPath, pageListPath, pagePath } from "./urls";
-import PageCreate from "./views/PageCreate";
-import PageDetailsComponent from "./views/PageDetails";
-import PageListComponent, { PageListQueryParams } from "./views/PageList";
-
-const PageList: React.StatelessComponent<RouteComponentProps<any>> = ({
- location
-}) => {
- const qs = parseQs(location.search.substr(1));
- const params: PageListQueryParams = {
- after: qs.after,
- before: qs.before
- };
- return <PageListComponent params={params} />;
-};
-const PageDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
- match
-}) => {
- return <PageDetailsComponent id={match.params.id} />;
-};
-
-const Component = () => (
- <>
- <WindowTitle title={i18n.t("Pages")} />
- <Switch>
- <Route exact path={pageListPath} component={PageList} />
- <Route exact path={pageAddPath} component={PageCreate} />
- <Route exact path={pagePath(":id")} component={PageDetails} />
- </Switch>
- </>
-);
-
-export default Component;
diff --git a/saleor/static/dashboard-next/pages/mutations.ts b/saleor/static/dashboard-next/pages/mutations.ts
deleted file mode 100644
index 24c1a51344..0000000000
--- a/saleor/static/dashboard-next/pages/mutations.ts
+++ /dev/null
@@ -1,99 +0,0 @@
-import gql from "graphql-tag";
-
-import { TypedMutation } from "../mutations";
-
-import { PageCreate, PageCreateVariables } from "./types/PageCreate";
-import { PageDelete, PageDeleteVariables } from "./types/PageDelete";
-import { PageUpdate, PageUpdateVariables } from "./types/PageUpdate";
-
-export const pageDeleteMutation = gql`
- mutation PageDelete($id: ID!) {
- pageDelete(id: $id) {
- errors {
- field
- message
- }
- }
- }
-`;
-export const TypedPageDeleteMutation = TypedMutation<
- PageDelete,
- PageDeleteVariables
->(pageDeleteMutation);
-
-export const pageUpdateMutation = gql`
- mutation PageUpdate(
- $id: ID!
- $title: String!
- $content: String!
- $slug: String!
- $isPublished: Boolean!
- $publicationDate: String
- ) {
- pageUpdate(
- id: $id
- input: {
- title: $title
- content: $content
- slug: $slug
- isPublished: $isPublished
- publicationDate: $publicationDate
- }
- ) {
- page {
- id
- slug
- title
- content
- isPublished
- publicationDate
- }
- errors {
- field
- message
- }
- }
- }
-`;
-export const TypedPageUpdateMutation = TypedMutation<
- PageUpdate,
- PageUpdateVariables
->(pageUpdateMutation);
-
-export const pageCreateMutation = gql`
- mutation PageCreate(
- $title: String!
- $content: String!
- $slug: String!
- $isPublished: Boolean!
- $publicationDate: String
- ) {
- pageCreate(
- input: {
- title: $title
- content: $content
- slug: $slug
- isPublished: $isPublished
- publicationDate: $publicationDate
- }
- ) {
- page {
- id
- slug
- title
- content
- isPublished
- publicationDate
- created
- }
- errors {
- field
- message
- }
- }
- }
-`;
-export const TypedPageCreateMutation = TypedMutation<
- PageCreate,
- PageCreateVariables
->(pageCreateMutation);
diff --git a/saleor/static/dashboard-next/pages/queries.ts b/saleor/static/dashboard-next/pages/queries.ts
deleted file mode 100644
index 566caf3b26..0000000000
--- a/saleor/static/dashboard-next/pages/queries.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import gql from "graphql-tag";
-
-import { TypedQuery } from "../queries";
-import { PageDetails, PageDetailsVariables } from "./types/PageDetails";
-import { PageList, PageListVariables } from "./types/PageList";
-
-const pageListQuery = gql`
- query PageList($first: Int, $after: String, $last: Int, $before: String) {
- pages(before: $before, after: $after, first: $first, last: $last) {
- edges {
- cursor
- node {
- id
- slug
- title
- isPublished
- }
- }
- pageInfo {
- hasPreviousPage
- hasNextPage
- startCursor
- endCursor
- }
- }
- }
-`;
-export const TypedPageListQuery = TypedQuery<PageList, PageListVariables>(
- pageListQuery
-);
-
-const pageDetailsQuery = gql`
- query PageDetails($id: ID!) {
- page(id: $id) {
- id
- slug
- title
- content
- created
- isPublished
- publicationDate
- }
- }
-`;
-export const TypedPageDetailsQuery = TypedQuery<
- PageDetails,
- PageDetailsVariables
->(pageDetailsQuery);
diff --git a/saleor/static/dashboard-next/pages/types/PageCreate.ts b/saleor/static/dashboard-next/pages/types/PageCreate.ts
deleted file mode 100644
index 5fe7bec0ae..0000000000
--- a/saleor/static/dashboard-next/pages/types/PageCreate.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/* tslint:disable */
-// This file was automatically generated and should not be edited.
-
-// ====================================================
-// GraphQL mutation operation: PageCreate
-// ====================================================
-
-export interface PageCreate_pageCreate_page {
- __typename: "Page";
- id: string;
- slug: string;
- title: string;
- content: string;
- isPublished: boolean;
- publicationDate: any | null;
- created: any;
-}
-
-export interface PageCreate_pageCreate_errors {
- __typename: "Error";
- field: string | null;
- message: string | null;
-}
-
-export interface PageCreate_pageCreate {
- __typename: "PageCreate";
- page: PageCreate_pageCreate_page | null;
- errors: PageCreate_pageCreate_errors[] | null;
-}
-
-export interface PageCreate {
- pageCreate: PageCreate_pageCreate | null;
-}
-
-export interface PageCreateVariables {
- title: string;
- content: string;
- slug: string;
- isPublished: boolean;
- publicationDate?: string | null;
-}
diff --git a/saleor/static/dashboard-next/pages/types/PageDelete.ts b/saleor/static/dashboard-next/pages/types/PageDelete.ts
deleted file mode 100644
index 5324786d2b..0000000000
--- a/saleor/static/dashboard-next/pages/types/PageDelete.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/* tslint:disable */
-// This file was automatically generated and should not be edited.
-
-// ====================================================
-// GraphQL mutation operation: PageDelete
-// ====================================================
-
-export interface PageDelete_pageDelete_errors {
- __typename: "Error";
- field: string | null;
- message: string | null;
-}
-
-export interface PageDelete_pageDelete {
- __typename: "PageDelete";
- errors: PageDelete_pageDelete_errors[] | null;
-}
-
-export interface PageDelete {
- pageDelete: PageDelete_pageDelete | null;
-}
-
-export interface PageDeleteVariables {
- id: string;
-}
diff --git a/saleor/static/dashboard-next/pages/types/PageDetails.ts b/saleor/static/dashboard-next/pages/types/PageDetails.ts
deleted file mode 100644
index 431ffe1c6c..0000000000
--- a/saleor/static/dashboard-next/pages/types/PageDetails.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/* tslint:disable */
-// This file was automatically generated and should not be edited.
-
-// ====================================================
-// GraphQL query operation: PageDetails
-// ====================================================
-
-export interface PageDetails_page {
- __typename: "Page";
- id: string;
- slug: string;
- title: string;
- content: string;
- created: any;
- isPublished: boolean;
- publicationDate: any | null;
-}
-
-export interface PageDetails {
- page: PageDetails_page | null;
-}
-
-export interface PageDetailsVariables {
- id: string;
-}
diff --git a/saleor/static/dashboard-next/pages/types/PageList.ts b/saleor/static/dashboard-next/pages/types/PageList.ts
deleted file mode 100644
index eb9001a2c4..0000000000
--- a/saleor/static/dashboard-next/pages/types/PageList.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/* tslint:disable */
-// This file was automatically generated and should not be edited.
-
-// ====================================================
-// GraphQL query operation: PageList
-// ====================================================
-
-export interface PageList_pages_edges_node {
- __typename: "Page";
- id: string;
- slug: string;
- title: string;
- isPublished: boolean;
-}
-
-export interface PageList_pages_edges {
- __typename: "PageCountableEdge";
- cursor: string;
- node: PageList_pages_edges_node;
-}
-
-export interface PageList_pages_pageInfo {
- __typename: "PageInfo";
- hasPreviousPage: boolean;
- hasNextPage: boolean;
- startCursor: string | null;
- endCursor: string | null;
-}
-
-export interface PageList_pages {
- __typename: "PageCountableConnection";
- edges: PageList_pages_edges[];
- pageInfo: PageList_pages_pageInfo;
-}
-
-export interface PageList {
- pages: PageList_pages | null;
-}
-
-export interface PageListVariables {
- first?: number | null;
- after?: string | null;
- last?: number | null;
- before?: string | null;
-}
diff --git a/saleor/static/dashboard-next/pages/types/PageUpdate.ts b/saleor/static/dashboard-next/pages/types/PageUpdate.ts
deleted file mode 100644
index 3f44bdd4f2..0000000000
--- a/saleor/static/dashboard-next/pages/types/PageUpdate.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/* tslint:disable */
-// This file was automatically generated and should not be edited.
-
-// ====================================================
-// GraphQL mutation operation: PageUpdate
-// ====================================================
-
-export interface PageUpdate_pageUpdate_page {
- __typename: "Page";
- id: string;
- slug: string;
- title: string;
- content: string;
- isPublished: boolean;
- publicationDate: any | null;
-}
-
-export interface PageUpdate_pageUpdate_errors {
- __typename: "Error";
- field: string | null;
- message: string | null;
-}
-
-export interface PageUpdate_pageUpdate {
- __typename: "PageUpdate";
- page: PageUpdate_pageUpdate_page | null;
- errors: PageUpdate_pageUpdate_errors[] | null;
-}
-
-export interface PageUpdate {
- pageUpdate: PageUpdate_pageUpdate | null;
-}
-
-export interface PageUpdateVariables {
- id: string;
- title: string;
- content: string;
- slug: string;
- isPublished: boolean;
- publicationDate?: string | null;
-}
diff --git a/saleor/static/dashboard-next/pages/urls.ts b/saleor/static/dashboard-next/pages/urls.ts
deleted file mode 100644
index 752217b21a..0000000000
--- a/saleor/static/dashboard-next/pages/urls.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import * as urlJoin from "url-join";
-
-const pageSectionUrl = "/pages/";
-
-export const pageListPath = pageSectionUrl;
-export const pageListUrl = pageListPath;
-
-export const pagePath = (id: string) => urlJoin(pageSectionUrl, id);
-export const pageUrl = (id: string) => pagePath(encodeURIComponent(id));
-
-export const pageAddPath = urlJoin(pageSectionUrl, "add");
-export const pageAddUrl = pageAddPath;
diff --git a/saleor/static/dashboard-next/pages/views/PageCreate.tsx b/saleor/static/dashboard-next/pages/views/PageCreate.tsx
deleted file mode 100644
index 38199cf578..0000000000
--- a/saleor/static/dashboard-next/pages/views/PageCreate.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import * as React from "react";
-import { Redirect } from "react-router";
-
-import { NavigatorLink } from "../../components/Navigator";
-import { WindowTitle } from "../../components/WindowTitle";
-import i18n from "../../i18n";
-import { getMutationState, maybe } from "../../misc";
-import PageDetailsPage from "../../pages/components/PageDetailsPage";
-import { TypedPageCreateMutation } from "../mutations";
-import { pageListUrl } from "../urls";
-
-export const PageCreateForm: React.StatelessComponent = () => (
- <TypedPageCreateMutation>
- {(createPage, { called, data: createResult, loading }) => {
- if (called && !loading && !createResult.pageCreate.errors.length) {
- return <Redirect to={pageListUrl} push={false} />;
- }
- const formTransitionState = getMutationState(
- called,
- loading,
- maybe(() => createResult.pageCreate.errors)
- );
- return (
- <NavigatorLink to={pageListUrl}>
- {handleCancel => (
- <>
- <WindowTitle title={i18n.t("Create page")} />
- <PageDetailsPage
- disabled={loading}
- page={{
- content: "",
- isPublished: false,
- publicationDate: "",
- slug: "",
- title: ""
- }}
- onBack={handleCancel}
- onSubmit={data =>
- createPage({
- variables: data
- })
- }
- title={i18n.t("Add page", { context: "title" })}
- saveButtonBarState={formTransitionState}
- />
- </>
- )}
- </NavigatorLink>
- );
- }}
- </TypedPageCreateMutation>
-);
-
-export default PageCreateForm;
diff --git a/saleor/static/dashboard-next/pages/views/PageDetails.tsx b/saleor/static/dashboard-next/pages/views/PageDetails.tsx
deleted file mode 100644
index 9663066f36..0000000000
--- a/saleor/static/dashboard-next/pages/views/PageDetails.tsx
+++ /dev/null
@@ -1,121 +0,0 @@
-import * as React from "react";
-import { Redirect } from "react-router";
-
-import { NavigatorLink } from "../../components/Navigator";
-import { WindowTitle } from "../../components/WindowTitle";
-import { maybe } from "../../misc";
-import PageDetailsPage from "../components/PageDetailsPage";
-import { TypedPageDeleteMutation, TypedPageUpdateMutation } from "../mutations";
-import { TypedPageDetailsQuery } from "../queries";
-import { pageListUrl } from "../urls";
-
-interface PageUpdateFormProps {
- id: string;
-}
-
-interface PageUpdateFormState {
- opened: boolean;
-}
-
-export class PageUpdateForm extends React.Component<
- PageUpdateFormProps,
- PageUpdateFormState
-> {
- state = { opened: false };
-
- handleRemoveButtonClick = () => {
- this.setState(prevState => ({ opened: !prevState.opened }));
- };
-
- render() {
- const { id } = this.props;
- return (
- <TypedPageDetailsQuery
- displayLoader
- variables={{ id }}
- require={["page"]}
- >
- {({ data, loading }) => (
- <TypedPageDeleteMutation>
- {(
- _,
- { called, data: deleteResult, error, loading: deleteInProgress }
- ) => {
- if (called && !deleteInProgress) {
- if (error) {
- return;
- }
- if (
- deleteResult.pageDelete.errors &&
- deleteResult.pageDelete.errors.length
- ) {
- return;
- }
- this.handleRemoveButtonClick();
- return <Redirect to={pageListUrl} />;
- }
- return (
- <TypedPageUpdateMutation>
- {(
- updatePage,
- {
- called,
- data: updateResult,
- error,
- loading: updateInProgress
- }
- ) => {
- if (
- called &&
- !updateInProgress &&
- updateResult &&
- updateResult.pageUpdate &&
- !updateResult.pageUpdate.errors.length
- ) {
- if (error) {
- return;
- }
- return <Redirect to={pageListUrl} />;
- }
- return (
- <NavigatorLink to={pageListUrl}>
- {handleCancel => (
- <>
- <WindowTitle title={maybe(() => data.page.title)} />
- <PageDetailsPage
- onBack={handleCancel}
- page={loading ? undefined : data.page}
- onSubmit={data =>
- updatePage({
- variables: { id, ...data }
- })
- }
- errors={
- updateResult
- ? updateResult.pageUpdate.errors
- : []
- }
- title={
- data && data.page ? data.page.title : undefined
- }
- disabled={
- loading || deleteInProgress || updateInProgress
- }
- saveButtonBarState="default"
- />
- </>
- )}
- </NavigatorLink>
- );
- }}
- </TypedPageUpdateMutation>
- );
- }}
- </TypedPageDeleteMutation>
- )}
- </TypedPageDetailsQuery>
- );
- }
-}
-
-export default PageUpdateForm;
diff --git a/saleor/static/dashboard-next/pages/views/PageList.tsx b/saleor/static/dashboard-next/pages/views/PageList.tsx
deleted file mode 100644
index 7da500f236..0000000000
--- a/saleor/static/dashboard-next/pages/views/PageList.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import * as React from "react";
-
-import Navigator from "../../components/Navigator";
-import { createPaginationState, Paginator } from "../../components/Paginator";
-import { maybe } from "../../misc";
-import PageListPage from "../components/PageListPage/PageListPage";
-import { TypedPageListQuery } from "../queries";
-import { pageAddUrl, pageUrl } from "../urls";
-
-export type PageListQueryParams = Partial<{ after: string; before: string }>;
-
-interface PageListProps {
- params: PageListQueryParams;
-}
-
-const PAGINATE_BY = 20;
-
-export const PageList: React.StatelessComponent<PageListProps> = ({
- params
-}) => (
- <Navigator>
- {navigate => {
- const paginationState = createPaginationState(PAGINATE_BY, params);
- const handleEditClick = (id: string) => () => navigate(pageUrl(id));
- return (
- <TypedPageListQuery displayLoader variables={paginationState}>
- {({ data, loading }) => (
- <Paginator
- pageInfo={maybe(() => data.pages.pageInfo)}
- paginationState={paginationState}
- queryString={params}
- >
- {({ loadNextPage, loadPreviousPage, pageInfo }) => (
- <PageListPage
- disabled={loading}
- pages={
- data && data.pages
- ? data.pages.edges.map(edge => edge.node)
- : undefined
- }
- pageInfo={pageInfo}
- onAdd={() => navigate(pageAddUrl)}
- onRowClick={handleEditClick}
- onNextPage={loadNextPage}
- onPreviousPage={loadPreviousPage}
- />
- )}
- </Paginator>
- )}
- </TypedPageListQuery>
- );
- }}
- </Navigator>
-);
-
-export default PageList;
diff --git a/saleor/static/dashboard-next/storybook/config.js b/saleor/static/dashboard-next/storybook/config.js
index f2b22b3fd5..cf0ff3f2e7 100644
--- a/saleor/static/dashboard-next/storybook/config.js
+++ b/saleor/static/dashboard-next/storybook/config.js
@@ -69,13 +69,6 @@ function loadStories() {
require("./stories/staff/StaffListPage");
require("./stories/staff/StaffDetailsPage");
- // Pages
- require("./stories/pages/PageContent");
- require("./stories/pages/PageDeleteDialog");
- require("./stories/pages/PageDetailsPage");
- require("./stories/pages/PageListPage");
- require("./stories/pages/PageProperties");
-
// Products
require("./stories/products/ProductCreatePage");
require("./stories/products/ProductImagePage");
diff --git a/saleor/static/dashboard-next/storybook/stories/pages/PageContent.tsx b/saleor/static/dashboard-next/storybook/stories/pages/PageContent.tsx
deleted file mode 100644
index edd04bbac5..0000000000
--- a/saleor/static/dashboard-next/storybook/stories/pages/PageContent.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { storiesOf } from "@storybook/react";
-import * as React from "react";
-
-import PageContent from "../../../pages/components/PageContent";
-import { page } from "../../../pages/fixtures";
-import Decorator from "../../Decorator";
-
-storiesOf("Pages / PageContent", module)
- .addDecorator(Decorator)
- .add("when loaded", () => <PageContent errors={{}} {...page} />)
- .add("when loading", () => (
- <PageContent errors={{}} loading={true} content="" title="" />
- ))
- .add("with errors", () => (
- <PageContent
- errors={{
- content: "Generic error",
- title: "Generic error"
- }}
- loading={true}
- content=""
- title=""
- />
- ));
diff --git a/saleor/static/dashboard-next/storybook/stories/pages/PageDeleteDialog.tsx b/saleor/static/dashboard-next/storybook/stories/pages/PageDeleteDialog.tsx
deleted file mode 100644
index d6d5c6769a..0000000000
--- a/saleor/static/dashboard-next/storybook/stories/pages/PageDeleteDialog.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { storiesOf } from "@storybook/react";
-import * as React from "react";
-
-import PageDeleteDialog from "../../../pages/components/PageDeleteDialog";
-import Decorator from "../../Decorator";
-
-storiesOf("Pages / PageDeleteDialog", module)
- .addDecorator(Decorator)
- .add("default", () => (
- <PageDeleteDialog
- opened={true}
- onConfirm={undefined}
- onClose={undefined}
- title="Lorem Ipsum"
- />
- ));
diff --git a/saleor/static/dashboard-next/storybook/stories/pages/PageDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/pages/PageDetailsPage.tsx
deleted file mode 100644
index 75268953d9..0000000000
--- a/saleor/static/dashboard-next/storybook/stories/pages/PageDetailsPage.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { Omit } from "@material-ui/core";
-import { storiesOf } from "@storybook/react";
-import * as React from "react";
-
-import PageDetailsPage, {
- PageDetailsPageProps
-} from "../../../pages/components/PageDetailsPage";
-import { page } from "../../../pages/fixtures";
-import Decorator from "../../Decorator";
-
-const callbacks: Omit<PageDetailsPageProps, "classes"> = {
- onBack: () => undefined,
- onSubmit: () => undefined,
- saveButtonBarState: "default"
-};
-
-storiesOf("Views / Pages / Page details", module)
- .addDecorator(Decorator)
- .add("with initial data", () => (
- <PageDetailsPage title="Lorem Ipsum" page={page} {...callbacks} />
- ))
- .add("when loading", () => (
- <PageDetailsPage disabled={true} {...callbacks} />
- ));
diff --git a/saleor/static/dashboard-next/storybook/stories/pages/PageListPage.tsx b/saleor/static/dashboard-next/storybook/stories/pages/PageListPage.tsx
deleted file mode 100644
index 0f7f98aedd..0000000000
--- a/saleor/static/dashboard-next/storybook/stories/pages/PageListPage.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import { storiesOf } from "@storybook/react";
-import * as React from "react";
-
-import { pageListProps } from "../../../fixtures";
-import PageList from "../../../pages/components/PageListPage";
-import { pages } from "../../../pages/fixtures";
-import { Decorator } from "../../Decorator";
-
-storiesOf("Views / Pages / Page list", module)
- .addDecorator(Decorator)
- .add("default", () => <PageList pages={pages} {...pageListProps.default} />)
- .add("loading", () => (
- <PageList pages={undefined} {...pageListProps.loading} />
- ))
- .add("no data", () => <PageList pages={[]} {...pageListProps.default} />);
diff --git a/saleor/static/dashboard-next/storybook/stories/pages/PageProperties.tsx b/saleor/static/dashboard-next/storybook/stories/pages/PageProperties.tsx
deleted file mode 100644
index 0a9aae3762..0000000000
--- a/saleor/static/dashboard-next/storybook/stories/pages/PageProperties.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { storiesOf } from "@storybook/react";
-import * as React from "react";
-
-import PageProperties from "../../../pages/components/PageProperties";
-import { page } from "../../../pages/fixtures";
-import Decorator from "../../Decorator";
-
-storiesOf("Pages / PageProperties", module)
- .addDecorator(Decorator)
- .add("when loaded", () => <PageProperties {...page} />)
- .add("when loading", () => (
- <PageProperties loading={true} publicationDate="" isPublished={false} />
- ));