Skip to content

Commit

Permalink
Gate chat icon in bottom bars (#3959)
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey authored May 10, 2024
1 parent f84a2de commit 2974ce1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 4 deletions.
42 changes: 39 additions & 3 deletions src/view/shell/bottom-bar/BottomBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import {
Bell_Filled_Corner0_Rounded as BellFilled,
Bell_Stroke2_Corner0_Rounded as Bell,
} from '#/components/icons/Bell'
import {
Hashtag_Filled_Corner0_Rounded as HashtagFilled,
Hashtag_Stroke2_Corner0_Rounded as Hashtag,
} from '#/components/icons/Hashtag'
import {
HomeOpen_Filled_Corner0_Rounded as HomeFilled,
HomeOpen_Stoke2_Corner0_Rounded as Home,
Expand Down Expand Up @@ -63,8 +67,14 @@ export function BottomBar({navigation}: BottomTabBarProps) {
const safeAreaInsets = useSafeAreaInsets()
const {track} = useAnalytics()
const {footerHeight} = useShellLayout()
const {isAtHome, isAtSearch, isAtNotifications, isAtMyProfile, isAtMessages} =
useNavigationTabState()
const {
isAtHome,
isAtSearch,
isAtFeeds,
isAtNotifications,
isAtMyProfile,
isAtMessages,
} = useNavigationTabState()
const numUnreadNotifications = useUnreadNotifications()
const numUnreadMessages = useUnreadMessageCount()
const {footerMinimalShellTransform} = useMinimalShellMode()
Expand Down Expand Up @@ -108,6 +118,10 @@ export function BottomBar({navigation}: BottomTabBarProps) {
() => onPressTab('Search'),
[onPressTab],
)
const onPressFeeds = React.useCallback(
() => onPressTab('Feeds'),
[onPressTab],
)
const onPressNotifications = React.useCallback(
() => onPressTab('Notifications'),
[onPressTab],
Expand Down Expand Up @@ -182,7 +196,7 @@ export function BottomBar({navigation}: BottomTabBarProps) {
accessibilityLabel={_(msg`Search`)}
accessibilityHint=""
/>
{gate('dms') && (
{gate('dms') ? (
<Btn
testID="bottomBarMessagesBtn"
icon={
Expand All @@ -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
testID="bottomBarNotificationsBtn"
Expand Down
18 changes: 17 additions & 1 deletion src/view/shell/bottom-bar/BottomBarWeb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import {
Bell_Filled_Corner0_Rounded as BellFilled,
Bell_Stroke2_Corner0_Rounded as Bell,
} from '#/components/icons/Bell'
import {
Hashtag_Filled_Corner0_Rounded as HashtagFilled,
Hashtag_Stroke2_Corner0_Rounded as Hashtag,
} from '#/components/icons/Hashtag'
import {
HomeOpen_Filled_Corner0_Rounded as HomeFilled,
HomeOpen_Stoke2_Corner0_Rounded as Home,
Expand Down Expand Up @@ -101,7 +105,7 @@ export function BottomBarWeb() {

{hasSession && (
<>
{gate('dms') && (
{gate('dms') ? (
<NavItem routeName="Messages" href="/messages">
{({isActive}) => {
const Icon = isActive ? MessageFilled : Message
Expand All @@ -113,6 +117,18 @@ export function BottomBarWeb() {
)
}}
</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">
{({isActive}) => {
Expand Down

0 comments on commit 2974ce1

Please sign in to comment.