From 5889b1e66aa5b73586ab54e51edbdcdd2e276c5c Mon Sep 17 00:00:00 2001 From: Joshua <62268199+minimalsm@users.noreply.github.com> Date: Sun, 20 Jul 2025 14:36:17 +0100 Subject: [PATCH 1/3] If currently held, dont show to time (defaults to same time) --- app/[locale]/10years/_components/TorchHistoryCard.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/[locale]/10years/_components/TorchHistoryCard.tsx b/app/[locale]/10years/_components/TorchHistoryCard.tsx index 6b8c259a245..7896084d8cf 100644 --- a/app/[locale]/10years/_components/TorchHistoryCard.tsx +++ b/app/[locale]/10years/_components/TorchHistoryCard.tsx @@ -74,7 +74,10 @@ const TorchHistoryCard: React.FC = ({ {!isPlaceholder && ( <>
- From {formatDate(from)} to {formatDate(to)} + {isCurrentHolder + ? `From ${formatDate(from)}` + : `From ${formatDate(from)} to ${formatDate(to)}` + }
Date: Sun, 20 Jul 2025 14:41:41 +0100 Subject: [PATCH 2/3] improve coming soon ui --- .../_components/TorchHistorySwiper/index.tsx | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/app/[locale]/10years/_components/TorchHistorySwiper/index.tsx b/app/[locale]/10years/_components/TorchHistorySwiper/index.tsx index 441086dac9b..dc0216b6ea8 100644 --- a/app/[locale]/10years/_components/TorchHistorySwiper/index.tsx +++ b/app/[locale]/10years/_components/TorchHistorySwiper/index.tsx @@ -19,6 +19,22 @@ type TorchHistorySwiperProps = { currentHolderAddress: Address | null } +const getOrdinalSuffix = (num: number): string => { + const lastDigit = num % 10; + const lastTwoDigits = num % 100; + + if (lastTwoDigits >= 11 && lastTwoDigits <= 13) { + return `${num}th`; + } + + switch (lastDigit) { + case 1: return `${num}st`; + case 2: return `${num}nd`; + case 3: return `${num}rd`; + default: return `${num}th`; + } +}; + const TorchHistorySwiper = ({ holders, currentHolderAddress, @@ -40,8 +56,8 @@ const TorchHistorySwiper = ({ // Create placeholder for future holder return { address: `placeholder-${index}` as Address, - name: `Future Bearer ${index + 1}`, - role: "Coming soon...", + name: `Torchbearer ${index + 1}`, + role: `Coming ${getOrdinalSuffix(20 + index)}!`, twitter: "", event: { from: "0x0000000000000000000000000000000000000000" as Address, @@ -105,4 +121,4 @@ const TorchHistorySwiper = ({ ) } -export default TorchHistorySwiper +export default TorchHistorySwiper \ No newline at end of file From 0a7d308c336c3d2c8eb5b43a5924d5611d056fe7 Mon Sep 17 00:00:00 2001 From: Joshua <62268199+minimalsm@users.noreply.github.com> Date: Mon, 21 Jul 2025 09:52:20 +0100 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: wackerow <54227730+wackerow@users.noreply.github.com> --- .../_components/TorchHistorySwiper/index.tsx | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/app/[locale]/10years/_components/TorchHistorySwiper/index.tsx b/app/[locale]/10years/_components/TorchHistorySwiper/index.tsx index dc0216b6ea8..a7284a62dbf 100644 --- a/app/[locale]/10years/_components/TorchHistorySwiper/index.tsx +++ b/app/[locale]/10years/_components/TorchHistorySwiper/index.tsx @@ -20,20 +20,16 @@ type TorchHistorySwiperProps = { } const getOrdinalSuffix = (num: number): string => { - const lastDigit = num % 10; - const lastTwoDigits = num % 100; + const pr = new Intl.PluralRules('en', { type: 'ordinal' }); + const rule = pr.select(num); - if (lastTwoDigits >= 11 && lastTwoDigits <= 13) { - return `${num}th`; - } - - switch (lastDigit) { - case 1: return `${num}st`; - case 2: return `${num}nd`; - case 3: return `${num}rd`; + switch (rule) { + case "one": return `${num}st`; + case "two": return `${num}nd`; + case "few": return `${num}rd`; default: return `${num}th`; } -}; +} const TorchHistorySwiper = ({ holders, @@ -57,7 +53,7 @@ const TorchHistorySwiper = ({ return { address: `placeholder-${index}` as Address, name: `Torchbearer ${index + 1}`, - role: `Coming ${getOrdinalSuffix(20 + index)}!`, + role: `Coming July ${getOrdinalSuffix(20 + index)}!`, twitter: "", event: { from: "0x0000000000000000000000000000000000000000" as Address,