@@ -43,6 +43,7 @@ export function ProfileCard({
4343} : ProfileCardProps ) {
4444 const t = useTranslations ( 'dashboard.profile' ) ;
4545 const tStats = useTranslations ( 'dashboard.stats' ) ;
46+ const tFields = useTranslations ( 'auth.fields' ) ;
4647 const [ isSettingsOpen , setIsSettingsOpen ] = useState ( false ) ;
4748 const [ isSaving , setIsSaving ] = useState ( false ) ;
4849
@@ -271,6 +272,14 @@ export function ProfileCard({
271272 className = "w-full rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm transition-all outline-none placeholder:text-gray-400 focus:border-(--accent-primary) focus:ring-1 focus:ring-(--accent-primary) dark:border-neutral-800 dark:bg-neutral-900 dark:text-white"
272273 placeholder = { t ( 'defaultName' ) }
273274 required
275+ onInvalid = { e => {
276+ if ( e . currentTarget . validity . valueMissing ) {
277+ e . currentTarget . setCustomValidity (
278+ tFields ( 'validation.required' )
279+ ) ;
280+ }
281+ } }
282+ onInput = { e => e . currentTarget . setCustomValidity ( '' ) }
274283 />
275284 </ div >
276285 < button
@@ -299,6 +308,14 @@ export function ProfileCard({
299308 placeholder = { t ( 'currentPassword' ) }
300309 className = "w-full rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm transition-all outline-none placeholder:text-gray-400 focus:border-(--accent-primary) focus:ring-1 focus:ring-(--accent-primary) dark:border-neutral-800 dark:bg-neutral-900 dark:text-white"
301310 required
311+ onInvalid = { e => {
312+ if ( e . currentTarget . validity . valueMissing ) {
313+ e . currentTarget . setCustomValidity (
314+ tFields ( 'validation.required' )
315+ ) ;
316+ }
317+ } }
318+ onInput = { e => e . currentTarget . setCustomValidity ( '' ) }
302319 />
303320 </ div >
304321 < div >
@@ -309,6 +326,14 @@ export function ProfileCard({
309326 minLength = { 8 }
310327 className = "w-full rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm transition-all outline-none placeholder:text-gray-400 focus:border-(--accent-primary) focus:ring-1 focus:ring-(--accent-primary) dark:border-neutral-800 dark:bg-neutral-900 dark:text-white"
311328 required
329+ onInvalid = { e => {
330+ if ( e . currentTarget . validity . valueMissing ) {
331+ e . currentTarget . setCustomValidity (
332+ tFields ( 'validation.required' )
333+ ) ;
334+ }
335+ } }
336+ onInput = { e => e . currentTarget . setCustomValidity ( '' ) }
312337 />
313338 </ div >
314339 < button
0 commit comments