fix: click on our profile when seeing someone's profile (#7732)

Co-authored-by: Stanislas Signoud <signez@stanisoft.net>
Co-authored-by: Hailey <me@haileyok.com>
This commit is contained in:
Nicolas Borlet
2025-02-21 20:39:57 +01:00
committed by GitHub
parent ca7116ec3b
commit cb85768e9c
+12 -2
View File
@@ -240,18 +240,28 @@ const NavItem: React.FC<{
} }
return getCurrentRoute(state) return getCurrentRoute(state)
}) })
// Checks whether we're on someone else's profile
const isOnDifferentProfile =
currentRoute.name === 'Profile' &&
routeName === 'Profile' &&
(currentRoute.params as CommonNavigatorParams['Profile']).name !==
currentAccount?.handle
const isActive = const isActive =
currentRoute.name === 'Profile' currentRoute.name === 'Profile'
? isTab(currentRoute.name, routeName) && ? isTab(currentRoute.name, routeName) &&
(currentRoute.params as CommonNavigatorParams['Profile']).name === (currentRoute.params as CommonNavigatorParams['Profile']).name ===
currentAccount?.handle (routeName === 'Profile'
? currentAccount?.handle
: (currentRoute.params as CommonNavigatorParams['Profile']).name)
: isTab(currentRoute.name, routeName) : isTab(currentRoute.name, routeName)
return ( return (
<Link <Link
href={href} href={href}
style={[styles.ctrl, a.pb_lg]} style={[styles.ctrl, a.pb_lg]}
navigationAction="navigate" navigationAction={isOnDifferentProfile ? 'push' : 'navigate'}
aria-role="link" aria-role="link"
aria-label={routeName} aria-label={routeName}
accessible={true}> accessible={true}>