Skip to content

Commit dc8604e

Browse files
committed
corrections on ProfileScreen split
1 parent 5abb315 commit dc8604e

3 files changed

Lines changed: 29 additions & 44 deletions

File tree

src/components/screens/profile/ProfileDeleteAccountButton.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useAuthControllerDelete } from '@baca/api/query/auth/auth'
22
import { Button, Text, Spacer, Row, Box, useBottomSheet } from '@baca/design-system'
3-
import { useCallback, useTranslation, useScreenOptions } from '@baca/hooks'
3+
import { useCallback, useTranslation } from '@baca/hooks'
44
import { signOut } from '@baca/store/auth'
55
import { showErrorToast } from '@baca/utils'
66

@@ -56,10 +56,6 @@ export const ProfileDeleteAccountButton = () => {
5656
}
5757
)
5858

59-
useScreenOptions({
60-
title: t('navigation.screen_titles.profile'),
61-
})
62-
6359
return (
6460
<Box>
6561
<Box borderColor="border.secondary" borderTopWidth={1} my={4} py={6} alignItems="flex-start">

src/components/screens/profile/ProfileDetailsForm.tsx

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
import { ControlledField } from '@baca/components'
22
import { isWeb } from '@baca/constants'
3-
import { Text, Box } from '@baca/design-system'
4-
import {
5-
useCallback,
6-
useTranslation,
7-
useUpdateProfileForm,
8-
useScreenOptions,
9-
useWeb,
10-
} from '@baca/hooks'
3+
import { Text, Box, Button, Spacer, Row } from '@baca/design-system'
4+
import { useCallback, useTranslation, useUpdateProfileForm, useWeb } from '@baca/hooks'
5+
import { useRouter } from 'expo-router'
116

127
export const ProfileDetailsForm = () => {
138
const { t } = useTranslation()
149
const { shouldApplyMobileStyles } = useWeb()
15-
const { control, errors, setFocus, submit } = useUpdateProfileForm()
16-
17-
useScreenOptions({
18-
title: t('navigation.screen_titles.profile'),
19-
})
10+
const { control, errors, setFocus, submit, isSubmitting } = useUpdateProfileForm()
11+
const { back } = useRouter()
2012

2113
const focusLastNameInput = useCallback(() => setFocus('lastName'), [setFocus])
2214

@@ -37,8 +29,8 @@ export const ProfileDetailsForm = () => {
3729
inputMode="text"
3830
name="firstName"
3931
onFocus={focusLastNameInput}
40-
placeholder={t('form.placeholders.email')}
41-
testID="emailInput"
32+
placeholder={t('form.placeholders.first_name')}
33+
testID="firstNameInput"
4234
{...(!isWeb && {
4335
label: t('form.labels.first_name'),
4436
})}
@@ -89,6 +81,25 @@ export const ProfileDetailsForm = () => {
8981
/>
9082
</Box>
9183
</Box>
84+
<Row maxW={800} justifyContent="flex-end">
85+
<Button.SecondaryColor
86+
disabled={isSubmitting}
87+
loading={isSubmitting}
88+
onPress={back}
89+
testID="backProfileButton"
90+
>
91+
{t('common.cancel')}
92+
</Button.SecondaryColor>
93+
<Spacer x="4" />
94+
<Button
95+
disabled={isSubmitting}
96+
loading={isSubmitting}
97+
onPress={submit}
98+
testID="saveProfileUpdateButton"
99+
>
100+
{t('common.save')}
101+
</Button>
102+
</Row>
92103
</Box>
93104
</Box>
94105
)

src/screens/ProfileScreen.tsx

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import { ProfileDeleteAccountButton } from '@baca/components/screens/profile/ProfileDeleteAccountButton'
22
import { ProfileDetailsForm } from '@baca/components/screens/profile/ProfileDetailsForm'
33
import { ProfileHeader } from '@baca/components/screens/profile/ProfileHeader'
4-
import { Button, Spacer, Row, Box } from '@baca/design-system'
5-
import { useTranslation, useUpdateProfileForm, useScreenOptions } from '@baca/hooks'
6-
import { useRouter } from 'expo-router'
4+
import { Box, Spacer } from '@baca/design-system'
5+
import { useTranslation, useScreenOptions } from '@baca/hooks'
76

87
export const ProfileScreen = () => {
98
const { t } = useTranslation()
10-
const { back } = useRouter()
11-
const { isSubmitting, submit } = useUpdateProfileForm()
129

1310
useScreenOptions({
1411
title: t('navigation.screen_titles.profile'),
@@ -19,25 +16,6 @@ export const ProfileScreen = () => {
1916
<ProfileHeader />
2017
<Spacer y={4} />
2118
<ProfileDetailsForm />
22-
<Row maxW={800} justifyContent="flex-end">
23-
<Button.SecondaryColor
24-
disabled={isSubmitting}
25-
loading={isSubmitting}
26-
onPress={back}
27-
testID="backProfileButton"
28-
>
29-
{t('common.cancel')}
30-
</Button.SecondaryColor>
31-
<Spacer x="4" />
32-
<Button
33-
disabled={isSubmitting}
34-
loading={isSubmitting}
35-
onPress={submit}
36-
testID="saveProfileUpdateButton"
37-
>
38-
{t('common.save')}
39-
</Button>
40-
</Row>
4119
<ProfileDeleteAccountButton />
4220
</Box>
4321
)

0 commit comments

Comments
 (0)