Skip to content

Commit

Permalink
Merge pull request #140 from simplitrac/addspinnertoedit-and-fix-hamb…
Browse files Browse the repository at this point in the history
…urger

added spinner to EditTransactionsPage
  • Loading branch information
anpaulan authored Sep 9, 2024
2 parents c6e4ea8 + f3b5b53 commit e0a0629
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 4 deletions.
4 changes: 2 additions & 2 deletions client/src/components/Chart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useState, useContext } from 'react';
import BackButton from "./BackButton.jsx";
import { auth, onAuthStateChanged } from "../config/initializeFirestore.js";
import '../App.css';
import HamburgerMenu from "./HamburgerMenu.jsx";
import HamburgerMenuEdit from "./HamburgerMenuEdit.jsx";
import { AppContext } from '../context/AppContext.jsx';
import ExpenseChartJoyride from './ExpenseChartJoyride.jsx';

Expand Down Expand Up @@ -47,7 +47,7 @@ function App() {
<div className="App">
< ExpenseChartJoyride />
<h1>SimpliTrac</h1>
<HamburgerMenu />
<HamburgerMenuEdit />
<LookerStudioChart dimensions={dimensions} userEmail={userEmail} />
<BackButton />
</div>
Expand Down
6 changes: 4 additions & 2 deletions client/src/components/EditTransactionsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import BackButton from "./BackButton.jsx";
import '../App.css';
import { Button } from "@chakra-ui/react";
import EditTransactionsJoyride from './EditTransactionJoyride.jsx';
import HamburgerMenu from "./HamburgerMenu.jsx";
import HamburgerMenuEdit from "./HamburgerMenuEdit.jsx";
import { Spinner } from "react-bootstrap";

const EditTransactionsPage = () => {
const { user, setUser, setScreen, setServerResponse, runEditTransactionsTour, setRunEditTransactionsTour } = useContext(AppContext);
Expand Down Expand Up @@ -94,8 +95,9 @@ const EditTransactionsPage = () => {

return (
<>
<HamburgerMenu />
<HamburgerMenuEdit />
<EditTransactionsJoyride />
<Spinner />
<form onSubmit={handleSubmit(onSubmit)} data-tour="edit-transactions-form">
<div className="edit-buttons">
<div className="edit-left-button">
Expand Down
121 changes: 121 additions & 0 deletions client/src/components/HamburgerMenuEdit.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import React, {useContext, useEffect} from 'react';
import {
Drawer,
DrawerBody,
DrawerHeader,
DrawerOverlay,
DrawerContent,
DrawerCloseButton,
IconButton,
VStack,
useDisclosure,
Button,
Text
} from "@chakra-ui/react";
import {HamburgerIcon} from "@chakra-ui/icons";
import {AppContext} from '../context/AppContext.jsx';
import SignOut from "./SignOut.jsx";

// const HamburgerMenu = ({setRunTour}) => {
const HamburgerMenuEdit = () => {
const {
showHamburger,
setShowHamburger,
renderNewScreen,
showCategories,
toggleCategoriesList,
user,
setRunTour,
setRunChartTour
} = useContext(AppContext);
const {isOpen, onOpen, onClose} = useDisclosure();

useEffect(() => {
if (showHamburger) {
onOpen();
} else {
onClose();
}
}, [showHamburger, onOpen, onClose]);

const startTour = () => {
setShowHamburger(false);
setRunTour(true);
};

return (
<>
<IconButton
aria-label="Open Menu"
icon={<HamburgerIcon/>}
onClick={() => setShowHamburger(true)}
display={{base: "block", md: "block"}}
position="fixed"
background="#415a77"
top="20px"
left="20px"
zIndex="1000"
colorScheme="teal"
/>

<Drawer placement="left" onClose={() => setShowHamburger(false)} isOpen={isOpen}>
<DrawerOverlay>
<DrawerContent>
<DrawerCloseButton color='#bd1f36'/>
<DrawerHeader
textAlign="center"
color="yinmnBlue.500"
fontSize="2xl"
fontWeight="bold"
>Menu</DrawerHeader>
<DrawerBody>
<VStack align="center" spacing={4}>
<Text
fontSize="xl"
fontWeight="bold"
>
Welcome {user.first_name}
</Text>
{/* <Button
onClick={startTour}
variant="ghost"
w="100%"
aria-label="Start Tour"
>
Start Tour
</Button> */}
<Button
variant="ghost"
w="100%"
data-tour="expense-chart"
onClick={() => {
renderNewScreen("chart");
setRunChartTour(true);
setShowHamburger(false);
}}
>
Expense Chart
</Button>
{/* <Button
variant="ghost"
w="100%"
onClick={toggleCategoriesList}>
{showCategories ? "Hide Categories" : "Show Categories"}
</Button> */}
<SignOut
variant="outline"
w="100%"
color="white"
backgroundColor="#bd1f36"
/>

</VStack>
</DrawerBody>
</DrawerContent>
</DrawerOverlay>
</Drawer>
</>
);
};

export default HamburgerMenuEdit;

0 comments on commit e0a0629

Please sign in to comment.