2020-08-08 22:18:37 +00:00
|
|
|
// @flow
|
|
|
|
import { observer, inject } from "mobx-react";
|
2020-08-09 05:53:59 +00:00
|
|
|
import * as React from "react";
|
2020-08-08 22:58:24 +00:00
|
|
|
import { type Match } from "react-router-dom";
|
2020-08-08 22:18:37 +00:00
|
|
|
|
2020-08-09 05:53:59 +00:00
|
|
|
import DocumentsStore from "stores/DocumentsStore";
|
|
|
|
import Actions, { Action } from "components/Actions";
|
2020-08-08 22:18:37 +00:00
|
|
|
import CenteredContent from "components/CenteredContent";
|
|
|
|
import Empty from "components/Empty";
|
|
|
|
import Heading from "components/Heading";
|
2020-08-09 05:53:59 +00:00
|
|
|
import PageTitle from "components/PageTitle";
|
2020-08-08 22:18:37 +00:00
|
|
|
import PaginatedDocumentList from "components/PaginatedDocumentList";
|
|
|
|
import Tab from "components/Tab";
|
2020-08-09 05:53:59 +00:00
|
|
|
import Tabs from "components/Tabs";
|
2020-08-08 22:18:37 +00:00
|
|
|
import NewTemplateMenu from "menus/NewTemplateMenu";
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
documents: DocumentsStore,
|
2020-08-08 22:58:24 +00:00
|
|
|
match: Match,
|
2020-08-08 22:18:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
@observer
|
|
|
|
class Templates extends React.Component<Props> {
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
fetchTemplates,
|
|
|
|
templates,
|
|
|
|
templatesAlphabetical,
|
|
|
|
} = this.props.documents;
|
|
|
|
const { sort } = this.props.match.params;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<CenteredContent column auto>
|
|
|
|
<PageTitle title="Templates" />
|
|
|
|
<Heading>Templates</Heading>
|
|
|
|
<PaginatedDocumentList
|
|
|
|
heading={
|
|
|
|
<Tabs>
|
|
|
|
<Tab to="/templates" exact>
|
|
|
|
Recently Updated
|
|
|
|
</Tab>
|
|
|
|
<Tab to="/templates/alphabetical" exact>
|
|
|
|
Alphabetical
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
}
|
|
|
|
empty={
|
|
|
|
<Empty>
|
|
|
|
There are no templates just yet. You can create templates to help
|
|
|
|
your team create consistent and accurate documentation.
|
|
|
|
</Empty>
|
|
|
|
}
|
|
|
|
fetch={fetchTemplates}
|
|
|
|
documents={
|
|
|
|
sort === "alphabetical" ? templatesAlphabetical : templates
|
|
|
|
}
|
|
|
|
showCollection
|
|
|
|
showDraft
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Actions align="center" justify="flex-end">
|
|
|
|
<Action>
|
|
|
|
<NewTemplateMenu />
|
|
|
|
</Action>
|
|
|
|
</Actions>
|
|
|
|
</CenteredContent>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default inject("documents")(Templates);
|