From 74edc6c6794d8af831eb5657e9ddf6aac2231e81 Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Fri, 12 Sep 2025 18:34:45 +0300 Subject: [PATCH] add user consent url --- .../_components/update-account-form.tsx | 45 ++++++++++++------- public/locales/en/account.json | 3 +- public/locales/et/account.json | 3 +- public/locales/ru/account.json | 3 +- 4 files changed, 35 insertions(+), 19 deletions(-) diff --git a/app/auth/update-account/_components/update-account-form.tsx b/app/auth/update-account/_components/update-account-form.tsx index b807745..bccfd87 100644 --- a/app/auth/update-account/_components/update-account-form.tsx +++ b/app/auth/update-account/_components/update-account-form.tsx @@ -1,13 +1,14 @@ 'use client'; import Link from 'next/link'; -import { useTranslation } from 'react-i18next'; import { useRouter } from 'next/navigation'; -import { z } from 'zod'; +import { pathsConfig } from '@/packages/shared/src/config'; import { ExternalLink } from '@/public/assets/external-link'; import { zodResolver } from '@hookform/resolvers/zod'; import { useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { z } from 'zod'; import { Button } from '@kit/ui/button'; import { Checkbox } from '@kit/ui/checkbox'; @@ -20,21 +21,22 @@ import { FormMessage, } from '@kit/ui/form'; import { Input } from '@kit/ui/input'; +import { toast } from '@kit/ui/sonner'; import { Trans } from '@kit/ui/trans'; import { UpdateAccountSchemaClient } from '../_lib/schemas/update-account.schema'; import { onUpdateAccount } from '../_lib/server/update-account'; -import { toast } from '@kit/ui/sonner'; -import { pathsConfig } from '@/packages/shared/src/config'; -type UpdateAccountFormValues = z.infer>; +type UpdateAccountFormValues = z.infer< + ReturnType +>; export function UpdateAccountForm({ defaultValues, isEmailUser, }: { - defaultValues: UpdateAccountFormValues, - isEmailUser: boolean, + defaultValues: UpdateAccountFormValues; + isEmailUser: boolean; }) { const router = useRouter(); const { t } = useTranslation('account'); @@ -45,10 +47,13 @@ export function UpdateAccountForm({ defaultValues, }); - const { firstName, lastName, personalCode, email, userConsent } = defaultValues; + const { firstName, lastName, personalCode, email, userConsent } = + defaultValues; - const defaultValues_weight = "weight" in defaultValues ? defaultValues.weight : null; - const defaultValues_height = "height" in defaultValues ? defaultValues.height : null; + const defaultValues_weight = + 'weight' in defaultValues ? defaultValues.weight : null; + const defaultValues_height = + 'height' in defaultValues ? defaultValues.height : null; const hasFirstName = !!firstName; const hasLastName = !!lastName; @@ -64,8 +69,12 @@ export function UpdateAccountForm({ personalCode: values.personalCode || personalCode, email: values.email || email, phone: values.phone, - weight: ((("weight" in values && values.weight) ?? defaultValues_weight) || null) as number, - height: ((("height" in values && values.height) ?? defaultValues_height) || null) as number, + weight: ((('weight' in values && values.weight) ?? + defaultValues_weight) || + null) as number, + height: ((('height' in values && values.height) ?? + defaultValues_height) || + null) as number, userConsent: values.userConsent ?? userConsent, city: values.city, }); @@ -81,7 +90,7 @@ export function UpdateAccountForm({ router.push(pathsConfig.app.selectPackage); } } catch (error) { - console.info("promiseresult error", error); + console.info('promiseresult error', error); toast.error(t('updateAccount.updateAccountError')); toast.dismiss(loading); } @@ -205,7 +214,9 @@ export function UpdateAccountForm({ value={field.value ?? ''} onChange={(e) => field.onChange( - e.target.value === '' ? null : Number(e.target.value), + e.target.value === '' + ? null + : Number(e.target.value), ) } /> @@ -230,7 +241,9 @@ export function UpdateAccountForm({ value={field.value ?? ''} onChange={(e) => field.onChange( - e.target.value === '' ? null : Number(e.target.value), + e.target.value === '' + ? null + : Number(e.target.value), ) } /> @@ -260,7 +273,7 @@ export function UpdateAccountForm({ diff --git a/public/locales/en/account.json b/public/locales/en/account.json index 2872ede..e101985 100644 --- a/public/locales/en/account.json +++ b/public/locales/en/account.json @@ -131,6 +131,7 @@ "button": "Continue", "userConsentLabel": "I agree to the use of personal data on the platform", "userConsentUrlTitle": "View privacy policy", + "userConsentUrlPath": "https://medreport.ee/privaatsustingimused/", "updateAccountLoading": "Updating account details...", "updateAccountSuccess": "Account details updated", "updateAccountError": "Updating account details error" @@ -169,4 +170,4 @@ "updateAccountPreferencesSuccess": "Account preferences updated", "updateAccountPreferencesError": "Updating account preferences failed", "consents": "Consents" -} \ No newline at end of file +} diff --git a/public/locales/et/account.json b/public/locales/et/account.json index 86b36e3..bb89f86 100644 --- a/public/locales/et/account.json +++ b/public/locales/et/account.json @@ -131,6 +131,7 @@ "button": "Jätka", "userConsentLabel": "Nõustun isikuandmete kasutamisega platvormil", "userConsentUrlTitle": "Vaata isikuandmete töötlemise põhimõtteid", + "userConsentUrlPath": "https://medreport.ee/privaatsustingimused/", "updateAccountLoading": "Konto andmed uuendatakse...", "updateAccountSuccess": "Konto andmed uuendatud", "updateAccountError": "Konto andmete uuendamine ebaõnnestus" @@ -169,4 +170,4 @@ "updateAccountPreferencesSuccess": "Konto eelistused uuendatud", "updateAccountPreferencesError": "Konto eelistused uuendamine ebaõnnestus", "consents": "Nõusolekud" -} \ No newline at end of file +} diff --git a/public/locales/ru/account.json b/public/locales/ru/account.json index bb3785b..9eca7c0 100644 --- a/public/locales/ru/account.json +++ b/public/locales/ru/account.json @@ -131,6 +131,7 @@ "button": "Продолжить", "userConsentLabel": "Я согласен на использование персональных данных на платформе", "userConsentUrlTitle": "Посмотреть политику конфиденциальности", + "userConsentUrlPath": "https://medreport.ee/privaatsustingimused/", "updateAccountLoading": "Обновление данных аккаунта...", "updateAccountSuccess": "Данные аккаунта обновлены", "updateAccountError": "Не удалось обновить данные аккаунта" @@ -169,4 +170,4 @@ "updateAccountPreferencesSuccess": "Предпочтения аккаунта обновлены", "updateAccountPreferencesError": "Не удалось обновить предпочтения аккаунта", "consents": "Согласия" -} \ No newline at end of file +}