Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/[locale]/10years/_components/TorchHistoryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ const TorchHistoryCard: React.FC<TorchHistoryCardProps> = ({
{!isPlaceholder && (
<>
<div className="text-xs text-gray-500">
From {formatDate(from)} to {formatDate(to)}
{isCurrentHolder
? `From ${formatDate(from)}`
: `From ${formatDate(from)} to ${formatDate(to)}`
}
</div>
<BaseLink
href={getTxEtherscanUrl(transactionHash)}
Expand Down
18 changes: 15 additions & 3 deletions app/[locale]/10years/_components/TorchHistorySwiper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ type TorchHistorySwiperProps = {
currentHolderAddress: Address | null
}

const getOrdinalSuffix = (num: number): string => {
const pr = new Intl.PluralRules('en', { type: 'ordinal' });
const rule = pr.select(num);

switch (rule) {
case "one": return `${num}st`;
case "two": return `${num}nd`;
case "few": return `${num}rd`;
default: return `${num}th`;
}
}

const TorchHistorySwiper = ({
holders,
currentHolderAddress,
Expand All @@ -40,8 +52,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 July ${getOrdinalSuffix(20 + index)}!`,
twitter: "",
event: {
from: "0x0000000000000000000000000000000000000000" as Address,
Expand Down Expand Up @@ -105,4 +117,4 @@ const TorchHistorySwiper = ({
)
}

export default TorchHistorySwiper
export default TorchHistorySwiper