feat: Default to "recently viewed" (#2390)

* feat: Default user to first collection on first app open

* Default home tab to 'recently viewed'

* fix: Styling of inactive tab
This commit is contained in:
Tom Moor
2021-07-30 10:16:03 -04:00
committed by GitHub
parent 63eb8aadaf
commit 59de4a7db0
4 changed files with 38 additions and 11 deletions

View File

@@ -13,7 +13,7 @@ type Props = {
const NavLinkWithChildrenFunc = ({ to, exact = false, children, ...rest }) => (
<Route path={to} exact={exact}>
{({ match }) => (
<NavLink to={to} {...rest}>
<NavLink to={to} exact={exact} {...rest}>
{children(match)}
</NavLink>
)}

View File

@@ -5,6 +5,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next";
import { Switch, Route } from "react-router-dom";
import { Action } from "components/Actions";
import Empty from "components/Empty";
import Heading from "components/Heading";
import InputSearchPage from "components/InputSearchPage";
import LanguagePrompt from "components/LanguagePrompt";
@@ -41,19 +42,19 @@ function Home() {
<Heading>{t("Home")}</Heading>
<Tabs>
<Tab to="/home" exact>
{t("Recently updated")}
{t("Recently viewed")}
</Tab>
<Tab to="/home/recent" exact>
{t("Recently viewed")}
{t("Recently updated")}
</Tab>
<Tab to="/home/created">{t("Created by me")}</Tab>
</Tabs>
<Switch>
<Route path="/home/recent">
<PaginatedDocumentList
key="recent"
documents={documents.recentlyViewed}
fetch={documents.fetchRecentlyViewed}
documents={documents.recentlyUpdated}
fetch={documents.fetchRecentlyUpdated}
empty={<Empty>{t("Weird, this shouldnt ever be empty")}</Empty>}
showCollection
/>
</Route>
@@ -63,13 +64,22 @@ function Home() {
documents={documents.createdByUser(user)}
fetch={documents.fetchOwned}
options={{ user }}
empty={<Empty>{t("Weird, this shouldnt ever be empty")}</Empty>}
showCollection
/>
</Route>
<Route path="/home">
<PaginatedDocumentList
documents={documents.recentlyUpdated}
fetch={documents.fetchRecentlyUpdated}
key="recent"
documents={documents.recentlyViewed}
fetch={documents.fetchRecentlyViewed}
empty={
<Empty>
{t(
"Documents youve recently viewed will be here for easy access"
)}
</Empty>
}
showCollection
/>
</Route>