diff --git a/src/Components/ProductsPage/ViewManager.tsx b/src/Components/ProductsPage/ViewManager.tsx new file mode 100644 index 0000000..0ef4659 --- /dev/null +++ b/src/Components/ProductsPage/ViewManager.tsx @@ -0,0 +1,27 @@ +import * as React from "react"; +import { useState } from "react"; +import { Switch } from "@mui/material"; +import TableView from "../../Components/ProductsPage/TableView/TableView"; +import BlobView from "../../Components/ProductsPage/BlobView/BlobView"; +import { ProductList } from "../../Interfaces/Interfaces"; + +export interface props {} + +export default function ViewManager(props: ProductList) { + const [tableView, toggleTableView] = useState(false); + if (tableView) { + return ( +
+ toggleTableView(!tableView)} /> + +
+ ); + } else { + return ( +
+ toggleTableView(!tableView)} /> + +
+ ); + } +} diff --git a/src/Routes/Logs/Logs.tsx b/src/Routes/Logs/Logs.tsx index 7650b5b..ea53b52 100644 --- a/src/Routes/Logs/Logs.tsx +++ b/src/Routes/Logs/Logs.tsx @@ -12,18 +12,11 @@ import { import { SampleLogData } from "../../Components/SampleData/SampleData"; export default function Logs() { - function change_color(amount: number) { - if (amount > 0) { - return {amount}; - } else { - return {amount}; - } - } return (
-

Logs

+

Logs

- Log ID - Product ID - Product - Amount Change - Timestamp + + Log ID + + + Product ID + + + Product + + + Amount Change + + + Timestamp + @@ -47,11 +50,28 @@ export default function Logs() { key={row.id} sx={{ "&:last-child td, &:last-child th": { border: 0 } }} > - {row.id} - {row.p_id} - {row.p_name} - {change_color(row.amount_changed)} - {row.timestamp} + + {row.id} + + + {row.p_id} + + + {row.p_name} + + + {row.amount_changed} + + + {row.timestamp} + ))} diff --git a/src/Routes/Products/Products.tsx b/src/Routes/Products/Products.tsx index 916da6f..03162d3 100644 --- a/src/Routes/Products/Products.tsx +++ b/src/Routes/Products/Products.tsx @@ -3,21 +3,12 @@ import styles from "../../styles"; import { useNavigate } from "react-router-dom"; import ProductsIcon from "../../Components/Icons/ProductsIcon/ProductsIcon"; import AddIcon from "../../Components/Icons/AddIcon/AddIcon"; -import { Button, Switch } from "@mui/material"; +import { Button } from "@mui/material"; import { SampleProducts } from "../../Components/SampleData/SampleData"; -import TableView from "../../Components/ProductsPage/TableView/TableView"; -import BlobView from "../../Components/ProductsPage/BlobView/BlobView"; +import ViewManager from "../../Components/ProductsPage/ViewManager"; export default function Products() { const navigate = useNavigate(); - const [tableView, toggleTableView] = useState(false); - function view() { - if (tableView) { - return ; - } else { - return ; - } - } return (
@@ -31,10 +22,9 @@ export default function Products() {
- toggleTableView(!tableView)} />
- - {view()} +
); }