From 2b2f6c28a9177cb3ba335bbb7c22cfc7f51a852a Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 4 Mar 2024 16:41:06 +0800 Subject: [PATCH] Time to re-organize this main menu Will need to gather feedback --- src/components/nav-menu.jsx | 147 +++++++++++++++++++++--------------- 1 file changed, 85 insertions(+), 62 deletions(-) diff --git a/src/components/nav-menu.jsx b/src/components/nav-menu.jsx index 46d5deed..6e6b52cf 100644 --- a/src/components/nav-menu.jsx +++ b/src/components/nav-menu.jsx @@ -1,6 +1,11 @@ import './nav-menu.css'; -import { ControlledMenu, MenuDivider, MenuItem } from '@szhsin/react-menu'; +import { + ControlledMenu, + MenuDivider, + MenuItem, + SubMenu, +} from '@szhsin/react-menu'; import { memo } from 'preact/compat'; import { useEffect, useRef, useState } from 'preact/hooks'; import { useLongPress } from 'use-long-press'; @@ -169,7 +174,7 @@ function NavMenu(props) { Home - {authenticated && ( + {authenticated ? ( <> {showFollowing && ( @@ -192,44 +197,64 @@ function NavMenu(props) { )} - - - Lists - - - Followed Hashtags - - - Bookmarks - - - Likes - - - )} - - - Search - - - Local - - - Federated - - - Trending - - -
- {authenticated ? ( - <> {currentAccount?.info?.id && ( Profile )} + + Lists + + + Bookmarks + + + + Moreā€¦ + + + } + > + + Likes + + + {' '} + Followed Hashtags + + + { + states.showGenericAccounts = { + id: 'mute', + heading: 'Muted users', + fetchAccounts: fetchMutes, + excludeRelationshipAttrs: ['muting'], + }; + }} + > + Muted users… + + { + states.showGenericAccounts = { + id: 'block', + heading: 'Blocked users', + fetchAccounts: fetchBlocks, + excludeRelationshipAttrs: ['blocking'], + }; + }} + > + + Blocked users… + {' '} + + { states.showAccounts = true; @@ -237,31 +262,32 @@ function NavMenu(props) { > Accounts… - { - states.showGenericAccounts = { - id: 'mute', - heading: 'Muted users', - fetchAccounts: fetchMutes, - excludeRelationshipAttrs: ['muting'], - }; - }} - > - Muted users… - - { - states.showGenericAccounts = { - id: 'block', - heading: 'Blocked users', - fetchAccounts: fetchBlocks, - excludeRelationshipAttrs: ['blocking'], - }; - }} - > - - Blocked users… - + + ) : ( + <> + + + Log in + + + )} +
+
+ + + Search + + + Trending + + + Local + + + Federated + + {authenticated ? ( + <> { @@ -290,9 +316,6 @@ function NavMenu(props) { ) : ( <> - - Log in - { states.showSettings = true;