Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates profile validation #1920

Merged
merged 6 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"presets": ["next/babel"]
"presets": ["next/babel"],
"plugins": ["@babel/plugin-transform-unicode-regex"]
}
113 changes: 90 additions & 23 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@babel/plugin-transform-unicode-regex": "^7.23.3",
"@emotion/babel-plugin": "^11.9.2",
"@emotion/eslint-plugin": "^11.7.0",
"@hookform/devtools": "^4.3.1",
Expand Down
21 changes: 1 addition & 20 deletions pages/complete-signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,7 @@ export async function getStaticProps({ locale }: GetStaticPropsContext) {
props: {
...(await serverSideTranslations(
locale || 'en',
[
'bulkCodes',
'common',
'country',
'donate',
'donationLink',
'editProfile',
'giftfunds',
'leaderboard',
'managePayouts',
'manageProjects',
'maps',
'me',
'planet',
'planetcash',
'redeem',
'registerTrees',
'tenants',
'treemapper',
],
['common', 'country', 'editProfile'],
null,
['en', 'de', 'fr', 'es', 'it', 'pt-BR', 'cs']
)),
Expand Down
21 changes: 1 addition & 20 deletions pages/profile/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,7 @@ export async function getStaticProps({ locale }: GetStaticPropsContext) {
props: {
...(await serverSideTranslations(
locale || 'en',
[
'bulkCodes',
'common',
'country',
'donate',
'donationLink',
'editProfile',
'giftfunds',
'leaderboard',
'managePayouts',
'manageProjects',
'maps',
'me',
'planet',
'planetcash',
'redeem',
'registerTrees',
'tenants',
'treemapper',
],
['editProfile', 'me', 'common', 'country'],
null,
['en', 'de', 'fr', 'es', 'it', 'pt-BR', 'cs']
)),
Expand Down
41 changes: 29 additions & 12 deletions public/static/locales/cs/editProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,17 @@
"loginTitle": "{{log}} - Přihlášení",
"signUpText": "Dokončení registrace",
"profileTypes": "{{item.title}}",
"profileName": "Název {{type}}",
"createAccount": "Vytvořit účet",
"individual": "Osoba",
"iamA": "Já jsem",
"tpo": "Organizace pro obnovu lesů",
"education": "Škola",
"organization": "Společnost",
"profileCreated": "Profil úspěšně vytvořen!",
"profileCreationFailed": "Chyba při vytváření profilu. Zkuste to prosím znovu.",
"profileCreationError": "Chyba při vytváření profilu.",
"edit": "Editovat profil",
"privateAccount": "Soukromý účet",
"privateAccountTxt": "Váš profil je skrytý a v žebříčku se zobrazuje pouze vaše křestní jméno",
"subscribe": "Přihlášení k odběru novinek e-mailem",
"profileDescription": "Popis profilu",
"descriptionRequired": "Překročili jste maximální délku",
"website": "Webstránka",
"websiteError": "Neplatná URL adresa webové stránky",
"websiteRequired": "Zadejte prosím platnou adresu URL",
"save": "Uložit",
"nameValidation": "Zadejte prosím jméno",
"profilePicUpdated": "Profilový obrázek se aktualizuje...",
"profileSaved": "Úspěšně uloženo!",
"profileSaveFailed": "Chyba při aktualizaci profilu.",
Expand All @@ -32,5 +22,32 @@
"continue": "Pokračovat",
"cancel": "Zrušit",
"termAndCondition": "Souhlasím s <0>podmínkami</0> platformy Plant-for-the-Planet.",
"termAndConditionError": "Přijměte prosím Smluvní podmínky"
}
"termAndConditionError": "Přijměte prosím Smluvní podmínky",
"fieldLabels": {
"profileType": "Já jsem",
"firstName": "Jméno",
"lastName": "Příjmení",
"email": "Email",
"address": "Adresa",
"city": "Město",
"zipCode": "PSČ",
"name": "Název {{type}}",
"country": "Země",
"bio": "Popis profilu",
"website": "Webstránka",
"privateAccount": "Soukromý účet",
"subscribe": "Přihlášení k odběru novinek e-mailem"
},
"validationErrors": {
"firstNameRequired": "Jméno je povinné",
"lastNameRequired": "Příjmení je povinné",
"emailRequired": "Email je povinný",
"nameRequired": "Zadejte prosím jméno",
"addressRequired": "Adresa je povinná",
"cityRequired": "Město je povinno",
"zipCodeInvalid": "PSČ je neplatné",
"websiteInvalid": "Zadejte prosím platnou adresu URL",
"countryRequired": "Země je povinná",
"companyRequired": "Název společnosti je povinný"
}
}
41 changes: 29 additions & 12 deletions public/static/locales/de/editProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,17 @@
"loginTitle": "{{log}} - Anmeldung",
"signUpText": "Registrierung vervollständigen",
"profileTypes": "{{item.title}}",
"profileName": "Name der {{type}}",
"createAccount": "Konto erstellen",
"individual": "Person",
"iamA": "Ich bin ein",
"tpo": "Wiederaufforstung-Organisation",
"education": "Schule",
"organization": "Firma",
"profileCreated": "Profil erfolgreich erstellt!",
"profileCreationFailed": "Fehler bei der Profilerstellung. Bitte versuchen Sie es erneut.",
"profileCreationError": "Fehler bei der Profilerstellung.",
"edit": "Profil bearbeiten",
"privateAccount": "Privatkonto",
"privateAccountTxt": "Dein Profil wird ausgeblendet und nur Dein Vorname erscheint in der Bestenliste",
"subscribe": "Nachrichten per E-Mail abonnieren",
"profileDescription": "Profilbeschreibung",
"descriptionRequired": "Du hast die maximale Länge überschritten",
"website": "Website",
"websiteError": "Ungültige Website-URL",
"websiteRequired": "Bitte gib eine gültige Website-URL ein",
"save": "Speichern",
"nameValidation": "Bitte gib einen Namen ein",
"profilePicUpdated": "Profilbild wird aktualisiert...",
"profileSaved": "Erfolgreich gespeichert!",
"profileSaveFailed": "Fehler beim Aktualisieren des Profils.",
Expand All @@ -32,5 +22,32 @@
"continue": "Weiter",
"cancel": "Abbrechen",
"termAndCondition": "Ich stimme den <0>Nutzungsbedingungen</0> der Plant-for-the-Planet Plattform zu.",
"termAndConditionError": "Bitte stimme den Nutzungsbedingungen zu"
}
"termAndConditionError": "Bitte stimme den Nutzungsbedingungen zu",
"fieldLabels": {
"profileType": "Ich bin ein",
"firstName": "Vorname",
"lastName": "Nachname",
"name": "Name der {{type}}",
"email": "E-Mail",
"address": "Adresse",
"city": "Stadt",
"zipCode": "PLZ",
"country": "Land",
"bio": "Profilbeschreibung",
"website": "Website",
"privateAccount": "Privatkonto",
"subscribe": "Nachrichten per E-Mail abonnieren"
},
"validationErrors": {
"firstNameRequired": "Vorname ist erforderlich",
"lastNameRequired": "Nachname ist erforderlich",
"emailRequired": "E-Mail ist erforderlich",
"nameRequired": "Bitte gib einen Namen ein",
"addressRequired": "Adresse ist erforderlich",
"cityRequired": "Stadt ist erforderlich",
"zipCodeInvalid": "PLZ ist ungültig",
"websiteInvalid": "Bitte gib eine gültige Website-URL ein",
"countryRequired": "Land ist erforderlich",
"companyRequired": "Firmenname ist erforderlich"
}
}
48 changes: 36 additions & 12 deletions public/static/locales/en/editProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,17 @@
"loginTitle": "{{log}} - Login",
"signUpText": "Complete Signup",
"profileTypes": "{{item.title}}",
"profileName": "Name of {{type}}",
"createAccount": "Create Account",
"individual": "Person",
"iamA": "I am a",
"tpo": "Restoration Organization",
"education": "School",
"organization": "Company",
"profileCreated": "Profile Successfully created!",
"profileCreationFailed": "Error in creating profile. Please try again.",
"profileCreationError": "Error in creating profile.",
"edit": "Edit Profile",
"privateAccount": "Private Account",
"privateAccountTxt": "Your profile is hidden and only your first name appears in the leaderboard",
"subscribe": "Subscribe to news via email",
"profileDescription": "Profile Desciption",
"descriptionRequired": "You have exceeded the maximum length",
"website": "Website",
"websiteError": "Invalid website URL",
"websiteRequired": "Please enter valid Website URL",
"save": "Save",
"nameValidation": "Please enter a name",
"profilePicUpdated": "Profile picture is being updated...",
"profileSaved": "Saved successfully!",
"profileSaveFailed": "Error in updating profile.",
Expand All @@ -32,5 +22,39 @@
"continue": "Continue",
"cancel": "Cancel",
"termAndCondition": "I agree to the <0>Terms and Conditions</0> of the Plant-for-the-Planet platform.",
"termAndConditionError": "Please Accept the Terms and Conditions"
}
"termAndConditionError": "Please Accept the Terms and Conditions",
"fieldLabels": {
"profileType": "I am a",
"firstName": "First Name",
"lastName": "Last Name",
"name": "Name of {{type}}",
"email": "Email",
"address": "Address",
"city": "City",
"zipCode": "Postal/Zip Code",
"country": "Country",
"bio": "Profile Description",
"website": "Website",
"privateAccount": "Private Account",
"subscribe": "Subscribe to news via email"
},
"validationErrors": {
"maxChars": "Should be {{max}} characters or less",
"firstNameRequired": "First Name field is required",
"firstNameInvalid": "First name is invalid. It cannot start with a special character, and only these special characters are allowed: space ' . -",
"lastNameRequired": "Last Name field is required",
"lastNameInvalid": "Last name is invalid. It cannot start with a special character, and only these special characters are allowed: space ' -",
"emailRequired": "Email is required",
"nameRequired": "Please enter a name",
"nameInvalid": "Name is invalid. Only these special characters are allowed: space . , ' & ( ) ! -",
"addressRequired": "Address is required",
"addressInvalid": "Address is invalid. Only these special characters are allowed: space . , # - /",
"cityRequired": "City is required",
"cityInvalid": "City is invalid. Only letters and these special characters are allowed: space . , ( ) -",
"zipCodeRequired": "Zip Code is required",
"zipCodeInvalid": "Zip Code is invalid",
"websiteInvalid": "Please enter valid Website URL",
"countryRequired": "Country is required",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resource does not seem to be used (I assume nameRequired is used instead)?

"companyRequired": "Company Name is required"
}
}
39 changes: 29 additions & 10 deletions public/static/locales/es/editProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,52 @@
"loginTitle": "{{log}} - Ingresa en",
"signUpText": "Inscripción completa",
"profileTypes": "{{item.title}}",
"profileName": "Nombre de {{type}}",
"createAccount": "Crear una cuenta",
"individual": "Individuo",
"iamA": "Soy un",
"tpo": "Organización de plantación",
"education": "Escuela",
"organization": "Empresa",
"profileCreated": "Perfil Creado con éxito!",
"profileCreationFailed": "Error en la creación del perfil. Por favor, inténtalo de nuevo.",
"profileCreationError": "Error en la creación del perfil.",
"edit": "Editar el perfil",
"privateAccount": "Cuenta privada",
"privateAccountTxt": "Tu perfil está oculto y sólo tu nombre aparece en la tabla de clasificación",
"subscribe": "Suscríbete a las noticias por correo electrónico",
"profileDescription": "Descripción del perfil",
"descriptionRequired": "Por favor, introduce una descripción válida",
"website": "Página web",
"websiteError": "URL inválido",
"websiteRequired": "Por favor, introduzca una URL válida",
"save": "Guardar",
"nameValidation": "Por favor, introduce un nombre",
"profilePicUpdated": "La foto del perfil está siendo actualizada...",
"profileSaved": "¡Guardado con éxito!",
"profileSaveFailed": "Error en la actualización del perfil.",
"changeAccountToPublic": "Cambiar a una cuenta pública",
"publicAccount": "Cuenta pública",
"accountPrivacyChangeText": "Para crear un widget de perfil necesitas tener una cuenta pública. Al hacer clic en continuar, cambias tu configuración de privacidad a pública.",
"continue": "Continúa",
"cancel": "Cancelar"
}
"cancel": "Cancelar",
"fieldLabels": {
"profileType": "Soy un",
"firstName": "Nombre",
"lastName": "Apellidos",
"name": "Nombre de {{type}}",
"email": "Correo electrónico",
"address": "Dirección",
"city": "Ciudad",
"zipCode": "Código postal",
"country": "País",
"bio": "Descripción del perfil",
"website": "Página web",
"privateAccount": "Cuenta privada",
"subscribe": "Suscríbete a las noticias por correo electrónico"
},
"validationErrors": {
"firstNameRequired": "El campo del nombre es obligatorio",
"lastNameRequired": "El campo de los apellidos es obligatorio",
"emailRequired": "El correo electrónico es necesario",
"nameRequired": "Por favor, introduce un nombre",
"addressRequired": "La dirección es obligatoria",
"cityRequired": "La ciudad es obligatoria",
"zipCodeInvalid": "El código postal sólo debe contener letras y números",
"websiteInvalid": "Por favor, introduzca una URL válida",
"countryRequired": "El país es obligatorio",
"companyRequired": "El nombre de la empresa es obligatorio"
}
}
42 changes: 30 additions & 12 deletions public/static/locales/fr/editProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,51 @@
"loginTitle": "{{log}} - Connexion",
"signUpText": "Inscription complète",
"profileTypes": "{{item.title}}",
"profileName": "Nom de {{type}}",
"createAccount": "Créer un compte",
"individual": "Individu",
"iamA": "Je suis un",
"tpo": "Organisation de reboisement",
"education": "École",
"organization": "Société",
"profileCreated": "Profil Créé avec succès !",
"profileCreationFailed": "Erreur dans la création du profil. Veuillez réessayer.",
"profileCreationError": "Erreur dans la création du profil.",
"edit": "Modifier le profil",
"privateAccount": "Compte privé",
"privateAccountTxt": "Votre profil est caché et seul votre prénom apparaît dans le classement",
"subscribe": "S'abonner aux actualités par email",
"profileDescription": "Descriptif du profil",
"descriptionRequired": "Vous avez dépassé la longueur maximale",
"website": "Site web",
"websiteError": "URL du site web invalide",
"websiteRequired": "Veuillez entrer une URL de site web valide",
"save": "Sauvegarder",
"nameValidation": "Saisir un nom",
"profilePicUpdated": "La photo du profil est en cours d'actualisation...",
"profileSaved": "Sauvé avec succès !",
"profileSaveFailed": "Erreur dans la mise à jour du profil.",
"changeAccountToPublic": "Passer à un compte public",
"publicAccount": "Compte public",
"accountPrivacyChangeText": "Pour créer un widget de profil, vous devez avoir un compte public. En cliquant sur Continuer, vous changez vos paramètres de confidentialité en public.",
"continue": "Continuer",
"cancel": "Annuler"
}
"cancel": "Annuler",
"fieldLabels": {
"profileType": "Je suis un",
"firstName": "Prénom",
"lastName": "Nom de famille",
"name": "Nom de {{type}}",
"email": "Email",
"address": "Adresse",
"city": "Ville",
"zipCode": "Code postal/Zip",
"country": "Pays",
"bio": "Descriptif du profil",
"website": "Site web",
"privateAccount": "Compte privé",
"subscribe": "S'abonner aux actualités par email"
},
"validationErrors": {
"firstNameRequired": "Le champ Prénom est requis",
"lastNameRequired": "Le champ \"Nom\" est requis",
"emailRequired": "L'adresse électronique est requis",
"nameRequired": "Saisir un nom",
"nameInvalid": "Name is invalid. Only these special characters are allowed: space . , ' & ( ) ! -",
"addressRequired": "L'adresse est requis",
"cityRequired": "La ville est requis",
"zipCodeInvalid": "Le code postal n'est pas valide",
"websiteInvalid": "Veuillez entrer une URL de site web valide",
"countryRequired": "Le pays est requis",
"companyRequired": "Le nom de la société est obligatoire"
}
}
Loading
Loading