fix null error

This commit is contained in:
Hailey
2024-06-14 13:10:03 -07:00
parent 1bd9985d20
commit e94012c76c
3 changed files with 42 additions and 8 deletions
@@ -4,11 +4,14 @@ import {View} from 'react-native'
import {AppBskyActorDefs} from '@atproto/api' import {AppBskyActorDefs} from '@atproto/api'
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs' import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
import {BottomSheetFlatListMethods} from '@discord/bottom-sheet' import {BottomSheetFlatListMethods} from '@discord/bottom-sheet'
import {Trans} from '@lingui/macro' import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {isWeb} from 'platform/detection'
import {useSession} from 'state/session' import {useSession} from 'state/session'
import {WizardAction, WizardState} from '#/screens/StarterPack/Wizard/State' import {WizardAction, WizardState} from '#/screens/StarterPack/Wizard/State'
import {atoms as a, native, useTheme, web} from '#/alf' import {atoms as a, native, useTheme, web} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog' import * as Dialog from '#/components/Dialog'
import {WizardFeedCard} from '#/components/StarterPack/Wizard/WizardFeedCard' import {WizardFeedCard} from '#/components/StarterPack/Wizard/WizardFeedCard'
import {WizardProfileCard} from '#/components/StarterPack/Wizard/WizardProfileCard' import {WizardProfileCard} from '#/components/StarterPack/Wizard/WizardProfileCard'
@@ -30,8 +33,9 @@ export function WizardEditListDialog({
state: WizardState state: WizardState
dispatch: (action: WizardAction) => void dispatch: (action: WizardAction) => void
}) { }) {
const {currentAccount} = useSession() const {_} = useLingui()
const t = useTheme() const t = useTheme()
const {currentAccount} = useSession()
const listRef = useRef<BottomSheetFlatListMethods>(null) const listRef = useRef<BottomSheetFlatListMethods>(null)
@@ -68,15 +72,29 @@ export function WizardEditListDialog({
ListHeaderComponent={ ListHeaderComponent={
<View <View
style={[ style={[
a.align_center, a.flex_row,
a.justify_end, a.justify_between,
a.border_b, a.border_b,
a.pb_sm, a.px_sm,
a.mb_sm, a.mb_sm,
t.atoms.bg, t.atoms.bg,
t.atoms.border_contrast_medium, t.atoms.border_contrast_medium,
{height: 68}, isWeb
? [
a.align_center,
{
height: 48,
},
]
: [
a.pb_sm,
a.align_end,
{
height: 68,
},
],
]}> ]}>
<View style={{width: 60}} />
<Text style={[a.font_bold, a.text_xl]}> <Text style={[a.font_bold, a.text_xl]}>
{state.currentStep === 'Profiles' ? ( {state.currentStep === 'Profiles' ? (
<Trans>Edit People</Trans> <Trans>Edit People</Trans>
@@ -84,6 +102,20 @@ export function WizardEditListDialog({
<Trans>Edit Feeds</Trans> <Trans>Edit Feeds</Trans>
)} )}
</Text> </Text>
<View style={{width: 60}}>
{isWeb && (
<Button
label={_(msg`Close`)}
variant="ghost"
color="primary"
size="xsmall"
onPress={() => control.close()}>
<ButtonText>
<Trans>Close</Trans>
</ButtonText>
</Button>
)}
</View>
</View> </View>
} }
stickyHeaderIndices={[0]} stickyHeaderIndices={[0]}
@@ -30,6 +30,8 @@ export function WizardProfileCard({
const onPressAddRemove = () => { const onPressAddRemove = () => {
Keyboard.dismiss() Keyboard.dismiss()
if (profile.did === currentAccount?.did) return
if (!includesProfile) { if (!includesProfile) {
dispatch({type: 'AddProfile', profile}) dispatch({type: 'AddProfile', profile})
} else { } else {
+2 -2
View File
@@ -491,7 +491,7 @@ function Container({
{showDeleteBtn && ( {showDeleteBtn && (
<Button <Button
label={_(msg`Next`)} label={_(msg`Next`)}
variant="outline" variant="ghost"
color="negative" color="negative"
size="medium" size="medium"
style={[a.mx_xl, a.mb_lg]} style={[a.mx_xl, a.mb_lg]}
@@ -666,7 +666,7 @@ function Footer({
{isEditEnabled ? ( {isEditEnabled ? (
<Button <Button
label={_(msg`Edit`)} label={_(msg`Edit`)}
variant="outline" variant="ghost"
color="primary" color="primary"
size="small" size="small"
onPress={editDialogControl.open}> onPress={editDialogControl.open}>