diff options
author | MohammadReza Mahmoudi <rezamahmudy1@gmail.com> | 2023-05-31 03:12:22 +0330 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-30 18:42:22 -0500 |
commit | 442d453600a5dce98a2c197c94c9fb3d3a7fba78 (patch) | |
tree | df33e5cb6eeddf6ceacab46f05b6089895442dfd /src/view/shell/desktop/LeftNav.tsx | |
parent | 5d0a3e6c653c42ef9b8f45292534f5d520173e93 (diff) | |
download | voidsky-442d453600a5dce98a2c197c94c9fb3d3a7fba78.tar.zst |
Fix profile load issue + enhancement of profile isCurrent style (#764)
* fix profile isActive issue * fix myProfile load issue when visiting other profiles first * fix lint issues * change currentRouteName to currentRouteInfo
Diffstat (limited to 'src/view/shell/desktop/LeftNav.tsx')
-rw-r--r-- | src/view/shell/desktop/LeftNav.tsx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index ce232a730..914dfb53a 100644 --- a/src/view/shell/desktop/LeftNav.tsx +++ b/src/view/shell/desktop/LeftNav.tsx @@ -91,14 +91,17 @@ const NavItem = observer( const pal = usePalette('default') const store = useStores() const [pathName] = React.useMemo(() => router.matchPath(href), [href]) - const currentRouteName = useNavigationState(state => { + const currentRouteInfo = useNavigationState(state => { if (!state) { - return 'Home' + return {name: 'Home'} } - return getCurrentRoute(state).name + return getCurrentRoute(state) }) - - const isCurrent = isTab(currentRouteName, pathName) + let isCurrent = + currentRouteInfo.name === 'Profile' + ? isTab(currentRouteInfo.name, pathName) && + currentRouteInfo.params.name === store.me.handle + : isTab(currentRouteInfo.name, pathName) const {onPress} = useLinkProps({to: href}) const onPressWrapped = React.useCallback( (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => { |