[PWI] Shell (#1967)
* Sidebars * Bottom bar * Drawer * Translate * Spacing fix * Fix responsive regression * Fix nitzio/stable
parent
4c4ba553bd
commit
47d2d3cbf2
|
@ -43,7 +43,13 @@ interface PreviewableUserAvatarProps extends BaseUserAvatarProps {
|
||||||
|
|
||||||
const BLUR_AMOUNT = isWeb ? 5 : 100
|
const BLUR_AMOUNT = isWeb ? 5 : 100
|
||||||
|
|
||||||
function DefaultAvatar({type, size}: {type: UserAvatarType; size: number}) {
|
export function DefaultAvatar({
|
||||||
|
type,
|
||||||
|
size,
|
||||||
|
}: {
|
||||||
|
type: UserAvatarType
|
||||||
|
size: number
|
||||||
|
}) {
|
||||||
if (type === 'algo') {
|
if (type === 'algo') {
|
||||||
// Font Awesome Pro 6.4.0 by @fontawesome -https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc.
|
// Font Awesome Pro 6.4.0 by @fontawesome -https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc.
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -52,6 +52,7 @@ import {useUnreadNotifications} from '#/state/queries/notifications/unread'
|
||||||
import {emitSoftReset} from '#/state/events'
|
import {emitSoftReset} from '#/state/events'
|
||||||
import {useInviteCodesQuery} from '#/state/queries/invites'
|
import {useInviteCodesQuery} from '#/state/queries/invites'
|
||||||
import {RQKEY as NOTIFS_RQKEY} from '#/state/queries/notifications/feed'
|
import {RQKEY as NOTIFS_RQKEY} from '#/state/queries/notifications/feed'
|
||||||
|
import {NavSignupCard} from '#/view/shell/NavSignupCard'
|
||||||
|
|
||||||
export function DrawerProfileCard({
|
export function DrawerProfileCard({
|
||||||
account,
|
account,
|
||||||
|
@ -112,7 +113,7 @@ export function DrawerContent() {
|
||||||
const {track} = useAnalytics()
|
const {track} = useAnalytics()
|
||||||
const {isAtHome, isAtSearch, isAtFeeds, isAtNotifications, isAtMyProfile} =
|
const {isAtHome, isAtSearch, isAtFeeds, isAtNotifications, isAtMyProfile} =
|
||||||
useNavigationTabState()
|
useNavigationTabState()
|
||||||
const {currentAccount} = useSession()
|
const {hasSession, currentAccount} = useSession()
|
||||||
const numUnreadNotifications = useUnreadNotifications()
|
const numUnreadNotifications = useUnreadNotifications()
|
||||||
|
|
||||||
// events
|
// events
|
||||||
|
@ -218,18 +219,20 @@ export function DrawerContent() {
|
||||||
]}>
|
]}>
|
||||||
<SafeAreaView style={s.flex1}>
|
<SafeAreaView style={s.flex1}>
|
||||||
<ScrollView style={styles.main}>
|
<ScrollView style={styles.main}>
|
||||||
<View style={{}}>
|
{hasSession && currentAccount ? (
|
||||||
{currentAccount && (
|
<View style={{}}>
|
||||||
<DrawerProfileCard
|
<DrawerProfileCard
|
||||||
account={currentAccount}
|
account={currentAccount}
|
||||||
onPressProfile={onPressProfile}
|
onPressProfile={onPressProfile}
|
||||||
/>
|
/>
|
||||||
)}
|
</View>
|
||||||
</View>
|
) : (
|
||||||
|
<NavSignupCard />
|
||||||
|
)}
|
||||||
|
|
||||||
<InviteCodes style={{paddingLeft: 0}} />
|
{hasSession && <InviteCodes style={{paddingLeft: 0}} />}
|
||||||
|
|
||||||
<View style={{height: 10}} />
|
{hasSession && <View style={{height: 10}} />}
|
||||||
|
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={
|
icon={
|
||||||
|
@ -275,33 +278,37 @@ export function DrawerContent() {
|
||||||
bold={isAtHome}
|
bold={isAtHome}
|
||||||
onPress={onPressHome}
|
onPress={onPressHome}
|
||||||
/>
|
/>
|
||||||
<MenuItem
|
|
||||||
icon={
|
{hasSession && (
|
||||||
isAtNotifications ? (
|
<MenuItem
|
||||||
<BellIconSolid
|
icon={
|
||||||
style={pal.text as StyleProp<ViewStyle>}
|
isAtNotifications ? (
|
||||||
size="24"
|
<BellIconSolid
|
||||||
strokeWidth={1.7}
|
style={pal.text as StyleProp<ViewStyle>}
|
||||||
/>
|
size="24"
|
||||||
) : (
|
strokeWidth={1.7}
|
||||||
<BellIcon
|
/>
|
||||||
style={pal.text as StyleProp<ViewStyle>}
|
) : (
|
||||||
size="24"
|
<BellIcon
|
||||||
strokeWidth={1.7}
|
style={pal.text as StyleProp<ViewStyle>}
|
||||||
/>
|
size="24"
|
||||||
)
|
strokeWidth={1.7}
|
||||||
}
|
/>
|
||||||
label={_(msg`Notifications`)}
|
)
|
||||||
accessibilityLabel={_(msg`Notifications`)}
|
}
|
||||||
accessibilityHint={
|
label={_(msg`Notifications`)}
|
||||||
numUnreadNotifications === ''
|
accessibilityLabel={_(msg`Notifications`)}
|
||||||
? ''
|
accessibilityHint={
|
||||||
: `${numUnreadNotifications} unread`
|
numUnreadNotifications === ''
|
||||||
}
|
? ''
|
||||||
count={numUnreadNotifications}
|
: `${numUnreadNotifications} unread`
|
||||||
bold={isAtNotifications}
|
}
|
||||||
onPress={onPressNotifications}
|
count={numUnreadNotifications}
|
||||||
/>
|
bold={isAtNotifications}
|
||||||
|
onPress={onPressNotifications}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={
|
icon={
|
||||||
isAtFeeds ? (
|
isAtFeeds ? (
|
||||||
|
@ -324,58 +331,64 @@ export function DrawerContent() {
|
||||||
bold={isAtFeeds}
|
bold={isAtFeeds}
|
||||||
onPress={onPressMyFeeds}
|
onPress={onPressMyFeeds}
|
||||||
/>
|
/>
|
||||||
<MenuItem
|
|
||||||
icon={<ListIcon strokeWidth={2} style={pal.text} size={26} />}
|
{hasSession && (
|
||||||
label={_(msg`Lists`)}
|
<>
|
||||||
accessibilityLabel={_(msg`Lists`)}
|
<MenuItem
|
||||||
accessibilityHint=""
|
icon={<ListIcon strokeWidth={2} style={pal.text} size={26} />}
|
||||||
onPress={onPressLists}
|
label={_(msg`Lists`)}
|
||||||
/>
|
accessibilityLabel={_(msg`Lists`)}
|
||||||
<MenuItem
|
accessibilityHint=""
|
||||||
icon={<HandIcon strokeWidth={5} style={pal.text} size={24} />}
|
onPress={onPressLists}
|
||||||
label={_(msg`Moderation`)}
|
|
||||||
accessibilityLabel={_(msg`Moderation`)}
|
|
||||||
accessibilityHint=""
|
|
||||||
onPress={onPressModeration}
|
|
||||||
/>
|
|
||||||
<MenuItem
|
|
||||||
icon={
|
|
||||||
isAtMyProfile ? (
|
|
||||||
<UserIconSolid
|
|
||||||
style={pal.text as StyleProp<ViewStyle>}
|
|
||||||
size="26"
|
|
||||||
strokeWidth={1.5}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<UserIcon
|
|
||||||
style={pal.text as StyleProp<ViewStyle>}
|
|
||||||
size="26"
|
|
||||||
strokeWidth={1.5}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
label={_(msg`Profile`)}
|
|
||||||
accessibilityLabel={_(msg`Profile`)}
|
|
||||||
accessibilityHint=""
|
|
||||||
onPress={onPressProfile}
|
|
||||||
/>
|
|
||||||
<MenuItem
|
|
||||||
icon={
|
|
||||||
<CogIcon
|
|
||||||
style={pal.text as StyleProp<ViewStyle>}
|
|
||||||
size="26"
|
|
||||||
strokeWidth={1.75}
|
|
||||||
/>
|
/>
|
||||||
}
|
<MenuItem
|
||||||
label={_(msg`Settings`)}
|
icon={<HandIcon strokeWidth={5} style={pal.text} size={24} />}
|
||||||
accessibilityLabel={_(msg`Settings`)}
|
label={_(msg`Moderation`)}
|
||||||
accessibilityHint=""
|
accessibilityLabel={_(msg`Moderation`)}
|
||||||
onPress={onPressSettings}
|
accessibilityHint=""
|
||||||
/>
|
onPress={onPressModeration}
|
||||||
|
/>
|
||||||
|
<MenuItem
|
||||||
|
icon={
|
||||||
|
isAtMyProfile ? (
|
||||||
|
<UserIconSolid
|
||||||
|
style={pal.text as StyleProp<ViewStyle>}
|
||||||
|
size="26"
|
||||||
|
strokeWidth={1.5}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<UserIcon
|
||||||
|
style={pal.text as StyleProp<ViewStyle>}
|
||||||
|
size="26"
|
||||||
|
strokeWidth={1.5}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
label={_(msg`Profile`)}
|
||||||
|
accessibilityLabel={_(msg`Profile`)}
|
||||||
|
accessibilityHint=""
|
||||||
|
onPress={onPressProfile}
|
||||||
|
/>
|
||||||
|
<MenuItem
|
||||||
|
icon={
|
||||||
|
<CogIcon
|
||||||
|
style={pal.text as StyleProp<ViewStyle>}
|
||||||
|
size="26"
|
||||||
|
strokeWidth={1.75}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={_(msg`Settings`)}
|
||||||
|
accessibilityLabel={_(msg`Settings`)}
|
||||||
|
accessibilityHint=""
|
||||||
|
onPress={onPressSettings}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<View style={styles.smallSpacer} />
|
<View style={styles.smallSpacer} />
|
||||||
<View style={styles.smallSpacer} />
|
<View style={styles.smallSpacer} />
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<View style={styles.footer}>
|
<View style={styles.footer}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
accessibilityRole="link"
|
accessibilityRole="link"
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
import React from 'react'
|
||||||
|
import {View} from 'react-native'
|
||||||
|
import {msg, Trans} from '@lingui/macro'
|
||||||
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
|
import {s} from 'lib/styles'
|
||||||
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
|
import {DefaultAvatar} from '#/view/com/util/UserAvatar'
|
||||||
|
import {Text} from '#/view/com/util/text/Text'
|
||||||
|
import {Button} from '#/view/com/util/forms/Button'
|
||||||
|
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||||
|
import {useCloseAllActiveElements} from '#/state/util'
|
||||||
|
|
||||||
|
export function NavSignupCard() {
|
||||||
|
const {_} = useLingui()
|
||||||
|
const pal = usePalette('default')
|
||||||
|
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||||
|
const closeAllActiveElements = useCloseAllActiveElements()
|
||||||
|
|
||||||
|
const showLoggedOut = React.useCallback(() => {
|
||||||
|
closeAllActiveElements()
|
||||||
|
setShowLoggedOut(true)
|
||||||
|
}, [setShowLoggedOut, closeAllActiveElements])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
paddingTop: 6,
|
||||||
|
marginBottom: 24,
|
||||||
|
}}>
|
||||||
|
<DefaultAvatar type="user" size={48} />
|
||||||
|
|
||||||
|
<View style={{paddingTop: 12}}>
|
||||||
|
<Text type="md" style={[pal.text, s.bold]}>
|
||||||
|
<Trans>Sign up or sign in to join the conversation</Trans>
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={{flexDirection: 'row', paddingTop: 12, gap: 8}}>
|
||||||
|
<Button
|
||||||
|
onPress={showLoggedOut}
|
||||||
|
accessibilityHint={_(msg`Sign up`)}
|
||||||
|
accessibilityLabel={_(msg`Sign up`)}>
|
||||||
|
<Text type="md" style={[{color: 'white'}, s.bold]}>
|
||||||
|
<Trans>Sign up</Trans>
|
||||||
|
</Text>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
onPress={showLoggedOut}
|
||||||
|
accessibilityHint={_(msg`Sign in`)}
|
||||||
|
accessibilityLabel={_(msg`Sign in`)}>
|
||||||
|
<Text type="md" style={[pal.text, s.bold]}>
|
||||||
|
Sign in
|
||||||
|
</Text>
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
|
@ -37,7 +37,7 @@ type TabOptions = 'Home' | 'Search' | 'Notifications' | 'MyProfile' | 'Feeds'
|
||||||
|
|
||||||
export function BottomBar({navigation}: BottomTabBarProps) {
|
export function BottomBar({navigation}: BottomTabBarProps) {
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
const {currentAccount} = useSession()
|
const {hasSession, currentAccount} = useSession()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
|
@ -169,72 +169,77 @@ export function BottomBar({navigation}: BottomTabBarProps) {
|
||||||
accessibilityLabel={_(msg`Feeds`)}
|
accessibilityLabel={_(msg`Feeds`)}
|
||||||
accessibilityHint=""
|
accessibilityHint=""
|
||||||
/>
|
/>
|
||||||
<Btn
|
|
||||||
testID="bottomBarNotificationsBtn"
|
{hasSession && (
|
||||||
icon={
|
<>
|
||||||
isAtNotifications ? (
|
<Btn
|
||||||
<BellIconSolid
|
testID="bottomBarNotificationsBtn"
|
||||||
size={24}
|
icon={
|
||||||
strokeWidth={1.9}
|
isAtNotifications ? (
|
||||||
style={[styles.ctrlIcon, pal.text, styles.bellIcon]}
|
<BellIconSolid
|
||||||
/>
|
size={24}
|
||||||
) : (
|
strokeWidth={1.9}
|
||||||
<BellIcon
|
style={[styles.ctrlIcon, pal.text, styles.bellIcon]}
|
||||||
size={24}
|
|
||||||
strokeWidth={1.9}
|
|
||||||
style={[styles.ctrlIcon, pal.text, styles.bellIcon]}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
onPress={onPressNotifications}
|
|
||||||
notificationCount={numUnreadNotifications}
|
|
||||||
accessible={true}
|
|
||||||
accessibilityRole="tab"
|
|
||||||
accessibilityLabel={_(msg`Notifications`)}
|
|
||||||
accessibilityHint={
|
|
||||||
numUnreadNotifications === ''
|
|
||||||
? ''
|
|
||||||
: `${numUnreadNotifications} unread`
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Btn
|
|
||||||
testID="bottomBarProfileBtn"
|
|
||||||
icon={
|
|
||||||
<View style={styles.ctrlIconSizingWrapper}>
|
|
||||||
{isAtMyProfile ? (
|
|
||||||
<View
|
|
||||||
style={[
|
|
||||||
styles.ctrlIcon,
|
|
||||||
pal.text,
|
|
||||||
styles.profileIcon,
|
|
||||||
styles.onProfile,
|
|
||||||
{borderColor: pal.text.color},
|
|
||||||
]}>
|
|
||||||
<UserAvatar
|
|
||||||
avatar={profile?.avatar}
|
|
||||||
size={27}
|
|
||||||
// See https://github.com/bluesky-social/social-app/pull/1801:
|
|
||||||
usePlainRNImage={true}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
) : (
|
||||||
) : (
|
<BellIcon
|
||||||
<View style={[styles.ctrlIcon, pal.text, styles.profileIcon]}>
|
size={24}
|
||||||
<UserAvatar
|
strokeWidth={1.9}
|
||||||
avatar={profile?.avatar}
|
style={[styles.ctrlIcon, pal.text, styles.bellIcon]}
|
||||||
size={28}
|
|
||||||
// See https://github.com/bluesky-social/social-app/pull/1801:
|
|
||||||
usePlainRNImage={true}
|
|
||||||
/>
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onPress={onPressNotifications}
|
||||||
|
notificationCount={numUnreadNotifications}
|
||||||
|
accessible={true}
|
||||||
|
accessibilityRole="tab"
|
||||||
|
accessibilityLabel={_(msg`Notifications`)}
|
||||||
|
accessibilityHint={
|
||||||
|
numUnreadNotifications === ''
|
||||||
|
? ''
|
||||||
|
: `${numUnreadNotifications} unread`
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Btn
|
||||||
|
testID="bottomBarProfileBtn"
|
||||||
|
icon={
|
||||||
|
<View style={styles.ctrlIconSizingWrapper}>
|
||||||
|
{isAtMyProfile ? (
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
styles.ctrlIcon,
|
||||||
|
pal.text,
|
||||||
|
styles.profileIcon,
|
||||||
|
styles.onProfile,
|
||||||
|
{borderColor: pal.text.color},
|
||||||
|
]}>
|
||||||
|
<UserAvatar
|
||||||
|
avatar={profile?.avatar}
|
||||||
|
size={27}
|
||||||
|
// See https://github.com/bluesky-social/social-app/pull/1801:
|
||||||
|
usePlainRNImage={true}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
) : (
|
||||||
|
<View style={[styles.ctrlIcon, pal.text, styles.profileIcon]}>
|
||||||
|
<UserAvatar
|
||||||
|
avatar={profile?.avatar}
|
||||||
|
size={28}
|
||||||
|
// See https://github.com/bluesky-social/social-app/pull/1801:
|
||||||
|
usePlainRNImage={true}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
)}
|
}
|
||||||
</View>
|
onPress={onPressProfile}
|
||||||
}
|
onLongPress={onLongPressProfile}
|
||||||
onPress={onPressProfile}
|
accessibilityRole="tab"
|
||||||
onLongPress={onLongPressProfile}
|
accessibilityLabel={_(msg`Profile`)}
|
||||||
accessibilityRole="tab"
|
accessibilityHint=""
|
||||||
accessibilityLabel={_(msg`Profile`)}
|
/>
|
||||||
accessibilityHint=""
|
</>
|
||||||
/>
|
)}
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import {CommonNavigatorParams} from 'lib/routes/types'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
|
|
||||||
export function BottomBarWeb() {
|
export function BottomBarWeb() {
|
||||||
const {currentAccount} = useSession()
|
const {hasSession, currentAccount} = useSession()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const safeAreaInsets = useSafeAreaInsets()
|
const safeAreaInsets = useSafeAreaInsets()
|
||||||
const {footerMinimalShellTransform} = useMinimalShellMode()
|
const {footerMinimalShellTransform} = useMinimalShellMode()
|
||||||
|
@ -75,39 +75,44 @@ export function BottomBarWeb() {
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
</NavItem>
|
</NavItem>
|
||||||
<NavItem routeName="Notifications" href="/notifications">
|
|
||||||
{({isActive}) => {
|
{hasSession && (
|
||||||
const Icon = isActive ? BellIconSolid : BellIcon
|
<>
|
||||||
return (
|
<NavItem routeName="Notifications" href="/notifications">
|
||||||
<Icon
|
{({isActive}) => {
|
||||||
size={24}
|
const Icon = isActive ? BellIconSolid : BellIcon
|
||||||
strokeWidth={1.9}
|
return (
|
||||||
style={[styles.ctrlIcon, pal.text, styles.bellIcon]}
|
<Icon
|
||||||
/>
|
size={24}
|
||||||
)
|
strokeWidth={1.9}
|
||||||
}}
|
style={[styles.ctrlIcon, pal.text, styles.bellIcon]}
|
||||||
</NavItem>
|
/>
|
||||||
<NavItem
|
)
|
||||||
routeName="Profile"
|
}}
|
||||||
href={
|
</NavItem>
|
||||||
currentAccount
|
<NavItem
|
||||||
? makeProfileLink({
|
routeName="Profile"
|
||||||
did: currentAccount.did,
|
href={
|
||||||
handle: currentAccount.handle,
|
currentAccount
|
||||||
})
|
? makeProfileLink({
|
||||||
: '/'
|
did: currentAccount.did,
|
||||||
}>
|
handle: currentAccount.handle,
|
||||||
{({isActive}) => {
|
})
|
||||||
const Icon = isActive ? UserIconSolid : UserIcon
|
: '/'
|
||||||
return (
|
}>
|
||||||
<Icon
|
{({isActive}) => {
|
||||||
size={28}
|
const Icon = isActive ? UserIconSolid : UserIcon
|
||||||
strokeWidth={1.5}
|
return (
|
||||||
style={[styles.ctrlIcon, pal.text, styles.profileIcon]}
|
<Icon
|
||||||
/>
|
size={28}
|
||||||
)
|
strokeWidth={1.5}
|
||||||
}}
|
style={[styles.ctrlIcon, pal.text, styles.profileIcon]}
|
||||||
</NavItem>
|
/>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</NavItem>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ import {useFetchHandle} from '#/state/queries/handle'
|
||||||
import {emitSoftReset} from '#/state/events'
|
import {emitSoftReset} from '#/state/events'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
import {RQKEY as NOTIFS_RQKEY} from '#/state/queries/notifications/feed'
|
import {RQKEY as NOTIFS_RQKEY} from '#/state/queries/notifications/feed'
|
||||||
|
import {NavSignupCard} from '#/view/shell/NavSignupCard'
|
||||||
|
|
||||||
function ProfileCard() {
|
function ProfileCard() {
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
|
@ -268,7 +269,7 @@ function ComposeBtn() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DesktopLeftNav() {
|
export function DesktopLeftNav() {
|
||||||
const {currentAccount} = useSession()
|
const {hasSession, currentAccount} = useSession()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {isDesktop, isTablet} = useWebMediaQueries()
|
const {isDesktop, isTablet} = useWebMediaQueries()
|
||||||
|
@ -282,8 +283,16 @@ export function DesktopLeftNav() {
|
||||||
pal.view,
|
pal.view,
|
||||||
pal.border,
|
pal.border,
|
||||||
]}>
|
]}>
|
||||||
<ProfileCard />
|
{hasSession ? (
|
||||||
|
<ProfileCard />
|
||||||
|
) : isDesktop ? (
|
||||||
|
<View style={{paddingHorizontal: 12}}>
|
||||||
|
<NavSignupCard />
|
||||||
|
</View>
|
||||||
|
) : null}
|
||||||
|
|
||||||
<BackBtn />
|
<BackBtn />
|
||||||
|
|
||||||
<NavItem
|
<NavItem
|
||||||
href="/"
|
href="/"
|
||||||
icon={<HomeIcon size={isDesktop ? 24 : 28} style={pal.text} />}
|
icon={<HomeIcon size={isDesktop ? 24 : 28} style={pal.text} />}
|
||||||
|
@ -332,98 +341,104 @@ export function DesktopLeftNav() {
|
||||||
}
|
}
|
||||||
label={_(msg`Feeds`)}
|
label={_(msg`Feeds`)}
|
||||||
/>
|
/>
|
||||||
<NavItem
|
|
||||||
href="/notifications"
|
{hasSession && (
|
||||||
count={numUnread}
|
<>
|
||||||
icon={
|
<NavItem
|
||||||
<BellIcon
|
href="/notifications"
|
||||||
strokeWidth={2}
|
count={numUnread}
|
||||||
size={isDesktop ? 24 : 26}
|
icon={
|
||||||
style={pal.text}
|
<BellIcon
|
||||||
|
strokeWidth={2}
|
||||||
|
size={isDesktop ? 24 : 26}
|
||||||
|
style={pal.text}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
iconFilled={
|
||||||
|
<BellIconSolid
|
||||||
|
strokeWidth={1.5}
|
||||||
|
size={isDesktop ? 24 : 26}
|
||||||
|
style={pal.text}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={_(msg`Notifications`)}
|
||||||
/>
|
/>
|
||||||
}
|
<NavItem
|
||||||
iconFilled={
|
href="/lists"
|
||||||
<BellIconSolid
|
icon={
|
||||||
strokeWidth={1.5}
|
<ListIcon
|
||||||
size={isDesktop ? 24 : 26}
|
style={pal.text}
|
||||||
style={pal.text}
|
size={isDesktop ? 26 : 30}
|
||||||
|
strokeWidth={2}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
iconFilled={
|
||||||
|
<ListIcon
|
||||||
|
style={pal.text}
|
||||||
|
size={isDesktop ? 26 : 30}
|
||||||
|
strokeWidth={3}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={_(msg`Lists`)}
|
||||||
/>
|
/>
|
||||||
}
|
<NavItem
|
||||||
label={_(msg`Notifications`)}
|
href="/moderation"
|
||||||
/>
|
icon={
|
||||||
<NavItem
|
<HandIcon
|
||||||
href="/lists"
|
style={pal.text}
|
||||||
icon={
|
size={isDesktop ? 24 : 27}
|
||||||
<ListIcon
|
strokeWidth={5.5}
|
||||||
style={pal.text}
|
/>
|
||||||
size={isDesktop ? 26 : 30}
|
}
|
||||||
strokeWidth={2}
|
iconFilled={
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon="hand"
|
||||||
|
style={pal.text as FontAwesomeIconStyle}
|
||||||
|
size={isDesktop ? 20 : 26}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={_(msg`Moderation`)}
|
||||||
/>
|
/>
|
||||||
}
|
<NavItem
|
||||||
iconFilled={
|
href={currentAccount ? makeProfileLink(currentAccount) : '/'}
|
||||||
<ListIcon
|
icon={
|
||||||
style={pal.text}
|
<UserIcon
|
||||||
size={isDesktop ? 26 : 30}
|
strokeWidth={1.75}
|
||||||
strokeWidth={3}
|
size={isDesktop ? 28 : 30}
|
||||||
|
style={pal.text}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
iconFilled={
|
||||||
|
<UserIconSolid
|
||||||
|
strokeWidth={1.75}
|
||||||
|
size={isDesktop ? 28 : 30}
|
||||||
|
style={pal.text}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label="Profile"
|
||||||
/>
|
/>
|
||||||
}
|
<NavItem
|
||||||
label={_(msg`Lists`)}
|
href="/settings"
|
||||||
/>
|
icon={
|
||||||
<NavItem
|
<CogIcon
|
||||||
href="/moderation"
|
strokeWidth={1.75}
|
||||||
icon={
|
size={isDesktop ? 28 : 32}
|
||||||
<HandIcon
|
style={pal.text}
|
||||||
style={pal.text}
|
/>
|
||||||
size={isDesktop ? 24 : 27}
|
}
|
||||||
strokeWidth={5.5}
|
iconFilled={
|
||||||
|
<CogIconSolid
|
||||||
|
strokeWidth={1.5}
|
||||||
|
size={isDesktop ? 28 : 32}
|
||||||
|
style={pal.text}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={_(msg`Settings`)}
|
||||||
/>
|
/>
|
||||||
}
|
|
||||||
iconFilled={
|
<ComposeBtn />
|
||||||
<FontAwesomeIcon
|
</>
|
||||||
icon="hand"
|
)}
|
||||||
style={pal.text as FontAwesomeIconStyle}
|
|
||||||
size={isDesktop ? 20 : 26}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label={_(msg`Moderation`)}
|
|
||||||
/>
|
|
||||||
<NavItem
|
|
||||||
href={currentAccount ? makeProfileLink(currentAccount) : '/'}
|
|
||||||
icon={
|
|
||||||
<UserIcon
|
|
||||||
strokeWidth={1.75}
|
|
||||||
size={isDesktop ? 28 : 30}
|
|
||||||
style={pal.text}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
iconFilled={
|
|
||||||
<UserIconSolid
|
|
||||||
strokeWidth={1.75}
|
|
||||||
size={isDesktop ? 28 : 30}
|
|
||||||
style={pal.text}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label="Profile"
|
|
||||||
/>
|
|
||||||
<NavItem
|
|
||||||
href="/settings"
|
|
||||||
icon={
|
|
||||||
<CogIcon
|
|
||||||
strokeWidth={1.75}
|
|
||||||
size={isDesktop ? 28 : 32}
|
|
||||||
style={pal.text}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
iconFilled={
|
|
||||||
<CogIconSolid
|
|
||||||
strokeWidth={1.5}
|
|
||||||
size={isDesktop ? 28 : 32}
|
|
||||||
style={pal.text}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label={_(msg`Settings`)}
|
|
||||||
/>
|
|
||||||
<ComposeBtn />
|
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,21 @@ export function DesktopRightNav() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.rightNav, pal.view]}>
|
<View style={[styles.rightNav, pal.view]}>
|
||||||
{hasSession && <DesktopSearch />}
|
<DesktopSearch />
|
||||||
{hasSession && <DesktopFeeds />}
|
|
||||||
<View style={styles.message}>
|
{hasSession && (
|
||||||
|
<View style={{paddingTop: 18, marginBottom: 18}}>
|
||||||
|
<DesktopFeeds />
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
styles.message,
|
||||||
|
{
|
||||||
|
paddingTop: hasSession ? 0 : 18,
|
||||||
|
},
|
||||||
|
]}>
|
||||||
{isSandbox ? (
|
{isSandbox ? (
|
||||||
<View style={[palError.view, styles.messageLine, s.p10]}>
|
<View style={[palError.view, styles.messageLine, s.p10]}>
|
||||||
<Text type="md" style={[palError.text, s.bold]}>
|
<Text type="md" style={[palError.text, s.bold]}>
|
||||||
|
@ -41,18 +53,22 @@ export function DesktopRightNav() {
|
||||||
</View>
|
</View>
|
||||||
) : undefined}
|
) : undefined}
|
||||||
<View style={[s.flexRow]}>
|
<View style={[s.flexRow]}>
|
||||||
<TextLink
|
{hasSession && (
|
||||||
type="md"
|
<>
|
||||||
style={pal.link}
|
<TextLink
|
||||||
href={FEEDBACK_FORM_URL({
|
type="md"
|
||||||
email: currentAccount!.email,
|
style={pal.link}
|
||||||
handle: currentAccount!.handle,
|
href={FEEDBACK_FORM_URL({
|
||||||
})}
|
email: currentAccount!.email,
|
||||||
text={_(msg`Feedback`)}
|
handle: currentAccount!.handle,
|
||||||
/>
|
})}
|
||||||
<Text type="md" style={pal.textLight}>
|
text={_(msg`Feedback`)}
|
||||||
·
|
/>
|
||||||
</Text>
|
<Text type="md" style={pal.textLight}>
|
||||||
|
·
|
||||||
|
</Text>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<TextLink
|
<TextLink
|
||||||
type="md"
|
type="md"
|
||||||
style={pal.link}
|
style={pal.link}
|
||||||
|
@ -79,7 +95,8 @@ export function DesktopRightNav() {
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<InviteCodes />
|
|
||||||
|
{hasSession && <InviteCodes />}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,6 @@ const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
width: 300,
|
width: 300,
|
||||||
paddingBottom: 18,
|
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
paddingHorizontal: 16,
|
paddingHorizontal: 16,
|
||||||
|
|
|
@ -21,8 +21,8 @@ import {
|
||||||
useSetDrawerOpen,
|
useSetDrawerOpen,
|
||||||
useOnboardingState,
|
useOnboardingState,
|
||||||
} from '#/state/shell'
|
} from '#/state/shell'
|
||||||
import {useSession} from '#/state/session'
|
|
||||||
import {useCloseAllActiveElements} from '#/state/util'
|
import {useCloseAllActiveElements} from '#/state/util'
|
||||||
|
import {useLoggedOutView} from '#/state/shell/logged-out'
|
||||||
|
|
||||||
function ShellInner() {
|
function ShellInner() {
|
||||||
const isDrawerOpen = useIsDrawerOpen()
|
const isDrawerOpen = useIsDrawerOpen()
|
||||||
|
@ -30,8 +30,8 @@ function ShellInner() {
|
||||||
const onboardingState = useOnboardingState()
|
const onboardingState = useOnboardingState()
|
||||||
const {isDesktop, isMobile} = useWebMediaQueries()
|
const {isDesktop, isMobile} = useWebMediaQueries()
|
||||||
const navigator = useNavigation<NavigationProp>()
|
const navigator = useNavigation<NavigationProp>()
|
||||||
const {hasSession} = useSession()
|
|
||||||
const closeAllActiveElements = useCloseAllActiveElements()
|
const closeAllActiveElements = useCloseAllActiveElements()
|
||||||
|
const {showLoggedOut} = useLoggedOutView()
|
||||||
|
|
||||||
useAuxClick()
|
useAuxClick()
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ function ShellInner() {
|
||||||
}, [navigator, closeAllActiveElements])
|
}, [navigator, closeAllActiveElements])
|
||||||
|
|
||||||
const showBottomBar = isMobile && !onboardingState.isActive
|
const showBottomBar = isMobile && !onboardingState.isActive
|
||||||
const showSideNavs = !isMobile && hasSession && !onboardingState.isActive
|
const showSideNavs = !isMobile && !onboardingState.isActive && !showLoggedOut
|
||||||
return (
|
return (
|
||||||
<View style={[s.hContentRegion, {overflow: 'hidden'}]}>
|
<View style={[s.hContentRegion, {overflow: 'hidden'}]}>
|
||||||
<View style={s.hContentRegion}>
|
<View style={s.hContentRegion}>
|
||||||
|
@ -50,16 +50,22 @@ function ShellInner() {
|
||||||
<FlatNavigator />
|
<FlatNavigator />
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{showSideNavs && (
|
{showSideNavs && (
|
||||||
<>
|
<>
|
||||||
<DesktopLeftNav />
|
<DesktopLeftNav />
|
||||||
<DesktopRightNav />
|
<DesktopRightNav />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Composer winHeight={0} />
|
<Composer winHeight={0} />
|
||||||
|
|
||||||
{showBottomBar && <BottomBarWeb />}
|
{showBottomBar && <BottomBarWeb />}
|
||||||
|
|
||||||
<ModalsContainer />
|
<ModalsContainer />
|
||||||
|
|
||||||
<Lightbox />
|
<Lightbox />
|
||||||
|
|
||||||
{!isDesktop && isDrawerOpen && (
|
{!isDesktop && isDrawerOpen && (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={() => setDrawerOpen(false)}
|
onPress={() => setDrawerOpen(false)}
|
||||||
|
|
Loading…
Reference in New Issue