@@ -21,7 +21,7 @@ interface ProfileFormProps {
2121}
2222
2323const ProfileForm = ( { activeTab } : ProfileFormProps ) => {
24- const t = useTranslations ( ) ;
24+ const t = useTranslations ( "Profile" ) ;
2525 const profileFormSchema = createProfileFormSchema ( t ) ;
2626 const { data, isLoading } = useGetProfile ( ) ;
2727 const { mutate } = useUpdateProfile ( ) ;
@@ -33,6 +33,7 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
3333 fullname : "" ,
3434 date_of_birth : "" ,
3535 phone_number : "" ,
36+ gender : "" ,
3637 address : "" ,
3738 github : "" ,
3839 linkedin : "" ,
@@ -47,6 +48,7 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
4748 fullname : data . fullname || "" ,
4849 date_of_birth : data . date_of_birth || "" ,
4950 phone_number : data . phone_number || "" ,
51+ gender : data . gender || "" ,
5052 address : data . address || "" ,
5153 github : data . github || "" ,
5254 linkedin : data . linkedin || "" ,
@@ -56,8 +58,6 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
5658 } , [ data ] ) ;
5759
5860 const onSubmit = ( data : ProfileFormType ) => {
59- // ! TODO handle query mutation
60- console . log ( "Profile data:" , data ) ;
6161 mutate ( data ) ;
6262 } ;
6363
@@ -74,9 +74,9 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
7474 name = "username"
7575 render = { ( { field } ) => (
7676 < FormItem >
77- < FormLabel > Username </ FormLabel >
77+ < FormLabel > { t ( "form.label.username" ) } </ FormLabel >
7878 < FormControl >
79- < Input placeholder = "Enter your username" { ...field } />
79+ < Input placeholder = { t ( "form.placeholder. username") } { ...field } />
8080 </ FormControl >
8181 < FormMessage />
8282 </ FormItem >
@@ -88,9 +88,9 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
8888 name = "fullname"
8989 render = { ( { field } ) => (
9090 < FormItem >
91- < FormLabel > Full Name </ FormLabel >
91+ < FormLabel > { t ( "form.label.fullname" ) } </ FormLabel >
9292 < FormControl >
93- < Input placeholder = "Enter your full name" { ...field } />
93+ < Input placeholder = { t ( "form.placeholder.fullname" ) } { ...field } />
9494 </ FormControl >
9595 < FormMessage />
9696 </ FormItem >
@@ -102,15 +102,19 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
102102 name = "date_of_birth"
103103 render = { ( { field } ) => (
104104 < FormItem className = "flex flex-col" >
105- < FormLabel > Date of Birth </ FormLabel >
105+ < FormLabel > { t ( "form.label.date-of-birth" ) } </ FormLabel >
106106 < Popover >
107107 < PopoverTrigger asChild >
108108 < FormControl >
109109 < Button
110110 variant = "outline"
111111 className = { cn ( "w-full pl-3 text-left font-normal" , ! field . value && "text-muted-foreground" ) }
112112 >
113- { field . value ? format ( new Date ( field . value ) , "PPP" ) : < span > Pick a date</ span > }
113+ { field . value ? (
114+ format ( new Date ( field . value ) , "PPP" )
115+ ) : (
116+ < span > { t ( "form.placeholder.date-of-birth" ) } </ span >
117+ ) }
114118 < CalendarIcon className = "ml-auto h-4 w-4 opacity-50" />
115119 </ Button >
116120 </ FormControl >
@@ -139,15 +143,15 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
139143 name = "gender"
140144 render = { ( { field } ) => (
141145 < FormItem >
142- < FormLabel > Gender </ FormLabel >
146+ < FormLabel > { t ( "form.label.gender" ) } </ FormLabel >
143147 < FormControl >
144- < Select onValueChange = { field . onChange } defaultValue = { field . value } >
148+ < Select onValueChange = { field . onChange } value = { field . value } >
145149 < SelectTrigger >
146- < SelectValue placeholder = "Select gender" />
150+ < SelectValue placeholder = { t ( "form.placeholder. gender") } />
147151 </ SelectTrigger >
148152 < SelectContent >
149- < SelectItem value = "Male" > Male </ SelectItem >
150- < SelectItem value = "Female" > Female </ SelectItem >
153+ < SelectItem value = "Male" > { t ( "gender.male" ) } </ SelectItem >
154+ < SelectItem value = "Female" > { t ( "gender.female" ) } </ SelectItem >
151155 </ SelectContent >
152156 </ Select >
153157 </ FormControl >
@@ -161,9 +165,9 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
161165 name = "phone_number"
162166 render = { ( { field } ) => (
163167 < FormItem >
164- < FormLabel > Phone Number </ FormLabel >
168+ < FormLabel > { t ( "form.label.phone-number" ) } </ FormLabel >
165169 < FormControl >
166- < Input placeholder = "Enter your phone number" { ...field } />
170+ < Input placeholder = { t ( "form.placeholder. phone- number") } { ...field } />
167171 </ FormControl >
168172 < FormMessage />
169173 </ FormItem >
@@ -175,9 +179,9 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
175179 name = "address"
176180 render = { ( { field } ) => (
177181 < FormItem >
178- < FormLabel > Address </ FormLabel >
182+ < FormLabel > { t ( "form.label.address" ) } </ FormLabel >
179183 < FormControl >
180- < Input placeholder = "Enter your address" { ...field } />
184+ < Input placeholder = { t ( "form.placeholder. address") } { ...field } />
181185 </ FormControl >
182186 < FormMessage />
183187 </ FormItem >
@@ -194,9 +198,9 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
194198 name = "github"
195199 render = { ( { field } ) => (
196200 < FormItem >
197- < FormLabel > GitHub </ FormLabel >
201+ < FormLabel > { t ( "form.label.github" ) } </ FormLabel >
198202 < FormControl >
199- < Input placeholder = "Enter your github account" { ...field } />
203+ < Input placeholder = { t ( "form.placeholder. github" ) } { ...field } />
200204 </ FormControl >
201205 < FormMessage />
202206 </ FormItem >
@@ -208,9 +212,9 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
208212 name = "linkedin"
209213 render = { ( { field } ) => (
210214 < FormItem >
211- < FormLabel > LinkedIn </ FormLabel >
215+ < FormLabel > { t ( "form.label.linkedin" ) } </ FormLabel >
212216 < FormControl >
213- < Input placeholder = "Enter your linkedin account" { ...field } />
217+ < Input placeholder = { t ( "form.placeholder. linkedin" ) } { ...field } />
214218 </ FormControl >
215219 < FormMessage />
216220 </ FormItem >
@@ -222,9 +226,9 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
222226 name = "personal_web"
223227 render = { ( { field } ) => (
224228 < FormItem >
225- < FormLabel > Personal Website </ FormLabel >
229+ < FormLabel > { t ( "form.label.personal-web" ) } </ FormLabel >
226230 < FormControl >
227- < Input placeholder = "Enter your personal website" { ...field } />
231+ < Input placeholder = { t ( "form.placeholder. personal-web" ) } { ...field } />
228232 </ FormControl >
229233 < FormMessage />
230234 </ FormItem >
@@ -239,7 +243,7 @@ const ProfileForm = ({ activeTab }: ProfileFormProps) => {
239243 < form onSubmit = { form . handleSubmit ( onSubmit ) } className = "space-y-6" >
240244 { renderForm ( ) }
241245 < Button type = "submit" className = "bg-hmc-base-darkblue dark:bg-hmc-base-lightblue w-full text-white sm:w-auto" >
242- Save Profile
246+ { t ( "form.save-button" ) }
243247 </ Button >
244248 </ form >
245249 </ Form >
0 commit comments