Gate chat icon in bottom bars (#3959)

zio/stable
Eric Bailey 2024-05-10 18:02:33 -05:00 committed by GitHub
parent f84a2def29
commit 2974ce1b20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 56 additions and 4 deletions

View File

@ -36,6 +36,10 @@ import {
Bell_Filled_Corner0_Rounded as BellFilled, Bell_Filled_Corner0_Rounded as BellFilled,
Bell_Stroke2_Corner0_Rounded as Bell, Bell_Stroke2_Corner0_Rounded as Bell,
} from '#/components/icons/Bell' } from '#/components/icons/Bell'
import {
Hashtag_Filled_Corner0_Rounded as HashtagFilled,
Hashtag_Stroke2_Corner0_Rounded as Hashtag,
} from '#/components/icons/Hashtag'
import { import {
HomeOpen_Filled_Corner0_Rounded as HomeFilled, HomeOpen_Filled_Corner0_Rounded as HomeFilled,
HomeOpen_Stoke2_Corner0_Rounded as Home, HomeOpen_Stoke2_Corner0_Rounded as Home,
@ -63,8 +67,14 @@ export function BottomBar({navigation}: BottomTabBarProps) {
const safeAreaInsets = useSafeAreaInsets() const safeAreaInsets = useSafeAreaInsets()
const {track} = useAnalytics() const {track} = useAnalytics()
const {footerHeight} = useShellLayout() const {footerHeight} = useShellLayout()
const {isAtHome, isAtSearch, isAtNotifications, isAtMyProfile, isAtMessages} = const {
useNavigationTabState() isAtHome,
isAtSearch,
isAtFeeds,
isAtNotifications,
isAtMyProfile,
isAtMessages,
} = useNavigationTabState()
const numUnreadNotifications = useUnreadNotifications() const numUnreadNotifications = useUnreadNotifications()
const numUnreadMessages = useUnreadMessageCount() const numUnreadMessages = useUnreadMessageCount()
const {footerMinimalShellTransform} = useMinimalShellMode() const {footerMinimalShellTransform} = useMinimalShellMode()
@ -108,6 +118,10 @@ export function BottomBar({navigation}: BottomTabBarProps) {
() => onPressTab('Search'), () => onPressTab('Search'),
[onPressTab], [onPressTab],
) )
const onPressFeeds = React.useCallback(
() => onPressTab('Feeds'),
[onPressTab],
)
const onPressNotifications = React.useCallback( const onPressNotifications = React.useCallback(
() => onPressTab('Notifications'), () => onPressTab('Notifications'),
[onPressTab], [onPressTab],
@ -182,7 +196,7 @@ export function BottomBar({navigation}: BottomTabBarProps) {
accessibilityLabel={_(msg`Search`)} accessibilityLabel={_(msg`Search`)}
accessibilityHint="" accessibilityHint=""
/> />
{gate('dms') && ( {gate('dms') ? (
<Btn <Btn
testID="bottomBarMessagesBtn" testID="bottomBarMessagesBtn"
icon={ icon={
@ -209,6 +223,28 @@ export function BottomBar({navigation}: BottomTabBarProps) {
: '' : ''
} }
/> />
) : (
<Btn
testID="bottomBarFeedsBtn"
icon={
isAtFeeds ? (
<HashtagFilled
width={iconWidth + 1}
style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
/>
) : (
<Hashtag
width={iconWidth + 1}
style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
/>
)
}
onPress={onPressFeeds}
accessible={true}
accessibilityRole="tab"
accessibilityLabel={_(msg`Feeds`)}
accessibilityHint=""
/>
)} )}
<Btn <Btn
testID="bottomBarNotificationsBtn" testID="bottomBarNotificationsBtn"

View File

@ -26,6 +26,10 @@ import {
Bell_Filled_Corner0_Rounded as BellFilled, Bell_Filled_Corner0_Rounded as BellFilled,
Bell_Stroke2_Corner0_Rounded as Bell, Bell_Stroke2_Corner0_Rounded as Bell,
} from '#/components/icons/Bell' } from '#/components/icons/Bell'
import {
Hashtag_Filled_Corner0_Rounded as HashtagFilled,
Hashtag_Stroke2_Corner0_Rounded as Hashtag,
} from '#/components/icons/Hashtag'
import { import {
HomeOpen_Filled_Corner0_Rounded as HomeFilled, HomeOpen_Filled_Corner0_Rounded as HomeFilled,
HomeOpen_Stoke2_Corner0_Rounded as Home, HomeOpen_Stoke2_Corner0_Rounded as Home,
@ -101,7 +105,7 @@ export function BottomBarWeb() {
{hasSession && ( {hasSession && (
<> <>
{gate('dms') && ( {gate('dms') ? (
<NavItem routeName="Messages" href="/messages"> <NavItem routeName="Messages" href="/messages">
{({isActive}) => { {({isActive}) => {
const Icon = isActive ? MessageFilled : Message const Icon = isActive ? MessageFilled : Message
@ -113,6 +117,18 @@ export function BottomBarWeb() {
) )
}} }}
</NavItem> </NavItem>
) : (
<NavItem routeName="Feeds" href="/feeds">
{({isActive}) => {
const Icon = isActive ? HashtagFilled : Hashtag
return (
<Icon
width={iconWidth + 1}
style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
/>
)
}}
</NavItem>
)} )}
<NavItem routeName="Notifications" href="/notifications"> <NavItem routeName="Notifications" href="/notifications">
{({isActive}) => { {({isActive}) => {