From bc2ee2dc4ca8c27f4a7187976bad66a1ae71f611 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Thu, 16 Jan 2025 01:12:34 -0300 Subject: [PATCH] feat: texts and layout --- src/locales/en/translation.json | 10 ++- src/locales/pt-BR/translation.json | 10 ++- .../src/pages/settings/settings-account.tsx | 84 ++++++++++--------- 3 files changed, 58 insertions(+), 46 deletions(-) diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 3f3bd3ef..e894727c 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -283,16 +283,18 @@ "show_hidden_achievement_description": "Show hidden achievements description before unlocking them", "account": "Account", "no_users_blocked": "You have no blocked users", - "subscription": "Hydra Cloud subscription", - "subscription_active_until": "Your Hydra Cloud is active until {{date}}", + "subscription_active_until": "Enjoy your Hydra Cloud until {{date}}", "subscription_not_active": "You don't have an active Hydra Cloud subscription", - "manage_account": "Manage account", "manage_subscription": "Manage subscription", "update_email": "Update email", "update_password": "Update password", "current_email": "Current email:", "no_email_account": "You have not set an email yet", - "account_data_updated_successfully": "Account data updated successfully" + "account_data_updated_successfully": "Account data updated successfully", + "renew_subscription": "Renew Hydra Cloud", + "subscription_expired_at": "Your subscription expired at {{date}}", + "no_subscription": "Enjoy Hydra in the best possible way", + "become_subscriber": "Be Hydra Cloud" }, "notifications": { "download_complete": "Download complete", diff --git a/src/locales/pt-BR/translation.json b/src/locales/pt-BR/translation.json index 26e2d590..8f22f5c2 100644 --- a/src/locales/pt-BR/translation.json +++ b/src/locales/pt-BR/translation.json @@ -271,16 +271,18 @@ "show_hidden_achievement_description": "Mostrar descrição de conquistas ocultas antes de debloqueá-las", "account": "Conta", "no_users_blocked": "Você não bloqueou nenhum usuário", - "subscription": "Assinatura Hydra Cloud", - "subscription_active_until": "Seu Hydra Cloud ficará ativo até {{date}}", + "subscription_active_until": "Aproveite seu Hydra Cloud até {{date}}", "subscription_not_active": "Você não possui uma assinatura Hydra Cloud ativa", - "manage_account": "Gerenciar conta", "manage_subscription": "Gerenciar assinatura", "update_email": "Atualizar email", "update_password": "Atualizar senha", "current_email": "Email atual:", "no_email_account": "Você ainda não adicionou um email a sua conta", - "account_data_updated_successfully": "Dados da conta atualizados com sucesso" + "account_data_updated_successfully": "Dados da conta atualizados com sucesso", + "renew_subscription": "Renovar Hydra Cloud", + "subscription_expired_at": "Sua assinatura expirou em {{date}}", + "no_subscription": "Aproveite o Hydra ao seu máximo", + "become_subscriber": "Seja Hydra Cloud" }, "notifications": { "download_complete": "Download concluído", diff --git a/src/renderer/src/pages/settings/settings-account.tsx b/src/renderer/src/pages/settings/settings-account.tsx index 3ca7152e..79303703 100644 --- a/src/renderer/src/pages/settings/settings-account.tsx +++ b/src/renderer/src/pages/settings/settings-account.tsx @@ -39,6 +39,7 @@ export function SettingsAccount() { const { userDetails, + hasActiveSubscription, patchUser, fetchUserDetails, updateUserDetails, @@ -93,6 +94,35 @@ export function SettingsAccount() { [unblockUser, fetchBlockedUsers, t, showSuccessToast] ); + const getHydraCloudSectionContent = () => { + const hasSubscribedBefore = Boolean(userDetails?.subscription?.expiresAt); + + if (!hasSubscribedBefore) { + return { + description: t("no_subscription"), + callToAction: t("become_subscriber"), + }; + } + + if (hasActiveSubscription) { + return { + description: t("subscription_active_until", { + date: formatDate(userDetails!.subscription!.expiresAt!), + }), + callToAction: t("manage_subscription"), + }; + } + + return { + description: t("subscription_expired_at", { + date: formatDate(userDetails!.subscription!.expiresAt!), + }), + callToAction: t("renew_subscription"), + }; + }; + + if (!userDetails) return null; + return (