saleor-dashboard/src/webhooks/components/WebhooksListPage/WebhooksListPage.tsx

77 lines
2.2 KiB
TypeScript
Raw Normal View History

2019-10-09 20:50:03 +00:00
import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
2019-10-09 06:01:52 +00:00
import React from "react";
2019-10-09 20:50:03 +00:00
import { FormattedMessage, useIntl } from "react-intl";
2019-10-09 06:01:52 +00:00
import AppHeader from "@saleor/components/AppHeader";
import Container from "@saleor/components/Container";
import PageHeader from "@saleor/components/PageHeader";
import SearchBar from "@saleor/components/SearchBar";
2019-10-09 06:01:52 +00:00
import { sectionNames } from "@saleor/intl";
import { PageListProps, SearchPageProps, TabPageProps } from "@saleor/types";
2019-10-09 06:56:46 +00:00
import { Webhooks_webhooks_edges_node } from "../../types/Webhooks";
2019-10-09 06:01:52 +00:00
import WebhooksList from "../WebhooksList/WebhooksList";
export interface WebhooksListPageProps
extends PageListProps,
SearchPageProps,
TabPageProps {
2019-10-09 06:56:46 +00:00
webhooks: Webhooks_webhooks_edges_node[];
2019-10-09 06:01:52 +00:00
onBack: () => void;
2019-10-10 06:09:29 +00:00
onRemove: (id: string) => void;
2019-10-09 06:01:52 +00:00
}
const WebhooksListPage: React.StatelessComponent<WebhooksListPageProps> = ({
currentTab,
initialSearch,
2019-10-09 20:50:03 +00:00
onAdd,
onAll,
2019-10-09 06:01:52 +00:00
onBack,
onSearchChange,
onTabChange,
onTabDelete,
onTabSave,
tabs,
webhooks,
...listProps
2019-10-09 06:01:52 +00:00
}) => {
const intl = useIntl();
return (
<Container>
<AppHeader onBack={onBack}>
{intl.formatMessage(sectionNames.configuration)}
</AppHeader>
2019-10-09 20:50:03 +00:00
<PageHeader title={intl.formatMessage(sectionNames.webhooks)}>
<Button onClick={onAdd} variant="contained" color="primary">
<FormattedMessage
defaultMessage="Create webhook"
description="button"
/>
</Button>
</PageHeader>
<Card>
<SearchBar
allTabLabel={intl.formatMessage({
defaultMessage: "All Webhooks",
description: "tab name"
})}
currentTab={currentTab}
initialSearch={initialSearch}
searchPlaceholder={intl.formatMessage({
defaultMessage: "Search Webhooks"
})}
tabs={tabs}
onAll={onAll}
onSearchChange={onSearchChange}
onTabChange={onTabChange}
onTabDelete={onTabDelete}
onTabSave={onTabSave}
/>
<WebhooksList webhooks={webhooks} {...listProps} />
</Card>
2019-10-09 06:01:52 +00:00
</Container>
);
};
WebhooksListPage.displayName = "WebhooksListPage";
export default WebhooksListPage;