keep message tab icon highlighted
This commit is contained in:
@@ -46,11 +46,7 @@ export function isTab(current: string, route: string) {
|
|||||||
// our tab routes can be variously referenced by 3 different names
|
// our tab routes can be variously referenced by 3 different names
|
||||||
// this helper deals with that weirdness
|
// this helper deals with that weirdness
|
||||||
// -prf
|
// -prf
|
||||||
return (
|
return current.startsWith(route)
|
||||||
current === route ||
|
|
||||||
current === `${route}Tab` ||
|
|
||||||
current === `${route}Inner`
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TabState {
|
export enum TabState {
|
||||||
|
|||||||
@@ -295,12 +295,17 @@ function SwitcherMenuProfileLink() {
|
|||||||
}
|
}
|
||||||
return getCurrentRoute(state)
|
return getCurrentRoute(state)
|
||||||
})
|
})
|
||||||
let isCurrent =
|
const isCurrent = useMemo(() => {
|
||||||
currentRouteInfo.name === 'Profile'
|
if (currentRouteInfo.name === 'Profile') {
|
||||||
? isTab(currentRouteInfo.name, pathName) &&
|
return (
|
||||||
|
isTab(currentRouteInfo.name, pathName) &&
|
||||||
(currentRouteInfo.params as CommonNavigatorParams['Profile']).name ===
|
(currentRouteInfo.params as CommonNavigatorParams['Profile']).name ===
|
||||||
currentAccount?.handle
|
currentAccount?.handle
|
||||||
: isTab(currentRouteInfo.name, pathName)
|
)
|
||||||
|
} else {
|
||||||
|
return isTab(currentRouteInfo.name, pathName)
|
||||||
|
}
|
||||||
|
}, [currentAccount?.handle, currentRouteInfo, pathName])
|
||||||
const onProfilePress = useCallback(
|
const onProfilePress = useCallback(
|
||||||
(e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
|
(e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
|
||||||
if (e.ctrlKey || e.metaKey || e.altKey) {
|
if (e.ctrlKey || e.metaKey || e.altKey) {
|
||||||
|
|||||||
Reference in New Issue
Block a user