2017-06-26 00:21:33 +00:00
|
|
|
|
// @flow
|
2020-11-30 04:04:58 +00:00
|
|
|
|
import { observer } from "mobx-react";
|
2020-08-09 05:53:59 +00:00
|
|
|
|
import * as React from "react";
|
2020-11-30 04:04:58 +00:00
|
|
|
|
import { useTranslation } from "react-i18next";
|
2020-08-08 22:58:24 +00:00
|
|
|
|
import { type Match } from "react-router-dom";
|
2020-08-09 05:53:59 +00:00
|
|
|
|
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-11-30 04:04:58 +00:00
|
|
|
|
import useStores from "hooks/useStores";
|
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 = {
|
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
|
|
|
|
|
2020-11-30 04:04:58 +00:00
|
|
|
|
function Starred(props: Props) {
|
|
|
|
|
const { documents } = useStores();
|
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
const { fetchStarred, starred, starredAlphabetical } = documents;
|
|
|
|
|
const { sort } = props.match.params;
|
2017-07-18 04:46:32 +00:00
|
|
|
|
|
2020-11-30 04:04:58 +00:00
|
|
|
|
return (
|
|
|
|
|
<CenteredContent column auto>
|
|
|
|
|
<PageTitle title={t("Starred")} />
|
|
|
|
|
<Heading>{t("Starred")}</Heading>
|
|
|
|
|
<PaginatedDocumentList
|
|
|
|
|
heading={
|
|
|
|
|
<Tabs>
|
|
|
|
|
<Tab to="/starred" exact>
|
|
|
|
|
{t("Recently updated")}
|
|
|
|
|
</Tab>
|
|
|
|
|
<Tab to="/starred/alphabetical" exact>
|
|
|
|
|
{t("Alphabetical")}
|
|
|
|
|
</Tab>
|
|
|
|
|
</Tabs>
|
|
|
|
|
}
|
|
|
|
|
empty={<Empty>{t("You’ve not starred any documents yet.")}</Empty>}
|
|
|
|
|
fetch={fetchStarred}
|
|
|
|
|
documents={sort === "alphabetical" ? starredAlphabetical : starred}
|
|
|
|
|
showCollection
|
|
|
|
|
/>
|
2020-01-14 02:17:56 +00:00
|
|
|
|
|
2020-11-30 04:04:58 +00:00
|
|
|
|
<Actions align="center" justify="flex-end">
|
|
|
|
|
<Action>
|
|
|
|
|
<InputSearch source="starred" />
|
|
|
|
|
</Action>
|
|
|
|
|
<Action>
|
|
|
|
|
<NewDocumentMenu />
|
|
|
|
|
</Action>
|
|
|
|
|
</Actions>
|
|
|
|
|
</CenteredContent>
|
|
|
|
|
);
|
2017-06-26 00:21:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-30 04:04:58 +00:00
|
|
|
|
export default observer(Starred);
|