diff --git a/apps/web/src/app/[locale]/events/[slug]/page.tsx b/apps/web/src/app/[locale]/events/[slug]/page.tsx index 2bcab90..b7a1bae 100644 --- a/apps/web/src/app/[locale]/events/[slug]/page.tsx +++ b/apps/web/src/app/[locale]/events/[slug]/page.tsx @@ -359,18 +359,27 @@ async function SignUpQuotas({ event }: { event: IlmomasiinaEvent }) { ) : ( <> {quota.title} -
- - - {Math.min(quota.signupCount ?? 0, quota.size)} /{" "} - {quota.size} - -
+ {typeof quota.size === "number" ? ( +
+ + + {Math.min(quota.signupCount ?? 0, quota.size)} /{" "} + {quota.size} + +
+ ) : ( +
+ + + {quota.signupCount} + +
+ )} )} diff --git a/apps/web/src/app/[locale]/signups/[signupId]/[signupEditToken]/page.tsx b/apps/web/src/app/[locale]/signups/[signupId]/[signupEditToken]/page.tsx index 67d321d..7c75183 100644 --- a/apps/web/src/app/[locale]/signups/[signupId]/[signupEditToken]/page.tsx +++ b/apps/web/src/app/[locale]/signups/[signupId]/[signupEditToken]/page.tsx @@ -1,3 +1,4 @@ +/* eslint-disable no-nested-ternary -- I like */ import { notFound } from "next/navigation"; import { getSignup } from "../../../../../lib/api/external/ilmomasiina"; import { openGraphImage } from "../../../../shared-metadata"; @@ -64,14 +65,19 @@ export default async function Page({ ? t("You are in queue at position {position}", { position: signupInfo.data.signup.position, }) - : t( - "You are in the quota {quotaName} at position {position}/{quotaSize}", - { + : typeof signupInfo.data.signup.quota.size === "number" + ? t( + "You are in the quota {quotaName} at position {position}/{quotaSize}", + { + quotaName: signupInfo.data.signup.quota.title, + position: signupInfo.data.signup.position, + quotaSize: signupInfo.data.signup.quota.size, + }, + ) + : t("You are in the quota {quotaName} at position {position}", { quotaName: signupInfo.data.signup.quota.title, position: signupInfo.data.signup.position, - quotaSize: signupInfo.data.signup.quota.size, - }, - )} + })}

acc + (quota.signupCount ?? 0), 0, ); - const totalSize = quotas.reduce((acc, quota) => acc + quota.size, 0); + const totalSize = quotas.reduce((acc, quota) => acc + (quota.size ?? 0), 0); const isSingleQuota = quotas.length === 1; @@ -107,9 +107,13 @@ async function SignupQuotas({ key={quota.id} > {quota.title}{" "} - - {quota.signupCount} / {quota.size} - + {typeof quota.size === "number" ? ( + + {quota.signupCount} / {quota.size} + + ) : ( + {quota.signupCount} + )} ))} diff --git a/apps/web/src/lib/api/external/ilmomasiina/index.ts b/apps/web/src/lib/api/external/ilmomasiina/index.ts index fe39ded..3e084b5 100644 --- a/apps/web/src/lib/api/external/ilmomasiina/index.ts +++ b/apps/web/src/lib/api/external/ilmomasiina/index.ts @@ -51,7 +51,7 @@ export interface EventQuestion { export interface EventQuota { id: string; title: string; - size: number; + size?: number | null; signupCount?: number; signups?: QuotaSignup[] | null; } diff --git a/apps/web/src/locales/en.ts b/apps/web/src/locales/en.ts index 884f39b..a1b08a6 100644 --- a/apps/web/src/locales/en.ts +++ b/apps/web/src/locales/en.ts @@ -68,6 +68,8 @@ const en = { "invoicegenerator.Invoicer information": "Invoicer information", "ilmomasiina.form.You are in queue at position {position}": "You are in queue at position {position}.", + "ilmomasiina.form.You are in the quota {quotaName} at position {position}": + "You are in the quota {quotaName} at position {position}.", "ilmomasiina.form.You are in the quota {quotaName} at position {position}/{quotaSize}": "You are in the quota {quotaName} at position {position}/{quotaSize}.", "ilmomasiina.form.fieldError.missing": "This field is required.", diff --git a/apps/web/src/locales/fi.ts b/apps/web/src/locales/fi.ts index 5e36274..d5cb7ab 100644 --- a/apps/web/src/locales/fi.ts +++ b/apps/web/src/locales/fi.ts @@ -68,6 +68,8 @@ const fi = { "invoicegenerator.Invoicer information": "Laskuttajan tiedot", "ilmomasiina.form.You are in queue at position {position}": "Olet jonossa sijalla {position}.", + "ilmomasiina.form.You are in the quota {quotaName} at position {position}": + "Olet kiintiössä {quotaName} sijalla {position}.", "ilmomasiina.form.You are in the quota {quotaName} at position {position}/{quotaSize}": "Olet kiintiössä {quotaName} sijalla {position}/{quotaSize}.", "ilmomasiina.form.fieldError.missing": "Tämä kenttä on pakollinen.",