diff --git a/src/view/shell/bottom-bar/BottomBar.tsx b/src/view/shell/bottom-bar/BottomBar.tsx index 067ccc1929..7c2a010ab1 100644 --- a/src/view/shell/bottom-bar/BottomBar.tsx +++ b/src/view/shell/bottom-bar/BottomBar.tsx @@ -15,7 +15,6 @@ import {useDedupe} from '#/lib/hooks/useDedupe' import {useHideBottomBarBorder} from '#/lib/hooks/useHideBottomBarBorder' import {useMinimalShellFooterTransform} from '#/lib/hooks/useMinimalShellTransform' import {useNavigationTabState} from '#/lib/hooks/useNavigationTabState' -import {usePalette} from '#/lib/hooks/usePalette' import {clamp} from '#/lib/numbers' import {getTabState, TabState} from '#/lib/routes/helpers' import {emitSoftReset} from '#/state/events' @@ -57,7 +56,7 @@ type TabOptions = 'Home' | 'Search' | 'Messages' | 'Notifications' | 'MyProfile' export function BottomBar({navigation}: BottomTabBarProps) { const {hasSession, currentAccount} = useSession() - const pal = usePalette('default') + const t = useTheme() const {_} = useLingui() const safeAreaInsets = useSafeAreaInsets() const {footerHeight} = useShellLayout() @@ -145,8 +144,10 @@ export function BottomBar({navigation}: BottomTabBarProps) { ) : ( ) } @@ -180,13 +181,13 @@ export function BottomBar({navigation}: BottomTabBarProps) { isAtSearch ? ( ) : ( ) } @@ -201,12 +202,12 @@ export function BottomBar({navigation}: BottomTabBarProps) { isAtMessages ? ( ) : ( ) } @@ -233,12 +234,12 @@ export function BottomBar({navigation}: BottomTabBarProps) { isAtNotifications ? ( ) : ( ) } @@ -262,49 +263,28 @@ export function BottomBar({navigation}: BottomTabBarProps) { testID="bottomBarProfileBtn" icon={ - {isAtMyProfile ? ( - - - - ) : ( - - - - )} + ], + ]}> + + } onPress={onPressProfile} @@ -332,7 +312,7 @@ export function BottomBar({navigation}: BottomTabBarProps) { style={{flexDirection: 'row', alignItems: 'center', gap: 8}}> - + diff --git a/src/view/shell/bottom-bar/BottomBarWeb.tsx b/src/view/shell/bottom-bar/BottomBarWeb.tsx index 1d24a08cd6..e5bd6be049 100644 --- a/src/view/shell/bottom-bar/BottomBarWeb.tsx +++ b/src/view/shell/bottom-bar/BottomBarWeb.tsx @@ -12,15 +12,19 @@ import {makeProfileLink} from '#/lib/routes/links' import {type CommonNavigatorParams} from '#/lib/routes/types' import {useUnreadMessageCount} from '#/state/queries/messages/list-conversations' import {useUnreadNotifications} from '#/state/queries/notifications/unread' +import {useProfileQuery} from '#/state/queries/profile' import {useSession} from '#/state/session' import {useLoggedOutViewControls} from '#/state/shell/logged-out' import {useShellLayout} from '#/state/shell/shell-layout' import {useCloseAllActiveElements} from '#/state/util' import {Link} from '#/view/com/util/Link' +import {UserAvatar} from '#/view/com/util/UserAvatar' import {Logo} from '#/view/icons/Logo' import {Logotype} from '#/view/icons/Logotype' import {atoms as a, useTheme} from '#/alf' import {Button, ButtonText} from '#/components/Button' +import {useDialogControl} from '#/components/Dialog' +import {SwitchAccountDialog} from '#/components/dialogs/SwitchAccount' import { Bell_Filled_Corner0_Rounded as BellFilled, Bell_Stroke2_Corner0_Rounded as Bell, @@ -37,10 +41,6 @@ import { Message_Stroke2_Corner0_Rounded as Message, Message_Stroke2_Corner0_Rounded_Filled as MessageFilled, } from '#/components/icons/Message' -import { - UserCircle_Filled_Corner0_Rounded as UserCircleFilled, - UserCircle_Stroke2_Corner0_Rounded as UserCircle, -} from '#/components/icons/UserCircle' import {Text} from '#/components/Typography' import {styles} from './BottomBarStyles' @@ -53,6 +53,8 @@ export function BottomBarWeb() { const closeAllActiveElements = useCloseAllActiveElements() const {footerHeight} = useShellLayout() const hideBorder = useHideBottomBarBorder() + const accountSwitchControl = useDialogControl() + const {data: profile} = useProfileQuery({did: currentAccount?.did}) const iconWidth = 26 const unreadMessageCount = useUnreadMessageCount() @@ -69,158 +71,176 @@ export function BottomBarWeb() { // setShowLoggedOut(true) }, [requestSwitchToAccount, closeAllActiveElements]) - return ( - footerHeight.set(event.nativeEvent.layout.height)}> - {hasSession ? ( - <> - - {({isActive}) => { - const Icon = isActive ? HomeFilled : Home - return ( - - ) - }} - - - {({isActive}) => { - const Icon = isActive ? MagnifyingGlassFilled : MagnifyingGlass - return ( - - ) - }} - + const onLongPressProfile = React.useCallback(() => { + accountSwitchControl.open() + }, [accountSwitchControl]) - {hasSession && ( - <> - - {({isActive}) => { - const Icon = isActive ? MessageFilled : Message - return ( - - ) - }} - - - {({isActive}) => { - const Icon = isActive ? BellFilled : Bell - return ( - - ) - }} - - - {({isActive}) => { - const Icon = isActive ? UserCircleFilled : UserCircle - return ( - - ) - }} - - - )} - - ) : ( - <> - - - - - + return ( + <> + + + footerHeight.set(event.nativeEvent.layout.height)}> + {hasSession ? ( + <> + + {({isActive}) => { + const Icon = isActive ? HomeFilled : Home + return ( + + ) + }} + + + {({isActive}) => { + const Icon = isActive ? MagnifyingGlassFilled : MagnifyingGlass + return ( + + ) + }} + + + {hasSession && ( + <> + + {({isActive}) => { + const Icon = isActive ? MessageFilled : Message + return ( + + ) + }} + + + {({isActive}) => { + const Icon = isActive ? BellFilled : Bell + return ( + + ) + }} + + + {({isActive}) => ( + + + + + + )} + + + )} + + ) : ( + <> + + + + + + + + + + + - - - - - - - - )} - + + )} + + ) } @@ -230,7 +250,8 @@ const NavItem: React.FC<{ routeName: string hasNew?: boolean notificationCount?: string -}> = ({children, href, routeName, hasNew, notificationCount}) => { + onLongPress?: () => void +}> = ({children, href, routeName, hasNew, notificationCount, onLongPress}) => { const t = useTheme() const {_} = useLingui() const {currentAccount} = useSession() @@ -264,7 +285,8 @@ const NavItem: React.FC<{ navigationAction={isOnDifferentProfile ? 'push' : 'navigate'} aria-role="link" aria-label={routeName} - accessible={true}> + accessible={true} + onLongPress={onLongPress}> {children({isActive})} {notificationCount ? (