From ab2328f3643b55b6ae78bb1074d41f8ec2cf00f4 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun <cheeaun@gmail.com>
Date: Sat, 18 Feb 2023 21:37:34 +0800
Subject: [PATCH] Handle use-case when Following is not in Home, in
 multi-column mode

---
 src/app.jsx                           |  2 +-
 src/components/menu.jsx               | 14 ++++++++++++++
 src/components/shortcuts-settings.jsx |  2 +-
 src/pages/following.jsx               |  2 +-
 4 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/app.jsx b/src/app.jsx
index e6258275..1a3b6606 100644
--- a/src/app.jsx
+++ b/src/app.jsx
@@ -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 />} />}
diff --git a/src/components/menu.jsx b/src/components/menu.jsx
index 5271f47b..d1b3b791 100644
--- a/src/components/menu.jsx
+++ b/src/components/menu.jsx
@@ -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 && (
diff --git a/src/components/shortcuts-settings.jsx b/src/components/shortcuts-settings.jsx
index cd8f826f..d401334b 100644
--- a/src/components/shortcuts-settings.jsx
+++ b/src/components/shortcuts-settings.jsx
@@ -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: {
diff --git a/src/pages/following.jsx b/src/pages/following.jsx
index 39a39f3d..364e56bb 100644
--- a/src/pages/following.jsx
+++ b/src/pages/following.jsx
@@ -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();