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:
@@ -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>
|
||||
)}
|
||||
|
||||
@@ -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 shouldn’t 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 shouldn’t 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 you’ve recently viewed will be here for easy access"
|
||||
)}
|
||||
</Empty>
|
||||
}
|
||||
showCollection
|
||||
/>
|
||||
</Route>
|
||||
|
||||
Reference in New Issue
Block a user