From 2a70143050f214a3f0e22492ac582e464624222e Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Sat, 11 Nov 2023 12:45:16 +0000 Subject: [PATCH] upgrade: Show user/month plurals based on their count. --- templates/corporate/upgrade.html | 6 ++++-- web/src/billing/upgrade.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/templates/corporate/upgrade.html b/templates/corporate/upgrade.html index e51bfee73a..88c97e74fa 100644 --- a/templates/corporate/upgrade.html +++ b/templates/corporate/upgrade.html @@ -90,8 +90,10 @@ {% else %} {{ seat_count }} {% endif %} - users x - month + + {{ 'user' if seat_count == 1 else 'users' }} + x +

$

diff --git a/web/src/billing/upgrade.ts b/web/src/billing/upgrade.ts index 7951cc8c07..55faff44ab 100644 --- a/web/src/billing/upgrade.ts +++ b/web/src/billing/upgrade.ts @@ -27,7 +27,7 @@ export const initialize = (): void => { if (schedule === "monthly") { num_months = 1; } - $("#due-today .due-today-duration").text(num_months); + $("#due-today .due-today-duration").text(num_months === 1 ? "1 month" : "12 months"); const schedule_typed = helpers.schedule_schema.parse(schedule); $(".due-today-price").text( helpers.format_money(current_license_count * prices[schedule_typed]), @@ -59,6 +59,13 @@ export const initialize = (): void => { return; } $("#due-today .due-today-license-count").text(license_count); + const $user_plural = $("#due-today .due-today-license-count-user-plural"); + if (license_count === 1) { + $user_plural.text("user"); + } else { + $user_plural.text("users"); + } + current_license_count = license_count; update_due_today(selected_schedule); });