Handle use-case when Following is not in Home, in multi-column mode

This commit is contained in:
Lim Chee Aun 2023-02-18 21:37:34 +08:00
parent 02eb2ff470
commit ab2328f364
4 changed files with 17 additions and 3 deletions

View file

@ -258,7 +258,7 @@ function App() {
{isLoggedIn && (
<Route path="/notifications" element={<Notifications />} />
)}
{isLoggedIn && <Route path="/l/f" element={<Following />} />}
{isLoggedIn && <Route path="/following" element={<Following />} />}
{isLoggedIn && <Route path="/homev1" element={<HomeV1 />} />}
{isLoggedIn && <Route path="/b" element={<Bookmarks />} />}
{isLoggedIn && <Route path="/f" element={<Favourites />} />}

View file

@ -10,6 +10,15 @@ import MenuLink from './MenuLink';
function NavMenu(props) {
const snapStates = useSnapshot(states);
const { instance, authenticated } = api();
// Home = Following
// But when in multi-column mode, Home becomes columns of anything
// User may choose pin or not to pin Following
// If user doesn't pin Following, we show it in the menu
const showFollowing =
snapStates.settings.shortcutsColumnsMode &&
!snapStates.shortcuts.find((pin) => pin.type === 'following');
return (
<Menu
portal={{
@ -30,6 +39,11 @@ function NavMenu(props) {
</MenuLink>
{authenticated && (
<>
{showFollowing && (
<MenuLink to="/following">
<Icon icon="following" size="l" /> <span>Following</span>
</MenuLink>
)}
<MenuLink to="/notifications">
<Icon icon="notification" size="l" /> <span>Notifications</span>
{snapStates.notificationsShowNew && (

View file

@ -81,7 +81,7 @@ const TYPE_PARAMS = {
export const SHORTCUTS_META = {
following: {
title: 'Home / Following',
path: (_, index) => (index === 0 ? '/' : '/l/f'),
path: (_, index) => (index === 0 ? '/' : '/following'),
icon: 'home',
},
notifications: {

View file

@ -10,7 +10,7 @@ import useTitle from '../utils/useTitle';
const LIMIT = 20;
function Following({ title, path, id, ...props }) {
useTitle(title || 'Following', path, '/l/f');
useTitle(title || 'Following', path || '/following');
const { masto, instance } = api();
const snapStates = useSnapshot(states);
const homeIterator = useRef();