Some me model cleanup (#1928)

* Replace me model in post dropdown btn

* Replace delete account logic

* Replace me model in bottom bar web

* Replace me model in bottom bar

* Replace me model in reply prompt

* Better fallback

* Fix reference

* Fix bad ref in bottom bar
This commit is contained in:
Eric Bailey 2023-11-16 12:54:03 -06:00 committed by GitHub
parent a652b52b88
commit 310a7eaca7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 22 deletions

View file

@ -1,6 +1,5 @@
import React from 'react'
import {observer} from 'mobx-react-lite'
import {useStores} from 'state/index'
import {usePalette} from 'lib/hooks/usePalette'
import {useNavigationState} from '@react-navigation/native'
import Animated from 'react-native-reanimated'
@ -23,9 +22,10 @@ import {Link} from 'view/com/util/Link'
import {useMinimalShellMode} from 'lib/hooks/useMinimalShellMode'
import {makeProfileLink} from 'lib/routes/links'
import {CommonNavigatorParams} from 'lib/routes/types'
import {useSession} from '#/state/session'
export const BottomBarWeb = observer(function BottomBarWebImpl() {
const store = useStores()
const {currentAccount} = useSession()
const pal = usePalette('default')
const safeAreaInsets = useSafeAreaInsets()
const {footerMinimalShellTransform} = useMinimalShellMode()
@ -88,7 +88,16 @@ export const BottomBarWeb = observer(function BottomBarWebImpl() {
)
}}
</NavItem>
<NavItem routeName="Profile" href={makeProfileLink(store.me)}>
<NavItem
routeName="Profile"
href={
currentAccount
? makeProfileLink({
did: currentAccount.did,
handle: currentAccount.handle,
})
: '/'
}>
{({isActive}) => {
const Icon = isActive ? UserIconSolid : UserIcon
return (
@ -109,18 +118,18 @@ const NavItem: React.FC<{
href: string
routeName: string
}> = ({children, href, routeName}) => {
const {currentAccount} = useSession()
const currentRoute = useNavigationState(state => {
if (!state) {
return {name: 'Home'}
}
return getCurrentRoute(state)
})
const store = useStores()
const isActive =
currentRoute.name === 'Profile'
? isTab(currentRoute.name, routeName) &&
(currentRoute.params as CommonNavigatorParams['Profile']).name ===
store.me.handle
currentAccount?.handle
: isTab(currentRoute.name, routeName)
return (