feat: add renewal info

This commit is contained in:
Zamitto 2025-01-16 11:32:59 -03:00
parent 81cb73c243
commit 2346a5bf86
3 changed files with 39 additions and 12 deletions

View File

@ -293,7 +293,10 @@
"renew_subscription": "Renew Hydra Cloud", "renew_subscription": "Renew Hydra Cloud",
"subscription_expired_at": "Your subscription expired at {{date}}", "subscription_expired_at": "Your subscription expired at {{date}}",
"no_subscription": "Enjoy Hydra in the best possible way", "no_subscription": "Enjoy Hydra in the best possible way",
"become_subscriber": "Be Hydra Cloud" "become_subscriber": "Be Hydra Cloud",
"subscription_renew_cancelled": "Automatic renewal is not active",
"subscription_renews_on": "Your subscription renews on {{date}}",
"bill_sent_until": "You next bill will be sent until this day"
}, },
"notifications": { "notifications": {
"download_complete": "Download complete", "download_complete": "Download complete",

View File

@ -280,8 +280,11 @@
"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", "renew_subscription": "Renovar Hydra Cloud",
"subscription_expired_at": "Sua assinatura expirou em {{date}}", "subscription_expired_at": "Sua assinatura expirou em {{date}}",
"no_subscription": "Aproveite o Hydra ao seu máximo", "no_subscription": "Aproveite o Hydra da melhor forma possível",
"become_subscriber": "Seja Hydra Cloud" "become_subscriber": "Seja Hydra Cloud",
"subscription_renew_cancelled": "A renovação automática está desativada",
"subscription_renews_on": "Sua assinatura renova dia {{date}}",
"bill_sent_until": "Sua próxima cobrança será enviada até esse dia"
}, },
"notifications": { "notifications": {
"download_complete": "Download concluído", "download_complete": "Download concluído",

View File

@ -96,27 +96,48 @@ export function SettingsAccount() {
const getHydraCloudSectionContent = () => { const getHydraCloudSectionContent = () => {
const hasSubscribedBefore = Boolean(userDetails?.subscription?.expiresAt); const hasSubscribedBefore = Boolean(userDetails?.subscription?.expiresAt);
const isRenewalActive = userDetails?.subscription?.status === "active";
if (!hasSubscribedBefore) { if (!hasSubscribedBefore) {
return { return {
description: t("no_subscription"), description: <small>{t("no_subscription")}</small>,
callToAction: t("become_subscriber"), callToAction: t("become_subscriber"),
}; };
} }
if (hasActiveSubscription) { if (hasActiveSubscription) {
return { return {
description: t("subscription_active_until", { description: isRenewalActive ? (
date: formatDate(userDetails!.subscription!.expiresAt!), <>
}), <small>
{t("subscription_renews_on", {
date: formatDate(userDetails.subscription!.expiresAt!),
})}
</small>
<small>{t("bill_sent_until")}</small>
</>
) : (
<>
<small>{t("subscription_renew_cancelled")}</small>
<small>
{t("subscription_active_until", {
date: formatDate(userDetails!.subscription!.expiresAt!),
})}
</small>
</>
),
callToAction: t("manage_subscription"), callToAction: t("manage_subscription"),
}; };
} }
return { return {
description: t("subscription_expired_at", { description: (
date: formatDate(userDetails!.subscription!.expiresAt!), <small>
}), {t("subscription_expired_at", {
date: formatDate(userDetails!.subscription!.expiresAt!),
})}
</small>
),
callToAction: t("renew_subscription"), callToAction: t("renew_subscription"),
}; };
}; };
@ -189,9 +210,9 @@ export function SettingsAccount() {
</Button> </Button>
</div> </div>
<div> <div style={{ display: "flex", flexDirection: "column" }}>
<h3 style={{ marginTop: `${SPACING_UNIT * 2}px` }}>Hydra Cloud</h3> <h3 style={{ marginTop: `${SPACING_UNIT * 2}px` }}>Hydra Cloud</h3>
<small>{getHydraCloudSectionContent().description}</small> {getHydraCloudSectionContent().description}
</div> </div>
<Button <Button