chore: add memberships "endoint"
This commit is contained in:
committed by
Michael Zetterberg
parent
f40a6d4288
commit
3e54d3c29e
@@ -8,3 +8,15 @@
|
||||
display: grid;
|
||||
gap: var(--Spacing-x1);
|
||||
}
|
||||
|
||||
.card {
|
||||
margin-top: 2rem;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-template-rows: repeat(3, auto);
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.subTitle {
|
||||
grid-column: span 2;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import { PlusCircleIcon } from "@/components/Icons"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||
@@ -8,6 +10,8 @@ import styles from "./page.module.css"
|
||||
|
||||
export default async function CreditCardSlot() {
|
||||
const { formatMessage } = await getIntl()
|
||||
const creditCards = await serverClient().user.creditCards()
|
||||
|
||||
return (
|
||||
<section className={styles.container}>
|
||||
<article className={styles.content}>
|
||||
@@ -20,6 +24,21 @@ export default async function CreditCardSlot() {
|
||||
})}
|
||||
</Body>
|
||||
</article>
|
||||
{creditCards &&
|
||||
creditCards.length > 0 &&
|
||||
creditCards.map((card, idx) => (
|
||||
<div className={styles.card} key={idx}>
|
||||
<Subtitle className={styles.subTitle}>
|
||||
Name: {card.attribute.cardName}
|
||||
</Subtitle>
|
||||
<span> Type: {card.attribute.cardType} </span>
|
||||
<span> Alias: {card.attribute.alias}</span>
|
||||
<span> Number: {card.attribute.truncatedNumber}</span>
|
||||
<span>
|
||||
Expiration Date: {card.attribute.expirationDate.split("T")[0]}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
<Link href="#" variant="icon">
|
||||
<PlusCircleIcon color="burgundy" />
|
||||
<Body color="burgundy" textTransform="underlined">
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../page"
|
||||
@@ -0,0 +1,22 @@
|
||||
.container {
|
||||
display: grid;
|
||||
gap: var(--Spacing-x3);
|
||||
max-width: 510px;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: grid;
|
||||
gap: var(--Spacing-x1);
|
||||
}
|
||||
|
||||
.card {
|
||||
margin-top: 2rem;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-template-rows: repeat(3, auto);
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.subTitle {
|
||||
grid-column: span 2;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import { PlusCircleIcon } from "@/components/Icons"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import styles from "./page.module.css"
|
||||
|
||||
export default async function MembershipCardSlot() {
|
||||
const { formatMessage } = await getIntl()
|
||||
const membershipCards = await serverClient().user.membershipCards()
|
||||
|
||||
return (
|
||||
<section className={styles.container}>
|
||||
<article className={styles.content}>
|
||||
<Subtitle color="black">
|
||||
{formatMessage({ id: "My membership cards" })}
|
||||
</Subtitle>
|
||||
</article>
|
||||
{membershipCards &&
|
||||
membershipCards.length > 0 &&
|
||||
membershipCards.map((card, idx) => (
|
||||
<div className={styles.card} key={idx}>
|
||||
<Subtitle className={styles.subTitle}>
|
||||
Name: {card.membershipType}
|
||||
</Subtitle>
|
||||
<span> Current Points: {card.currentPoints} </span>
|
||||
<span> Member Since: {card.memberSince}</span>
|
||||
<span> Number: {card.membershipNumber}</span>
|
||||
<span>Expiration Date: {card.expirationDate.split("T")[0]}</span>
|
||||
</div>
|
||||
))}
|
||||
<Link href="#" variant="icon">
|
||||
<PlusCircleIcon color="burgundy" />
|
||||
<Body color="burgundy" textTransform="underlined">
|
||||
{formatMessage({ id: "Add new card" })}
|
||||
</Body>
|
||||
</Link>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -6,6 +6,7 @@ export default function ProfileLayout({
|
||||
children,
|
||||
communication,
|
||||
creditCards,
|
||||
membershipCards,
|
||||
profile,
|
||||
}: React.PropsWithChildren<ProfileLayoutProps>) {
|
||||
return (
|
||||
@@ -14,6 +15,7 @@ export default function ProfileLayout({
|
||||
<section className="profile-layout">
|
||||
{profile}
|
||||
{creditCards}
|
||||
{membershipCards}
|
||||
<Divider color="burgundy" opacity={8} />
|
||||
{communication}
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user