From 9f870319b4f093cb4ed3f1d3c4671a23729b2615 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Fri, 29 Dec 2023 17:44:29 +0800 Subject: [PATCH] Refactor filter menu to be usable by all user types and added initial content for teacher dashboard --- .../Student/StudentTransactionListView.tsx | 4 +- .../Teacher/TeacherTransactionListView.tsx | 67 +++++++++++++++++++ ...lterMenu.tsx => TransactionFilterMenu.tsx} | 6 +- src/Components/Drawer/Drawer.tsx | 4 +- src/Pages/DashboardPage/DashboardPage.tsx | 3 +- 5 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 src/Components/DashboardPage/Teacher/TeacherTransactionListView.tsx rename src/Components/DashboardPage/{Student/StudentTransactionFilterMenu.tsx => TransactionFilterMenu.tsx} (98%) diff --git a/src/Components/DashboardPage/Student/StudentTransactionListView.tsx b/src/Components/DashboardPage/Student/StudentTransactionListView.tsx index ddc7d62..3abe5eb 100644 --- a/src/Components/DashboardPage/Student/StudentTransactionListView.tsx +++ b/src/Components/DashboardPage/Student/StudentTransactionListView.tsx @@ -4,7 +4,7 @@ import styles from "../../../styles"; import CircularProgress from "@mui/material/CircularProgress/CircularProgress"; import React, { useState } from "react"; import TransactionEntry from "../../TransactionEntry/TransactionEntry"; -import StudentTransactionFilterMenu from "./StudentTransactionFilterMenu"; +import TransactionFilterMenu from "../TransactionFilterMenu"; export default function StudentTransactionListView() { const transactions = useQuery({ @@ -39,7 +39,7 @@ export default function StudentTransactionListView() { return (
- +
+ +

+ Loading +

+
+ ); + } + return ( +
+
+ +
+
+ {transactions.data ? ( + transactions.data + .filter((transaction) => + filter !== "" ? transaction.transaction_status == filter : true + ) + .map((transaction) => ( + + + + )) + ) : ( + <> + )} +
+
+
+ ); +} diff --git a/src/Components/DashboardPage/Student/StudentTransactionFilterMenu.tsx b/src/Components/DashboardPage/TransactionFilterMenu.tsx similarity index 98% rename from src/Components/DashboardPage/Student/StudentTransactionFilterMenu.tsx rename to src/Components/DashboardPage/TransactionFilterMenu.tsx index be58c39..d791f16 100644 --- a/src/Components/DashboardPage/Student/StudentTransactionFilterMenu.tsx +++ b/src/Components/DashboardPage/TransactionFilterMenu.tsx @@ -1,4 +1,4 @@ -import styles from "../../../styles"; +import styles from "../../styles"; import { Button, FormControl, @@ -22,7 +22,7 @@ type props = { setFilter: React.Dispatch>; }; -export default function StudentTransactionFilterMenu(props: props) { +export default function TransactionFilterMenu(props: props) { return ( <>

- Personal Transactions + Transactions

@@ -32,7 +33,7 @@ export default function Dashboard() {
-

Welcome teacher!

+
);