Skip to content

Commit a5cf84d

Browse files
committed
All comments fixed
1 parent 5f64e30 commit a5cf84d

7 files changed

Lines changed: 58 additions & 60 deletions

File tree

src/components/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ export * from './LanguagePicker'
1212
export * from './Modal'
1313
export * from './StatusBar'
1414
export * from './Version'
15+
16+
export * from './screens/profile/ProfileControlledInput'
17+
export * from './screens/profile/ProfileDeleteAccountButton'
18+
export * from './screens/profile/ProfileDetailsForm'
19+
export * from './screens/profile/ProfileEditImage'
20+
export * from './screens/profile/ProfileHeader'
21+
export * from './screens/profile/ProfilePasswordForm'

src/components/screens/profile/ProfileDeleteAccountButton.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,16 @@ export const ProfileDeleteAccountButton = () => {
5757
)
5858

5959
return (
60-
<Box>
61-
<Box borderColor="border.secondary" borderTopWidth={1} py={6} alignItems="flex-start">
62-
<Button
63-
leftIconName="delete-bin-line"
64-
variant="SecondaryDestructive"
65-
borderRadius={8}
66-
onPress={presentBottomSheet}
67-
>
68-
{t('profile_screen.remove_account')}
69-
</Button>
70-
{bottomSheet}
71-
</Box>
60+
<Box borderColor="border.secondary" borderTopWidth={1} py={6} alignItems="flex-start">
61+
<Button
62+
leftIconName="delete-bin-line"
63+
variant="SecondaryDestructive"
64+
borderRadius={8}
65+
onPress={presentBottomSheet}
66+
>
67+
{t('profile_screen.remove_account')}
68+
</Button>
69+
{bottomSheet}
7270
</Box>
7371
)
7472
}

src/components/screens/profile/ProfileDetailsForm.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,20 @@ export const ProfileDetailsForm = () => {
2020
label={t('form.labels.first_name')}
2121
name="firstName"
2222
placeholder={t('form.placeholders.first_name')}
23-
control={control}
24-
errors={errors}
23+
{...{ control, errors }}
2524
onFocus={focusLastNameInput}
2625
/>
2726
<ProfileControlledInput
2827
label={t('form.labels.last_name')}
2928
name="lastName"
3029
placeholder={t('form.placeholders.last_name')}
31-
control={control}
32-
errors={errors}
30+
{...{ control, errors }}
3331
/>
3432
<ProfileControlledInput
3533
label={t('form.labels.email')}
3634
name="email"
3735
placeholder={t('form.placeholders.email')}
38-
control={control}
39-
errors={errors}
36+
{...{ control, errors }}
4037
isDisabled
4138
onSubmitEditing={submit}
4239
/>

src/components/screens/profile/ProfileEditImage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { isWeb } from '@baca/constants'
22
import { Box, Text, Button, Row, themeColors } from '@baca/design-system'
33
import * as ImagePicker from 'expo-image-picker'
44
import { t } from 'i18next'
5-
import React, { useState, useCallback } from 'react'
5+
import { useState, useCallback } from 'react'
66
import { Image, StyleSheet } from 'react-native'
77

88
export const ProfileEditImage: React.FC = () => {

src/components/screens/profile/ProfilePasswordForm.tsx

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,31 @@ export const ProfilePasswordForm = () => {
99
const { control, errors, submit, isSubmitting } = useUpdatePasswordForm()
1010

1111
return (
12-
<Box>
13-
<Box borderColor="border.secondary" borderTopWidth={1} py={6}>
14-
<ProfileControlledInput
15-
label={t('form.labels.old_password')}
16-
name="oldPassword"
17-
placeholder={t('form.placeholders.old_password')}
18-
control={control}
19-
errors={errors}
20-
/>
21-
<ProfileControlledInput
22-
label={t('form.labels.new_password')}
23-
name="password"
24-
placeholder={t('form.placeholders.new_password')}
25-
control={control}
26-
errors={errors}
27-
/>
28-
<Row maxW={800} justifyContent="flex-end">
29-
<Button
30-
disabled={isSubmitting}
31-
loading={isSubmitting}
32-
onPress={submit}
33-
testID="changePasswordButton"
34-
>
35-
{t('common.change')}
36-
</Button>
37-
</Row>
38-
</Box>
12+
<Box borderColor="border.secondary" borderTopWidth={1} py={6}>
13+
<ProfileControlledInput
14+
label={t('form.labels.old_password')}
15+
name="oldPassword"
16+
placeholder={t('form.placeholders.old_password')}
17+
control={control}
18+
errors={errors}
19+
/>
20+
<ProfileControlledInput
21+
label={t('form.labels.new_password')}
22+
name="password"
23+
placeholder={t('form.placeholders.new_password')}
24+
control={control}
25+
errors={errors}
26+
/>
27+
<Row maxW={800} justifyContent="flex-end">
28+
<Button
29+
disabled={isSubmitting}
30+
loading={isSubmitting}
31+
onPress={submit}
32+
testID="changePasswordButton"
33+
>
34+
{t('common.change')}
35+
</Button>
36+
</Row>
3937
</Box>
4038
)
4139
}

src/hooks/forms/useUpdatePasswordForm.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
import { useAuthControllerUpdate } from '@baca/api/query/auth/auth'
22
import { AuthUpdateDto } from '@baca/api/types'
33
import { handleFormError, hapticImpact, showSuccessToast } from '@baca/utils'
4-
import { useMemo } from 'react'
54
import { useForm } from 'react-hook-form'
65
import { useTranslation } from 'react-i18next'
76

7+
const defaultValues: AuthUpdateDto = {
8+
oldPassword: '',
9+
password: '',
10+
}
11+
812
export const useUpdatePasswordForm = () => {
913
const { t } = useTranslation()
1014
const { mutate: updatePasswordMutation, isLoading } = useAuthControllerUpdate()
1115

12-
const defaultValues: AuthUpdateDto = useMemo(
13-
() => ({
14-
oldPassword: '',
15-
password: '',
16-
}),
17-
[]
18-
)
19-
2016
const {
2117
control,
2218
formState: { errors },

src/screens/ProfileScreen.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import { ProfileDeleteAccountButton } from '@baca/components/screens/profile/ProfileDeleteAccountButton'
2-
import { ProfileDetailsForm } from '@baca/components/screens/profile/ProfileDetailsForm'
3-
import { ProfileEditImage } from '@baca/components/screens/profile/ProfileEditImage'
4-
import { ProfileHeader } from '@baca/components/screens/profile/ProfileHeader'
5-
import { ProfilePasswordForm } from '@baca/components/screens/profile/ProfilePasswordForm'
1+
import {
2+
ProfileDeleteAccountButton,
3+
ProfileDetailsForm,
4+
ProfileEditImage,
5+
ProfileHeader,
6+
ProfilePasswordForm,
7+
} from '@baca/components'
68
import { Box, ScrollView, Spacer } from '@baca/design-system'
79
import { useTranslation, useScreenOptions } from '@baca/hooks'
810

0 commit comments

Comments
 (0)