77 lines
2.1 KiB
TypeScript
77 lines
2.1 KiB
TypeScript
import Body from "@/components/TempDesignSystem/Text/Body"
|
|
import { getIntl } from "@/i18n"
|
|
|
|
import Row from "./Row"
|
|
|
|
import styles from "./desktop.module.css"
|
|
|
|
import type { TableProps } from "@/types/components/myPages/myPage/earnAndBurn"
|
|
|
|
const tableHeadings = [
|
|
"Arrival date",
|
|
"Description",
|
|
"Booking number",
|
|
"Transaction date",
|
|
"Points",
|
|
]
|
|
|
|
export default async function DesktopTable({ transactions }: TableProps) {
|
|
const { formatMessage } = await getIntl()
|
|
return (
|
|
<div className={styles.container}>
|
|
{transactions.length ? (
|
|
<table className={styles.table}>
|
|
<thead className={styles.thead}>
|
|
<tr>
|
|
{tableHeadings.map((heading) => (
|
|
<th key={heading} className={styles.th}>
|
|
<Body textTransform="bold">
|
|
{formatMessage({ id: heading })}
|
|
</Body>
|
|
</th>
|
|
))}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{transactions.map((transaction) => (
|
|
<Row
|
|
key={transaction.confirmationNumber}
|
|
transaction={transaction}
|
|
/>
|
|
))}
|
|
</tbody>
|
|
</table>
|
|
) : (
|
|
// TODO: add once pagination is available through API
|
|
// <Button
|
|
// disabled={isFetching}
|
|
// intent="primary"
|
|
// bgcolor="white"
|
|
// type="button"
|
|
// onClick={loadMoreData}
|
|
// >
|
|
// {formatMessage({id:"See more transactions"})}
|
|
// </Button>
|
|
<table className={styles.table}>
|
|
<thead className={styles.thead}>
|
|
<tr>
|
|
{tableHeadings.map((heading) => (
|
|
<th key={heading} className={styles.th}>
|
|
{heading}
|
|
</th>
|
|
))}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td colSpan={tableHeadings.length} className={styles.placeholder}>
|
|
{formatMessage({ id: "No transactions available" })}
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|