1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-12-08 00:44:30 +01:00

fix: client-side age calculation, more glanular check for isMounted

Allows to render as much as possible on the server side.
While keeping the calculation of the age on the client side to avoid hydratation mismatch.
This commit is contained in:
Théo LUDWIG 2024-05-16 10:06:43 +02:00
parent bbb2e56512
commit b231381cb3
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B

View File

@ -30,14 +30,17 @@ export const ProfileList = (props: ProfileListProps): JSX.Element => {
title={i18n.translate("home.about.pronouns")} title={i18n.translate("home.about.pronouns")}
value={i18n.translate("home.about.pronouns-value")} value={i18n.translate("home.about.pronouns-value")}
/> />
{isMounted ? ( <ProfileItem
<ProfileItem title={i18n.translate("home.about.birth-date")}
title={i18n.translate("home.about.birth-date")} value={
value={`${BIRTH_DATE_STRING} (${age} ${i18n.translate( isMounted
"home.about.years-old", ? `${BIRTH_DATE_STRING} (${age} ${i18n.translate(
)})`} "home.about.years-old",
/> )})`
) : null} : BIRTH_DATE_STRING
}
/>
<ProfileItem <ProfileItem
title={i18n.translate("home.about.nationality")} title={i18n.translate("home.about.nationality")}
value="Alsace, France" value="Alsace, France"