diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json index 825a0d22d..f0aba5c4c 100644 --- a/oxlint-suppressions.json +++ b/oxlint-suppressions.json @@ -1468,11 +1468,6 @@ "count": 2 } }, - "src/view/shell/Drawer.tsx": { - "typescript/no-floating-promises": { - "count": 2 - } - }, "src/view/shell/createNativeStackNavigatorWithAuth.tsx": { "typescript/no-explicit-any": { "count": 1 diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 5e4e8b2f7..cb4c4974f 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -72,6 +72,7 @@ import {SupportScreen} from '#/view/screens/Support' import {TermsOfServiceScreen} from '#/view/screens/TermsOfService' import {BottomBar} from '#/view/shell/bottom-bar/BottomBar' import {createNativeStackNavigatorWithAuth} from '#/view/shell/createNativeStackNavigatorWithAuth' +import {AtmosphereScreen} from '#/screens/Atmosphere' import {BookmarksScreen} from '#/screens/Bookmarks' import {CustomFeedScreen} from '#/screens/CustomFeed' import {CustomFeedLikedByScreen} from '#/screens/CustomFeed/CustomFeedLikedBy' @@ -172,6 +173,11 @@ function commonScreens(Stack: typeof Flat, unreadCountLabel?: string) { getComponent={() => NotFoundScreen} options={{title: title(msg`Not Found`)}} /> + AtmosphereScreen} + options={{title: title(msg`Atmosphere`)}} + /> + Beta + + ) +} diff --git a/src/lib/hooks/useNavigationTabState.ts b/src/lib/hooks/useNavigationTabState.ts index 7fd76cb1b..2abfc1316 100644 --- a/src/lib/hooks/useNavigationTabState.ts +++ b/src/lib/hooks/useNavigationTabState.ts @@ -1,12 +1,14 @@ import {useNavigationState} from '@react-navigation/native' -import {getTabState, TabState} from '#/lib/routes/helpers' +import {getCurrentRoute, getTabState, TabState} from '#/lib/routes/helpers' export function useNavigationTabState() { return useNavigationState(state => { + const isAtAtmosphere = getCurrentRoute(state).name === 'Atmosphere' const res = { isAtHome: getTabState(state, 'Home') !== TabState.Outside, isAtSearch: getTabState(state, 'Search') !== TabState.Outside, + isAtAtmosphere, // FeedsTab no longer exists, but this check works for `Feeds` screen as well isAtFeeds: getTabState(state, 'Feeds') !== TabState.Outside, isAtBookmarks: getTabState(state, 'Bookmarks') !== TabState.Outside, @@ -19,6 +21,7 @@ export function useNavigationTabState() { if ( !res.isAtHome && !res.isAtSearch && + !res.isAtAtmosphere && !res.isAtFeeds && !res.isAtNotifications && !res.isAtMyProfile && diff --git a/src/lib/hooks/useNavigationTabState.web.ts b/src/lib/hooks/useNavigationTabState.web.ts index 6af96fed5..fc8cf3351 100644 --- a/src/lib/hooks/useNavigationTabState.web.ts +++ b/src/lib/hooks/useNavigationTabState.web.ts @@ -8,6 +8,7 @@ export function useNavigationTabState() { return { isAtHome: currentRoute === 'Home', isAtSearch: currentRoute === 'Search', + isAtAtmosphere: currentRoute === 'Atmosphere', isAtFeeds: currentRoute === 'Feeds', isAtBookmarks: currentRoute === 'Bookmarks', isAtNotifications: currentRoute === 'Notifications', diff --git a/src/lib/routes/types.ts b/src/lib/routes/types.ts index 5adfd485b..87fb24904 100644 --- a/src/lib/routes/types.ts +++ b/src/lib/routes/types.ts @@ -138,6 +138,7 @@ export type MessagesTabNavigatorParams = CommonNavigatorParams & { } export type FlatNavigatorParams = CommonNavigatorParams & { + Atmosphere: undefined Home: undefined Search: SearchParams Feeds: undefined @@ -150,6 +151,7 @@ export type FlatNavigatorParams = CommonNavigatorParams & { } export type AllNavigatorParams = CommonNavigatorParams & { + Atmosphere: undefined HomeTab: undefined Home: undefined SearchTab: undefined diff --git a/src/routes.ts b/src/routes.ts index 03840f4f8..44866e866 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -9,6 +9,7 @@ type AllNavigatableRoutes = Omit< export const router = new Router({ Home: ['/', '/download'], Search: '/search', + Atmosphere: '/atmosphere', Feeds: '/feeds', Notifications: '/notifications', NotificationsActivityList: '/notifications/activity', diff --git a/src/screens/Atmosphere.tsx b/src/screens/Atmosphere.tsx new file mode 100644 index 000000000..5da0d5756 --- /dev/null +++ b/src/screens/Atmosphere.tsx @@ -0,0 +1,66 @@ +import {View} from 'react-native' +import {Trans, useLingui} from '@lingui/react/macro' + +import {Pager} from '#/view/com/pager/Pager' +import {TabBar} from '#/view/com/pager/TabBar' +import {NotFoundScreen} from '#/view/screens/NotFound' +import {atoms as a, useTheme, web} from '#/alf' +import {BetaTag} from '#/components/BetaTag' +import {Earth_Stroke2_Corner0_Rounded as EarthIcon} from '#/components/icons/Earth' +import * as Layout from '#/components/Layout' +import {Text} from '#/components/Typography' +import {useAnalytics} from '#/analytics' + +export function AtmosphereScreen() { + const {t: l} = useLingui() + const ax = useAnalytics() + const isEnabled = ax.features.enabled(ax.features.AtmosphereExploreEnable) + + if (!isEnabled) { + return + } + + return ( + + + + + + + + Atmosphere + + + + + + + + ( + + + + )}> + + + + + ) +} + +function AtmosphereWelcome() { + const t = useTheme() + + return ( + + + + + Welcome! + + + + ) +} diff --git a/src/view/shell/Drawer.tsx b/src/view/shell/Drawer.tsx index 47a84b78a..5c18ef673 100644 --- a/src/view/shell/Drawer.tsx +++ b/src/view/shell/Drawer.tsx @@ -7,9 +7,8 @@ import { View, } from 'react-native' import {useSafeAreaInsets} from 'react-native-safe-area-context' -import {msg, plural} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Plural, Trans} from '@lingui/react/macro' +import {plural} from '@lingui/core/macro' +import {Plural, Trans, useLingui} from '@lingui/react/macro' import {StackActions, useNavigation} from '@react-navigation/native' import {FEEDBACK_FORM_URL, HELP_DESK_URL} from '#/lib/constants' @@ -19,7 +18,6 @@ import {getTabState, TabState} from '#/lib/routes/helpers' import {type SharedNavTab, TAB_TO_NAV_ITEM} from '#/lib/routes/tab-to-nav-item' import {type NavigationProp} from '#/lib/routes/types' import {sanitizeHandle} from '#/lib/strings/handles' -import {colors} from '#/lib/styles' import {emitSoftReset} from '#/state/events' import {useUnreadNotifications} from '#/state/queries/notifications/unread' import {useProfileQuery} from '#/state/queries/profile' @@ -30,39 +28,41 @@ import {UserAvatar} from '#/view/com/util/UserAvatar' import {useLogoVariant} from '#/view/icons/useLogoVariant' import {NavSignupCard} from '#/view/shell/NavSignupCard' import {atoms as a, tokens, useTheme, web} from '#/alf' +import {BetaTag} from '#/components/BetaTag' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import {useDialogControl} from '#/components/Dialog' import {Divider} from '#/components/Divider' -import {ArrowShareRight_Stroke2_Corner2_Rounded as ArrowShareRight} from '#/components/icons/ArrowShareRight' +import {ArrowShareRight_Stroke2_Corner2_Rounded as ArrowShareRightIcon} from '#/components/icons/Arrow' import { - Bell_Filled_Corner0_Rounded as BellFilled, - Bell_Stroke2_Corner0_Rounded as Bell, + Bell_Filled_Corner0_Rounded as BellFilledIcon, + Bell_Stroke2_Corner0_Rounded as BellIcon, } from '#/components/icons/Bell' import { - Bookmark_Filled_Corner0_Rounded as BookmarkFilled, - Bookmark_Stroke2_Corner0_Rounded as Bookmark, + Bookmark_Filled_Corner0_Rounded as BookmarkFilledIcon, + Bookmark_Stroke2_Corner0_Rounded as BookmarkIcon, } from '#/components/icons/Bookmark' -import {BulletList_Stroke2_Corner0_Rounded as List} from '#/components/icons/BulletList' +import {BulletList_Stroke2_Corner0_Rounded as ListIcon} from '#/components/icons/BulletList' +import {Earth_Stroke2_Corner0_Rounded as EarthIcon} from '#/components/icons/Earth' import { - Hashtag_Filled_Corner0_Rounded as HashtagFilled, - Hashtag_Stroke2_Corner0_Rounded as Hashtag, + Hashtag_Filled_Corner0_Rounded as HashtagFilledIcon, + Hashtag_Stroke2_Corner0_Rounded as HashtagIcon, } from '#/components/icons/Hashtag' import { - HomeOpen_Filled_Corner0_Rounded as HomeFilled, - HomeOpen_Stoke2_Corner0_Rounded as Home, -} from '#/components/icons/HomeOpen' + HomeOpen_Filled_Corner0_Rounded as HomeFilledIcon, + HomeOpen_Stroke2_Corner0_Rounded as HomeIcon, +} from '#/components/icons/Home' import { - MagnifyingGlass_Filled_Stroke2_Corner0_Rounded as MagnifyingGlassFilled, - MagnifyingGlass_Stroke2_Corner0_Rounded as MagnifyingGlass, + MagnifyingGlass_Filled_Stroke2_Corner0_Rounded as MagnifyingGlassFilledIcon, + MagnifyingGlass_Stroke2_Corner0_Rounded as MagnifyingGlassIcon, } from '#/components/icons/MagnifyingGlass' import { - Message_Stroke2_Corner0_Rounded as Message, - Message_Stroke2_Corner0_Rounded_Filled as MessageFilled, + Message_Stroke2_Corner0_Rounded as MessageIcon, + Message_Stroke2_Corner0_Rounded_Filled as MessageFilledIcon, } from '#/components/icons/Message' -import {SettingsGear2_Stroke2_Corner0_Rounded as Settings} from '#/components/icons/SettingsGear2' +import {SettingsGear2_Stroke2_Corner0_Rounded as SettingsIcon} from '#/components/icons/Settings' import { - UserCircle_Filled_Corner0_Rounded as UserCircleFilled, - UserCircle_Stroke2_Corner0_Rounded as UserCircle, + UserCircle_Filled_Corner0_Rounded as UserCircleFilledIcon, + UserCircle_Stroke2_Corner0_Rounded as UserCircleIcon, } from '#/components/icons/UserCircle' import {InlineLinkText} from '#/components/Link' import {OTAChannelNotice} from '#/components/OTAChannelNotice' @@ -84,7 +84,7 @@ let DrawerProfileCard = ({ onPressProfile: () => void onPressShare?: () => void }): React.ReactNode => { - const {_, i18n} = useLingui() + const {t: l, i18n} = useLingui() const t = useTheme() const {data: profile} = useProfileQuery({did: account.did}) const {isActive: live} = useActorStatus(profile) @@ -92,8 +92,8 @@ let DrawerProfileCard = ({ return ( [ @@ -140,7 +138,7 @@ let DrawerProfileCard = ({ opacity: pressed ? 0.7 : 1, }, ]}> - ): React.ReactNode => { const { isAtHome, isAtSearch, + isAtAtmosphere, isAtFeeds, isAtBookmarks, isAtNotifications, @@ -201,6 +200,9 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => { } = useNavigationTabState() const {hasSession, currentAccount} = useSession() const inviteFriendsControl = useDialogControl() + const isAtmosphereExploreEnabled = ax.features.enabled( + ax.features.AtmosphereExploreEnable, + ) // events // = @@ -278,6 +280,12 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => { setDrawerOpen(false) }, [navigation, setDrawerOpen, ax]) + const onPressAtmosphere = useCallback(() => { + ax.metric('nav:click', {item: 'atmosphere', surface: 'drawer'}) + navigation.navigate('Atmosphere') + setDrawerOpen(false) + }, [navigation, setDrawerOpen, ax]) + const onPressLists = useCallback(() => { ax.metric('nav:click', {item: 'lists', surface: 'drawer'}) navigation.navigate('Lists') @@ -297,7 +305,7 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => { }, [navigation, setDrawerOpen, ax]) const onPressFeedback = useCallback(() => { - Linking.openURL( + void Linking.openURL( FEEDBACK_FORM_URL({ email: currentAccount?.email, handle: currentAccount?.handle, @@ -306,7 +314,7 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => { }, [currentAccount]) const onPressHelp = useCallback(() => { - Linking.openURL(HELP_DESK_URL) + void Linking.openURL(HELP_DESK_URL) }, []) // rendering @@ -361,6 +369,12 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => { isActive={isAtNotifications} onPress={onPressNotifications} /> + {isAtmosphereExploreEnabled && ( + + )} void onPressHelp: () => void }): React.ReactNode => { - const {_} = useLingui() + const {t: l} = useLingui() const insets = useSafeAreaInsets() return ( @@ -751,7 +789,7 @@ function MenuItem({icon, label, count, bold, onPress}: MenuItemProps) { } function ExtraLinks() { - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const logoVariant = useLogoVariant() @@ -759,14 +797,14 @@ function ExtraLinks() { Terms of Service + label={l`Privacy Policy`}> Privacy Policy {logoVariant === 'kawaii' && ( diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index 864859126..fa20fa931 100644 --- a/src/view/shell/desktop/LeftNav.tsx +++ b/src/view/shell/desktop/LeftNav.tsx @@ -36,9 +36,10 @@ import { useTheme, web, } from '#/alf' +import {BetaTag} from '#/components/BetaTag' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import {type DialogControlProps} from '#/components/Dialog' -import {ArrowBoxLeft_Stroke2_Corner0_Rounded as LeaveIcon} from '#/components/icons/ArrowBoxLeft' +import {ArrowBoxLeft_Stroke2_Corner0_Rounded as LeaveIcon} from '#/components/icons/Arrow' import { Bell_Filled_Corner0_Rounded as BellFilledIcon, Bell_Stroke2_Corner0_Rounded as BellIcon, @@ -53,6 +54,7 @@ import { } from '#/components/icons/BulletList' import {type Props as SVGIconProps} from '#/components/icons/common' import {DotGrid3x1_Stroke2_Corner0_Rounded as EllipsisIcon} from '#/components/icons/DotGrid' +import {Earth_Stroke2_Corner0_Rounded as EarthIcon} from '#/components/icons/Earth' import {EditBig_Stroke2_Corner2_Rounded as EditBigIcon} from '#/components/icons/EditBig' import { Hashtag_Filled_Corner0_Rounded as HashtagFilledIcon, @@ -60,8 +62,8 @@ import { } from '#/components/icons/Hashtag' import { HomeOpen_Filled_Corner0_Rounded as HomeFilledIcon, - HomeOpen_Stoke2_Corner0_Rounded as HomeIcon, -} from '#/components/icons/HomeOpen' + HomeOpen_Stroke2_Corner0_Rounded as HomeIcon, +} from '#/components/icons/Home' import { MagnifyingGlass_Filled_Stroke2_Corner0_Rounded as MagnifyingGlassFilledIcon, MagnifyingGlass_Stroke2_Corner0_Rounded as MagnifyingGlassIcon, @@ -74,7 +76,7 @@ import {PlusLarge_Stroke2_Corner0_Rounded as PlusIcon} from '#/components/icons/ import { SettingsGear2_Filled_Corner0_Rounded as SettingsFilledIcon, SettingsGear2_Stroke2_Corner0_Rounded as SettingsIcon, -} from '#/components/icons/SettingsGear2' +} from '#/components/icons/Settings' import { UserCircle_Filled_Corner0_Rounded as UserCircleFilledIcon, UserCircle_Stroke2_Corner0_Rounded as UserCircleIcon, @@ -385,6 +387,7 @@ function SwitchMenuItem({ } interface NavItemProps { + beta?: boolean count?: string hasNew?: boolean href: string @@ -397,6 +400,7 @@ interface NavItemProps { navItem: Events['nav:click']['item'] } function NavItem({ + beta, count, hasNew, href, @@ -407,6 +411,7 @@ function NavItem({ }: NavItemProps) { const t = useTheme() const {t: l} = useLingui() + const accessibilityLabel = beta ? l`${label}, Beta` : label const ax = useAnalytics() const {currentAccount} = useSession() @@ -462,7 +467,7 @@ function NavItem({ href={href} dataSet={{noUnderline: 1}} role="link" - accessibilityLabel={label} + accessibilityLabel={accessibilityLabel} accessibilityHint=""> {!minimal && ( - - {label} - + + + {label} + + {beta && } + )} ) @@ -620,6 +628,9 @@ export function DesktopLeftNav({routeName}: {routeName: string}) { const numUnreadNotifications = useUnreadNotifications() const numUnreadMessages = useUnreadMessageCount() const hasHomeBadge = useHomeBadge() + const isAtmosphereExploreEnabled = ax.features.enabled( + ax.features.AtmosphereExploreEnable, + ) const leftNavMinimal = isMessagesRelatedScreen || leftNavMinimalBreakpoint @@ -698,6 +709,19 @@ export function DesktopLeftNav({routeName}: {routeName: string}) { active: BellFilledIcon, }} /> + {isAtmosphereExploreEnabled && ( + + )}