add verificaton check to list creation
This commit is contained in:
@@ -588,7 +588,7 @@ export const ComposePost = ({
|
|||||||
onClose()
|
onClose()
|
||||||
}}
|
}}
|
||||||
reasonText={_(
|
reasonText={_(
|
||||||
msg`Before you may create a post, you must first verify your email.`,
|
msg`Before creating a post, you must first verify your email.`,
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ import React from 'react'
|
|||||||
import {StyleSheet, View} from 'react-native'
|
import {StyleSheet, View} from 'react-native'
|
||||||
import {AtUri} from '@atproto/api'
|
import {AtUri} from '@atproto/api'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
|
import {useLingui} from '@lingui/react'
|
||||||
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
|
import {useEmail} from '#/lib/hooks/useEmail'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
||||||
@@ -16,15 +18,20 @@ import {MyLists} from '#/view/com/lists/MyLists'
|
|||||||
import {Button} from '#/view/com/util/forms/Button'
|
import {Button} from '#/view/com/util/forms/Button'
|
||||||
import {SimpleViewHeader} from '#/view/com/util/SimpleViewHeader'
|
import {SimpleViewHeader} from '#/view/com/util/SimpleViewHeader'
|
||||||
import {Text} from '#/view/com/util/text/Text'
|
import {Text} from '#/view/com/util/text/Text'
|
||||||
|
import {useDialogControl} from '#/components/Dialog'
|
||||||
|
import {VerifyEmailDialog} from '#/components/dialogs/VerifyEmailDialog'
|
||||||
import * as Layout from '#/components/Layout'
|
import * as Layout from '#/components/Layout'
|
||||||
|
|
||||||
type Props = NativeStackScreenProps<CommonNavigatorParams, 'Lists'>
|
type Props = NativeStackScreenProps<CommonNavigatorParams, 'Lists'>
|
||||||
export function ListsScreen({}: Props) {
|
export function ListsScreen({}: Props) {
|
||||||
|
const {_} = useLingui()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
|
const {needsEmailVerification} = useEmail()
|
||||||
|
const control = useDialogControl()
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
@@ -33,6 +40,11 @@ export function ListsScreen({}: Props) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const onPressNewList = React.useCallback(() => {
|
const onPressNewList = React.useCallback(() => {
|
||||||
|
if (needsEmailVerification) {
|
||||||
|
control.open()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
openModal({
|
openModal({
|
||||||
name: 'create-or-edit-list',
|
name: 'create-or-edit-list',
|
||||||
purpose: 'app.bsky.graph.defs#curatelist',
|
purpose: 'app.bsky.graph.defs#curatelist',
|
||||||
@@ -46,7 +58,7 @@ export function ListsScreen({}: Props) {
|
|||||||
} catch {}
|
} catch {}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}, [openModal, navigation])
|
}, [needsEmailVerification, control, openModal, navigation])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout.Screen testID="listsScreen">
|
<Layout.Screen testID="listsScreen">
|
||||||
@@ -87,6 +99,12 @@ export function ListsScreen({}: Props) {
|
|||||||
</View>
|
</View>
|
||||||
</SimpleViewHeader>
|
</SimpleViewHeader>
|
||||||
<MyLists filter="curate" style={s.flexGrow1} />
|
<MyLists filter="curate" style={s.flexGrow1} />
|
||||||
|
<VerifyEmailDialog
|
||||||
|
reasonText={_(
|
||||||
|
msg`Before creating a list, you must first verify your email.`,
|
||||||
|
)}
|
||||||
|
control={control}
|
||||||
|
/>
|
||||||
</Layout.Screen>
|
</Layout.Screen>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ import React from 'react'
|
|||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {AtUri} from '@atproto/api'
|
import {AtUri} from '@atproto/api'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
|
import {useLingui} from '@lingui/react'
|
||||||
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
|
import {useEmail} from '#/lib/hooks/useEmail'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
||||||
@@ -16,15 +18,20 @@ import {MyLists} from '#/view/com/lists/MyLists'
|
|||||||
import {Button} from '#/view/com/util/forms/Button'
|
import {Button} from '#/view/com/util/forms/Button'
|
||||||
import {SimpleViewHeader} from '#/view/com/util/SimpleViewHeader'
|
import {SimpleViewHeader} from '#/view/com/util/SimpleViewHeader'
|
||||||
import {Text} from '#/view/com/util/text/Text'
|
import {Text} from '#/view/com/util/text/Text'
|
||||||
|
import {useDialogControl} from '#/components/Dialog'
|
||||||
|
import {VerifyEmailDialog} from '#/components/dialogs/VerifyEmailDialog'
|
||||||
import * as Layout from '#/components/Layout'
|
import * as Layout from '#/components/Layout'
|
||||||
|
|
||||||
type Props = NativeStackScreenProps<CommonNavigatorParams, 'ModerationModlists'>
|
type Props = NativeStackScreenProps<CommonNavigatorParams, 'ModerationModlists'>
|
||||||
export function ModerationModlistsScreen({}: Props) {
|
export function ModerationModlistsScreen({}: Props) {
|
||||||
|
const {_} = useLingui()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
|
const {needsEmailVerification} = useEmail()
|
||||||
|
const control = useDialogControl()
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
@@ -33,6 +40,11 @@ export function ModerationModlistsScreen({}: Props) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const onPressNewList = React.useCallback(() => {
|
const onPressNewList = React.useCallback(() => {
|
||||||
|
if (needsEmailVerification) {
|
||||||
|
control.open()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
openModal({
|
openModal({
|
||||||
name: 'create-or-edit-list',
|
name: 'create-or-edit-list',
|
||||||
purpose: 'app.bsky.graph.defs#modlist',
|
purpose: 'app.bsky.graph.defs#modlist',
|
||||||
@@ -46,7 +58,7 @@ export function ModerationModlistsScreen({}: Props) {
|
|||||||
} catch {}
|
} catch {}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}, [openModal, navigation])
|
}, [needsEmailVerification, control, openModal, navigation])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout.Screen testID="moderationModlistsScreen">
|
<Layout.Screen testID="moderationModlistsScreen">
|
||||||
@@ -83,6 +95,12 @@ export function ModerationModlistsScreen({}: Props) {
|
|||||||
</View>
|
</View>
|
||||||
</SimpleViewHeader>
|
</SimpleViewHeader>
|
||||||
<MyLists filter="mod" style={s.flexGrow1} />
|
<MyLists filter="mod" style={s.flexGrow1} />
|
||||||
|
<VerifyEmailDialog
|
||||||
|
reasonText={_(
|
||||||
|
msg`Before creating a list, you must first verify your email.`,
|
||||||
|
)}
|
||||||
|
control={control}
|
||||||
|
/>
|
||||||
</Layout.Screen>
|
</Layout.Screen>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user