Merged in feat/CJ-17-points-expiration-table (pull request #527)

Feat/CJ-17 points expiration table

* feat(CJ-17): Added point expiration table and refactored to use Table component

* feat(CJ-17): Use Table component inside Row

* fix(CJ-117): Added missing css class and update date formatting

* fix(CJ-117): Added copy of membershipLevel route with a protectedProcedure


Approved-by: Christel Westerberg
This commit is contained in:
Tobias Johansson
2024-09-05 09:28:25 +00:00
parent 650b38b409
commit 238de4cd3a
20 changed files with 260 additions and 234 deletions

View File

@@ -1,27 +1,30 @@
import { getIntl } from "@/i18n"
import { serverClient } from "@/lib/trpc/server"
import styles from "./expiringPoints.module.css"
import SectionContainer from "@/components/Section/Container"
import SectionHeader from "@/components/Section/Header"
import ExpiringPointsTable from "./ExpiringPointsTable"
import { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
export default async function ExpiringPoints({
link,
subtitle,
title,
}: AccountPageComponentProps) {
const membershipLevel = await serverClient().user.membershipLevel()
if (!membershipLevel?.pointsToExpire || !membershipLevel?.pointsExpiryDate) {
return null
}
export async function ExpiringPoints() {
const { formatMessage } = await getIntl()
return (
<table className={styles.table}>
<thead className={styles.thead}>
<tr>
<th className={styles.th}>{formatMessage({ id: "Arrival date" })}</th>
<th className={styles.th}>{formatMessage({ id: "Points" })}</th>
</tr>
</thead>
<tbody>
<tr className={styles.tr}>
<td className={styles.td}>23 May 2023</td>
<td className={styles.td}>30000</td>
</tr>
<tr className={styles.tr}>
<td className={styles.td}>23 May 2023</td>
<td className={styles.td}>-15000</td>
</tr>
</tbody>
</table>
<SectionContainer>
<SectionHeader title={title} link={link} subtitle={subtitle} />
<ExpiringPointsTable
points={membershipLevel.pointsToExpire}
expirationDate={membershipLevel.pointsExpiryDate}
/>
</SectionContainer>
)
}