2017-06-26 00:21:33 +00:00
|
|
|
|
// @flow
|
2020-06-20 20:59:15 +00:00
|
|
|
|
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";
|
2018-08-07 05:49:41 +00:00
|
|
|
|
|
2020-08-09 05:53:59 +00:00
|
|
|
|
import DocumentsStore from "stores/DocumentsStore";
|
|
|
|
|
import Actions, { Action } from "components/Actions";
|
2020-06-20 20:59:15 +00:00
|
|
|
|
import CenteredContent from "components/CenteredContent";
|
|
|
|
|
import Empty from "components/Empty";
|
|
|
|
|
import Heading from "components/Heading";
|
|
|
|
|
import InputSearch from "components/InputSearch";
|
2020-08-09 05:53:59 +00:00
|
|
|
|
import PageTitle from "components/PageTitle";
|
|
|
|
|
import PaginatedDocumentList from "components/PaginatedDocumentList";
|
2020-06-20 20:59:15 +00:00
|
|
|
|
import Tab from "components/Tab";
|
2020-08-09 05:53:59 +00:00
|
|
|
|
import Tabs from "components/Tabs";
|
2020-06-20 20:59:15 +00:00
|
|
|
|
import NewDocumentMenu from "menus/NewDocumentMenu";
|
2017-06-26 00:21:33 +00:00
|
|
|
|
|
2018-05-05 23:16:08 +00:00
|
|
|
|
type Props = {
|
|
|
|
|
documents: DocumentsStore,
|
2020-08-08 22:58:24 +00:00
|
|
|
|
match: Match,
|
2018-05-05 23:16:08 +00:00
|
|
|
|
};
|
2017-06-26 00:21:33 +00:00
|
|
|
|
|
2018-05-05 23:16:08 +00:00
|
|
|
|
@observer
|
|
|
|
|
class Starred extends React.Component<Props> {
|
2017-06-26 00:21:33 +00:00
|
|
|
|
render() {
|
2020-01-14 02:17:56 +00:00
|
|
|
|
const { fetchStarred, starred, starredAlphabetical } = this.props.documents;
|
2018-11-20 07:01:49 +00:00
|
|
|
|
const { sort } = this.props.match.params;
|
2017-07-18 04:46:32 +00:00
|
|
|
|
|
2017-06-26 00:21:33 +00:00
|
|
|
|
return (
|
2017-06-26 02:21:08 +00:00
|
|
|
|
<CenteredContent column auto>
|
2017-06-26 00:21:33 +00:00
|
|
|
|
<PageTitle title="Starred" />
|
2018-08-07 06:22:20 +00:00
|
|
|
|
<Heading>Starred</Heading>
|
2020-01-14 02:17:56 +00:00
|
|
|
|
<PaginatedDocumentList
|
|
|
|
|
heading={
|
2018-11-20 07:01:49 +00:00
|
|
|
|
<Tabs>
|
|
|
|
|
<Tab to="/starred" exact>
|
|
|
|
|
Recently Updated
|
|
|
|
|
</Tab>
|
|
|
|
|
<Tab to="/starred/alphabetical" exact>
|
|
|
|
|
Alphabetical
|
|
|
|
|
</Tab>
|
|
|
|
|
</Tabs>
|
2020-01-14 02:17:56 +00:00
|
|
|
|
}
|
|
|
|
|
empty={<Empty>You’ve not starred any documents yet.</Empty>}
|
|
|
|
|
fetch={fetchStarred}
|
2020-06-20 20:59:15 +00:00
|
|
|
|
documents={sort === "alphabetical" ? starredAlphabetical : starred}
|
2020-01-14 02:17:56 +00:00
|
|
|
|
showCollection
|
|
|
|
|
/>
|
|
|
|
|
|
2018-08-07 05:49:41 +00:00
|
|
|
|
<Actions align="center" justify="flex-end">
|
2020-01-10 03:14:34 +00:00
|
|
|
|
<Action>
|
2020-09-25 04:56:37 +00:00
|
|
|
|
<InputSearch source="starred" />
|
2020-01-10 03:14:34 +00:00
|
|
|
|
</Action>
|
2018-08-07 05:49:41 +00:00
|
|
|
|
<Action>
|
2019-07-13 17:15:38 +00:00
|
|
|
|
<NewDocumentMenu />
|
2018-08-07 05:49:41 +00:00
|
|
|
|
</Action>
|
|
|
|
|
</Actions>
|
2017-06-26 02:21:08 +00:00
|
|
|
|
</CenteredContent>
|
2017-06-26 00:21:33 +00:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-20 20:59:15 +00:00
|
|
|
|
export default inject("documents")(Starred);
|