source: frontend/src/routes/user/user-payments.jsx@ badbc79

Last change on this file since badbc79 was badbc79, checked in by Luka Cheshlarov <luka.cheshlarov@…>, 20 months ago

Initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1import React from "react";
2import {Grid, Typography} from "@mui/material";
3import {Navigate, useLoaderData, useParams} from "react-router-dom";
4import {useAuthContext} from "../../configurations/AuthContext";
5import PaymentCard from "../../components/cards/payment-card";
6
7const UserPayments = () => {
8 const {loggedUserRole} = useAuthContext();
9 const {payments} = useLoaderData();
10 const {userId} = useParams();
11
12 return (loggedUserRole?.roleId != userId ? <Navigate to={"/"}/> :
13 <Grid container direction={"column"} justify={"center"} alignItems={"center"}>
14 <Typography className={"mt-3"} variant={"h3"}>
15 Transaction History
16 </Typography>
17
18 <hr className={"horizontal-fancy"}/>
19
20 <Grid container rowGap={3} rowSpacing={5} direction={"row"} justifyContent={"start"}>
21 {payments &&
22 payments.length > 0 &&
23 payments.map((payment) => (
24 <Grid key={payment.id} item md={4} className={"m-3"}>
25 <PaymentCard payment={payment}/>
26 </Grid>
27 ))}
28 </Grid>
29 </Grid>
30 )
31}
32
33export default UserPayments;
Note: See TracBrowser for help on using the repository browser.