Skip to content

Commit f8503e0

Browse files
committed
ProfilePasswordForm working
1 parent 563bd24 commit f8503e0

2 files changed

Lines changed: 2 additions & 131 deletions

File tree

Lines changed: 1 addition & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
import { AuthUpdateDto } from '@baca/api/types'
21
import { Box, Button, Row } from '@baca/design-system'
32
import { useUpdatePasswordForm } from '@baca/hooks/forms/useUpdatePasswordForm'
43
import React from 'react'
54
import { useTranslation } from 'react-i18next'
65

76
import { ProfileControlledInput } from './ProfileControlledInput'
87

9-
interface ProfilePasswordFormProps {
10-
onSubmit: (data: AuthUpdateDto) => void
11-
}
12-
13-
export const ProfilePasswordForm = ({ onSubmit }: ProfilePasswordFormProps) => {
8+
export const ProfilePasswordForm = () => {
149
const { t } = useTranslation()
1510
const { control, errors, submit, isSubmitting } = useUpdatePasswordForm()
1611

@@ -23,15 +18,13 @@ export const ProfilePasswordForm = ({ onSubmit }: ProfilePasswordFormProps) => {
2318
placeholder={t('form.placeholders.old_password')}
2419
control={control}
2520
errors={errors}
26-
// secureTextEntry
2721
/>
2822
<ProfileControlledInput
2923
label={t('form.labels.new_password')}
3024
name="password"
3125
placeholder={t('form.placeholders.new_password')}
3226
control={control}
3327
errors={errors}
34-
// secureTextEntry
3528
/>
3629
<Row maxW={800} justifyContent="flex-end">
3730
<Button
@@ -47,89 +40,3 @@ export const ProfilePasswordForm = ({ onSubmit }: ProfilePasswordFormProps) => {
4740
</Box>
4841
)
4942
}
50-
51-
// import { Box, Button } from '@baca/design-system'
52-
// import { useTranslation } from '@baca/hooks'
53-
// import { useUpdatePasswordForm } from '@baca/hooks/forms/useUpdatePasswordForm'
54-
// import { ProfileControlledInput } from './ProfileControlledInput'
55-
// import { AuthUpdateDto } from '@baca/api/types'
56-
57-
// interface ProfilePasswordFormProps {
58-
// onSubmit: (data: AuthUpdateDto) => void
59-
// }
60-
61-
// export const ProfilePasswordForm = ({ onSubmit }: ProfilePasswordFormProps) => {
62-
// const { t } = useTranslation()
63-
// const { control, errors, isSubmitting, submit } = useUpdatePasswordForm()
64-
65-
// return (
66-
// <Box
67-
// /* as="form" onSubmit={submit} */ borderColor="border.secondary"
68-
// borderTopWidth={1}
69-
// py={6}
70-
// >
71-
// <ProfileControlledInput
72-
// label={t('form.labels.old_password')}
73-
// name="oldPassword"
74-
// placeholder={t('form.placeholders.old_password')}
75-
// control={control}
76-
// errors={errors}
77-
// // isPassword
78-
// />
79-
// <ProfileControlledInput
80-
// label={t('form.labels.new_password')}
81-
// name="password"
82-
// placeholder={t('form.placeholders.new_password')}
83-
// control={control}
84-
// errors={errors}
85-
// // isPassword
86-
// />
87-
// <Button type="submit" isLoading={isSubmitting}>
88-
// {t('common.change')}
89-
// </Button>
90-
// </Box>
91-
// )
92-
// }
93-
94-
// import { Box, Spacer, Button } from '@baca/design-system'
95-
// import { useForm, Controller } from 'react-hook-form'
96-
// import { ProfileControlledInput } from './ProfileControlledInput'
97-
// import { useTranslation } from '@baca/hooks'
98-
// import { AuthUpdateDto } from '@baca/api/types'
99-
100-
// interface ProfilePasswordFormProps {
101-
// onSubmit: (data: AuthUpdateDto) => void
102-
// }
103-
104-
// export const ProfilePasswordForm = ({ onSubmit }: ProfilePasswordFormProps) => {
105-
// const {
106-
// control,
107-
// handleSubmit,
108-
// formState: { errors },
109-
// } = useForm<AuthUpdateDto>()
110-
// const { t } = useTranslation()
111-
112-
// return (
113-
// <Box as="form" onSubmit={handleSubmit(onSubmit)}>
114-
// <ProfileControlledInput
115-
// label={t('form.labels.old_password')}
116-
// name="oldPassword"
117-
// placeholder={t('form.placeholders.old_password')}
118-
// control={control}
119-
// errors={errors}
120-
// isPassword
121-
// />
122-
// <Spacer y={4} />
123-
// <ProfileControlledInput
124-
// label={t('form.labels.new_password')}
125-
// name="password"
126-
// placeholder={t('form.placeholders.new_password')}
127-
// control={control}
128-
// errors={errors}
129-
// isPassword
130-
// />
131-
// <Spacer y={4} />
132-
// <Button type="submit">{t('form.buttons.update_password')}</Button>
133-
// </Box>
134-
// )
135-
// }

src/screens/ProfileScreen.tsx

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { AuthUpdateDto } from '@baca/api/types'
21
import { ProfileDeleteAccountButton } from '@baca/components/screens/profile/ProfileDeleteAccountButton'
32
import { ProfileDetailsForm } from '@baca/components/screens/profile/ProfileDetailsForm'
43
import { ProfileHeader } from '@baca/components/screens/profile/ProfileHeader'
@@ -13,50 +12,15 @@ export const ProfileScreen = () => {
1312
title: t('navigation.screen_titles.profile'),
1413
})
1514

16-
const handlePasswordUpdate = (data: AuthUpdateDto) => {
17-
console.log('Password updated:', data)
18-
}
19-
2015
return (
2116
<Box p={4}>
2217
<ProfileHeader />
2318
<Spacer y={4} />
2419
<ProfileDetailsForm />
2520
<Spacer y={4} />
26-
<ProfilePasswordForm onSubmit={handlePasswordUpdate} />
21+
<ProfilePasswordForm />
2722
<Spacer y={4} />
2823
<ProfileDeleteAccountButton />
2924
</Box>
3025
)
3126
}
32-
33-
// import { ProfileDeleteAccountButton } from '@baca/components/screens/profile/ProfileDeleteAccountButton'
34-
// import { ProfileDetailsForm } from '@baca/components/screens/profile/ProfileDetailsForm'
35-
// import { ProfileHeader } from '@baca/components/screens/profile/ProfileHeader'
36-
// import { ProfilePasswordForm } from '@baca/components/screens/profile/ProfilePasswordForm'
37-
// import { Box, Spacer } from '@baca/design-system'
38-
// import { useTranslation, useScreenOptions } from '@baca/hooks'
39-
40-
// export const ProfileScreen = () => {
41-
// const { t } = useTranslation()
42-
43-
// useScreenOptions({
44-
// title: t('navigation.screen_titles.profile'),
45-
// })
46-
47-
// const handlePasswordUpdate = (data) => {
48-
// console.log('Password updated:', data)
49-
// }
50-
51-
// return (
52-
// <Box p={4}>
53-
// <ProfileHeader />
54-
// <Spacer y={4} />
55-
// <ProfileDetailsForm />
56-
// <Spacer y={4} />
57-
// <ProfilePasswordForm onSubmit={handlePasswordUpdate} />
58-
// <Spacer y={4} />
59-
// <ProfileDeleteAccountButton />
60-
// </Box>
61-
// )
62-
// }

0 commit comments

Comments
 (0)