Remove invites code UI (#2851)
* Hide invite codes UI, comment in settings * Just comment outzio/stable
parent
543e114877
commit
bbf049d477
|
@ -41,7 +41,7 @@ import {
|
|||
import {useSession, useSessionApi, SessionAccount} from '#/state/session'
|
||||
import {useProfileQuery} from '#/state/queries/profile'
|
||||
import {useClearPreferencesMutation} from '#/state/queries/preferences'
|
||||
import {useInviteCodesQuery} from '#/state/queries/invites'
|
||||
// TODO import {useInviteCodesQuery} from '#/state/queries/invites'
|
||||
import {clear as clearStorage} from '#/state/persisted/store'
|
||||
import {clearLegacyStorage} from '#/state/persisted/legacy'
|
||||
import {STATUS_PAGE_URL} from 'lib/constants'
|
||||
|
@ -153,20 +153,21 @@ export function SettingsScreen({}: Props) {
|
|||
const {openModal} = useModalControls()
|
||||
const {isSwitchingAccounts, accounts, currentAccount} = useSession()
|
||||
const {mutate: clearPreferences} = useClearPreferencesMutation()
|
||||
const {data: invites} = useInviteCodesQuery()
|
||||
const invitesAvailable = invites?.available?.length ?? 0
|
||||
// TODO
|
||||
// const {data: invites} = useInviteCodesQuery()
|
||||
// const invitesAvailable = invites?.available?.length ?? 0
|
||||
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||
const closeAllActiveElements = useCloseAllActiveElements()
|
||||
const exportCarControl = useDialogControl()
|
||||
|
||||
const primaryBg = useCustomPalette<ViewStyle>({
|
||||
light: {backgroundColor: colors.blue0},
|
||||
dark: {backgroundColor: colors.blue6},
|
||||
})
|
||||
const primaryText = useCustomPalette<TextStyle>({
|
||||
light: {color: colors.blue3},
|
||||
dark: {color: colors.blue2},
|
||||
})
|
||||
// const primaryBg = useCustomPalette<ViewStyle>({
|
||||
// light: {backgroundColor: colors.blue0},
|
||||
// dark: {backgroundColor: colors.blue6},
|
||||
// })
|
||||
// const primaryText = useCustomPalette<TextStyle>({
|
||||
// light: {color: colors.blue3},
|
||||
// dark: {color: colors.blue2},
|
||||
// })
|
||||
|
||||
const dangerBg = useCustomPalette<ViewStyle>({
|
||||
light: {backgroundColor: colors.red1},
|
||||
|
@ -209,10 +210,12 @@ export function SettingsScreen({}: Props) {
|
|||
exportCarControl.open()
|
||||
}, [exportCarControl])
|
||||
|
||||
/* TODO
|
||||
const onPressInviteCodes = React.useCallback(() => {
|
||||
track('Settings:InvitecodesButtonClicked')
|
||||
openModal({name: 'invite-codes'})
|
||||
}, [track, openModal])
|
||||
*/
|
||||
|
||||
const onPressLanguageSettings = React.useCallback(() => {
|
||||
navigation.navigate('LanguageSettings')
|
||||
|
@ -392,6 +395,8 @@ export function SettingsScreen({}: Props) {
|
|||
|
||||
<View style={styles.spacer20} />
|
||||
|
||||
{/* TODO (
|
||||
<>
|
||||
<Text type="xl-bold" style={[pal.text, styles.heading]}>
|
||||
<Trans>Invite a Friend</Trans>
|
||||
</Text>
|
||||
|
@ -422,7 +427,9 @@ export function SettingsScreen({}: Props) {
|
|||
}
|
||||
/>
|
||||
</View>
|
||||
<Text type="lg" style={invitesAvailable > 0 ? pal.link : pal.text}>
|
||||
<Text
|
||||
type="lg"
|
||||
style={invitesAvailable > 0 ? pal.link : pal.text}>
|
||||
{invites?.disabled ? (
|
||||
<Trans>
|
||||
Your invite codes are hidden when logged in using an App
|
||||
|
@ -437,6 +444,8 @@ export function SettingsScreen({}: Props) {
|
|||
</TouchableOpacity>
|
||||
|
||||
<View style={styles.spacer20} />
|
||||
</>
|
||||
)*/}
|
||||
|
||||
<Text type="xl-bold" style={[pal.text, styles.heading]}>
|
||||
<Trans>Accessibility</Trans>
|
||||
|
|
|
@ -44,12 +44,10 @@ import {formatCountShortOnly} from 'view/com/util/numeric/format'
|
|||
import {Trans, msg} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {useSetDrawerOpen} from '#/state/shell'
|
||||
import {useModalControls} from '#/state/modals'
|
||||
import {useSession, SessionAccount} from '#/state/session'
|
||||
import {useProfileQuery} from '#/state/queries/profile'
|
||||
import {useUnreadNotifications} from '#/state/queries/notifications/unread'
|
||||
import {emitSoftReset} from '#/state/events'
|
||||
import {useInviteCodesQuery} from '#/state/queries/invites'
|
||||
import {NavSignupCard} from '#/view/shell/NavSignupCard'
|
||||
import {TextLink} from '../com/util/Link'
|
||||
|
||||
|
@ -228,8 +226,7 @@ let DrawerContent = ({}: {}): React.ReactNode => {
|
|||
|
||||
{hasSession ? (
|
||||
<>
|
||||
<InviteCodes />
|
||||
<View style={{height: 10}} />
|
||||
<View style={{height: 16}} />
|
||||
<SearchMenuItem isActive={isAtSearch} onPress={onPressSearch} />
|
||||
<HomeMenuItem isActive={isAtHome} onPress={onPressHome} />
|
||||
<NotificationsMenuItem
|
||||
|
@ -621,56 +618,6 @@ function MenuItem({
|
|||
)
|
||||
}
|
||||
|
||||
let InviteCodes = ({}: {}): React.ReactNode => {
|
||||
const {track} = useAnalytics()
|
||||
const setDrawerOpen = useSetDrawerOpen()
|
||||
const pal = usePalette('default')
|
||||
const {data: invites} = useInviteCodesQuery()
|
||||
const invitesAvailable = invites?.available?.length ?? 0
|
||||
const {openModal} = useModalControls()
|
||||
const {_} = useLingui()
|
||||
|
||||
const onPress = React.useCallback(() => {
|
||||
track('Menu:ItemClicked', {url: '#invite-codes'})
|
||||
setDrawerOpen(false)
|
||||
openModal({name: 'invite-codes'})
|
||||
}, [openModal, track, setDrawerOpen])
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
testID="menuItemInviteCodes"
|
||||
style={styles.inviteCodes}
|
||||
onPress={onPress}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={_(msg`Invite codes: ${invitesAvailable} available`)}
|
||||
accessibilityHint={_(msg`Opens list of invite codes`)}
|
||||
disabled={invites?.disabled}>
|
||||
<FontAwesomeIcon
|
||||
icon="ticket"
|
||||
style={[
|
||||
styles.inviteCodesIcon,
|
||||
invitesAvailable > 0 ? pal.link : pal.textLight,
|
||||
]}
|
||||
size={18}
|
||||
/>
|
||||
<Text
|
||||
type="lg-medium"
|
||||
style={invitesAvailable > 0 ? pal.link : pal.textLight}>
|
||||
{invites?.disabled ? (
|
||||
<Trans>
|
||||
Your invite codes are hidden when logged in using an App Password
|
||||
</Trans>
|
||||
) : invitesAvailable === 1 ? (
|
||||
<Trans>{invitesAvailable} invite code available</Trans>
|
||||
) : (
|
||||
<Trans>{invitesAvailable} invite codes available</Trans>
|
||||
)}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
InviteCodes = React.memo(InviteCodes)
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
view: {
|
||||
flex: 1,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import React from 'react'
|
||||
import {StyleSheet, TouchableOpacity, View} from 'react-native'
|
||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||
import {StyleSheet, View} from 'react-native'
|
||||
import {usePalette} from 'lib/hooks/usePalette'
|
||||
import {DesktopSearch} from './Search'
|
||||
import {DesktopFeeds} from './Feeds'
|
||||
|
@ -9,12 +8,9 @@ import {TextLink} from 'view/com/util/Link'
|
|||
import {FEEDBACK_FORM_URL, HELP_DESK_URL} from 'lib/constants'
|
||||
import {s} from 'lib/styles'
|
||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
||||
import {formatCount} from 'view/com/util/numeric/format'
|
||||
import {useModalControls} from '#/state/modals'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Plural, Trans, msg, plural} from '@lingui/macro'
|
||||
import {Trans, msg} from '@lingui/macro'
|
||||
import {useSession} from '#/state/session'
|
||||
import {useInviteCodesQuery} from '#/state/queries/invites'
|
||||
|
||||
export function DesktopRightNav({routeName}: {routeName: string}) {
|
||||
const pal = usePalette('default')
|
||||
|
@ -103,78 +99,11 @@ export function DesktopRightNav({routeName}: {routeName: string}) {
|
|||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{hasSession && <InviteCodes />}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
function InviteCodes() {
|
||||
const pal = usePalette('default')
|
||||
const {openModal} = useModalControls()
|
||||
const {data: invites} = useInviteCodesQuery()
|
||||
const invitesAvailable = invites?.available?.length ?? 0
|
||||
const {_} = useLingui()
|
||||
|
||||
const onPress = React.useCallback(() => {
|
||||
openModal({name: 'invite-codes'})
|
||||
}, [openModal])
|
||||
|
||||
if (!invites) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (invites?.disabled) {
|
||||
return (
|
||||
<View style={[styles.inviteCodes, pal.border]}>
|
||||
<FontAwesomeIcon
|
||||
icon="ticket"
|
||||
style={[styles.inviteCodesIcon, pal.textLight]}
|
||||
size={16}
|
||||
/>
|
||||
<Text type="md-medium" style={pal.textLight}>
|
||||
<Trans>
|
||||
Your invite codes are hidden when logged in using an App Password
|
||||
</Trans>
|
||||
</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
style={[styles.inviteCodes, pal.border]}
|
||||
onPress={onPress}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={_(
|
||||
plural(invitesAvailable, {
|
||||
one: 'Invite codes: # available',
|
||||
other: 'Invite codes: # available',
|
||||
}),
|
||||
)}
|
||||
accessibilityHint={_(msg`Opens list of invite codes`)}>
|
||||
<FontAwesomeIcon
|
||||
icon="ticket"
|
||||
style={[
|
||||
styles.inviteCodesIcon,
|
||||
invitesAvailable > 0 ? pal.link : pal.textLight,
|
||||
]}
|
||||
size={16}
|
||||
/>
|
||||
<Text
|
||||
type="md-medium"
|
||||
style={invitesAvailable > 0 ? pal.link : pal.textLight}>
|
||||
<Plural
|
||||
value={formatCount(invitesAvailable)}
|
||||
one="# invite code available"
|
||||
other="# invite codes available"
|
||||
/>
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
rightNav: {
|
||||
// @ts-ignore web only
|
||||
|
@ -193,18 +122,6 @@ const styles = StyleSheet.create({
|
|||
messageLine: {
|
||||
marginBottom: 10,
|
||||
},
|
||||
|
||||
inviteCodes: {
|
||||
borderTopWidth: 1,
|
||||
paddingHorizontal: 12,
|
||||
paddingVertical: 12,
|
||||
flexDirection: 'row',
|
||||
},
|
||||
inviteCodesIcon: {
|
||||
marginTop: 2,
|
||||
marginRight: 6,
|
||||
flexShrink: 0,
|
||||
},
|
||||
desktopFeedsContainer: {
|
||||
borderTopWidth: 1,
|
||||
borderBottomWidth: 1,
|
||||
|
|
Loading…
Reference in New Issue