fix(SW-315): formatting numbers via locale, fixed a few padding issues
This commit is contained in:
@@ -4,7 +4,6 @@ import { dt } from "@/lib/dt"
|
||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
import { formatNumber } from "@/utils/format"
|
||||
import { getMembership } from "@/utils/user"
|
||||
|
||||
import type { UserProps } from "@/types/components/myPages/user"
|
||||
@@ -27,7 +26,7 @@ export default async function ExpiringPoints({ user }: UserProps) {
|
||||
{intl.formatMessage(
|
||||
{ id: "spendable points expiring by" },
|
||||
{
|
||||
points: formatNumber(membership.pointsToExpire),
|
||||
points: intl.formatNumber(membership.pointsToExpire),
|
||||
date: d.format(dateFormat),
|
||||
}
|
||||
)}
|
||||
|
||||
@@ -44,7 +44,16 @@ async function PointsColumn({
|
||||
title,
|
||||
subtitle,
|
||||
}: PointsColumnProps) {
|
||||
const { formatMessage } = await getIntl()
|
||||
const { formatMessage, formatNumber } = await getIntl()
|
||||
|
||||
function number() {
|
||||
if (typeof points === "number") {
|
||||
return formatNumber(points)
|
||||
} else if (typeof nights === "number") {
|
||||
return formatNumber(nights)
|
||||
}
|
||||
return "N/A"
|
||||
}
|
||||
|
||||
return (
|
||||
<article className={styles.article}>
|
||||
@@ -59,7 +68,7 @@ async function PointsColumn({
|
||||
})}
|
||||
</Body>
|
||||
<Title color="white" level="h2" textAlign="center">
|
||||
{points ?? nights ?? "N/A"}
|
||||
{number()}
|
||||
</Title>
|
||||
{subtitle ? (
|
||||
<Body color="white" textAlign="center">
|
||||
|
||||
Reference in New Issue
Block a user