From f3c852ccdf452e34cc93445e833ca9a2af4c3d74 Mon Sep 17 00:00:00 2001 From: Kira Muhlbauer Date: Wed, 27 Sep 2023 18:11:17 -0600 Subject: [PATCH] remove unused variables --- app/src/admin/dishList.tsx | 5 +---- app/src/admin/styledEmail.tsx | 1 - app/src/admin/styledUsers.tsx | 1 - app/src/routes/borrow.tsx | 5 +---- app/src/routes/home.tsx | 10 +++++----- app/src/routes/login.tsx | 16 ++++++++-------- app/src/widgets/dishcard.tsx | 3 +-- 7 files changed, 16 insertions(+), 25 deletions(-) diff --git a/app/src/admin/dishList.tsx b/app/src/admin/dishList.tsx index 9fb7dd52..2283f099 100644 --- a/app/src/admin/dishList.tsx +++ b/app/src/admin/dishList.tsx @@ -1,8 +1,5 @@ -import { useEffect, useRef, useState } from 'react'; -import Toolbar from './toolbar'; +import { useEffect, useState } from 'react'; import adminApi from "./adminApi"; -import { Simulate } from "react-dom/test-utils"; -import load = Simulate.load; import { StyledDishDataLayout } from './styledDishes'; const AdminDishTableRow = ({ dish, selectedHandler, index, selectedList }) => { diff --git a/app/src/admin/styledEmail.tsx b/app/src/admin/styledEmail.tsx index 0e8e6cd0..e69de29b 100644 --- a/app/src/admin/styledEmail.tsx +++ b/app/src/admin/styledEmail.tsx @@ -1 +0,0 @@ -import styled from 'styled-components' \ No newline at end of file diff --git a/app/src/admin/styledUsers.tsx b/app/src/admin/styledUsers.tsx index 0e8e6cd0..e69de29b 100644 --- a/app/src/admin/styledUsers.tsx +++ b/app/src/admin/styledUsers.tsx @@ -1 +0,0 @@ -import styled from 'styled-components' \ No newline at end of file diff --git a/app/src/routes/borrow.tsx b/app/src/routes/borrow.tsx index 4231d00a..d8c15552 100644 --- a/app/src/routes/borrow.tsx +++ b/app/src/routes/borrow.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from "react"; +import { useState } from "react"; import { useNavigate } from "react-router-dom"; import Scanner from "../widgets/scanner"; import Modal from "react-bootstrap/Modal"; @@ -107,7 +107,6 @@ export default () => { }); const navigate = useNavigate(); - const [Buffer, setBuffer] = useState(false); const onScan = confirm ? null : (id: string) => { @@ -123,8 +122,6 @@ export default () => { } setConfirm(false); const user = currentUser?.id || null; - console.log("USER: " + user); - console.log("scanid", scanId); axios .post( diff --git a/app/src/routes/home.tsx b/app/src/routes/home.tsx index 862c8359..1dc992d8 100644 --- a/app/src/routes/home.tsx +++ b/app/src/routes/home.tsx @@ -65,7 +65,7 @@ const NewUser = (dishesUsed) => { const GetDishes = (dishesUsed) =>{ const checkedOutDishes = dishesUsed.filter(dish => dish.returned.timestamp == "").length - return ( + return (

My Dishes

@@ -91,12 +91,12 @@ const GetDishes = (dishesUsed) =>{
}
- + )} const ExistingUser = (dishesUsed) => { const content = GetDishes(dishesUsed) - const returnedDishes = dishesUsed.filter(dish => dish.returned.timestamp != "").length + const returnedDishes = dishesUsed.filter(dish => dish.returned.timestamp != "").length return (
@@ -155,11 +155,11 @@ const Footer = () => { }; export default () => { - //Show spinner as soon as page is refreshed + //Show spinner as soon as page is refreshed const [isLoading, setIsLoading] = useState(true); const { currentUser, sessionToken } = useAuth(); const [dishesUsed, setDishesUsed] = useState([]); - const [isMobile, setIsMobile] = useState(window.innerWidth <= 768); + const [isMobile, setIsMobile] = useState(window.innerWidth <= 768); // eslint-disable-line @typescript-eslint/no-unused-vars let content; // Fetch dishes transaction for the user diff --git a/app/src/routes/login.tsx b/app/src/routes/login.tsx index 5953ff38..b2d2d164 100644 --- a/app/src/routes/login.tsx +++ b/app/src/routes/login.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { Button, Typography, Box, Avatar } from '@mui/material'; import {BallTriangle} from 'react-loader-spinner'; import desktopLogo from "../assets/dishzero-logo-desktop.png"; @@ -6,7 +6,7 @@ import mobileLogo from "../assets/dishzero-logo-mobile.png"; import signInButtonLogo from "../assets/sign-in-button-logo.png"; import MobileBackground from '../assets/leaf-mobile-background.png'; import 'typeface-poppins'; -import { useLocation, useNavigate, useParams, useSearchParams } from "react-router-dom"; +import { useLocation } from "react-router-dom"; import { useAuth } from "../contexts/AuthContext"; @@ -15,14 +15,14 @@ const useQuery = () => new URLSearchParams(useLocation().search); export default function Login() { const { login } = useAuth() const [isMobile, setIsMobile] = useState(window.innerWidth <= 768); - - //Show spinner as soon as page is refreshed + + //Show spinner as soon as page is refreshed const [isLoading, setIsLoading] = useState(true); const {currentUser} = useAuth() - + //const {transaction_id} = useParams(); const query = useQuery(); - const transaction_id = query.get("transaction_id"); + const transaction_id = query.get("transaction_id"); // eslint-disable-line @typescript-eslint/no-unused-vars useEffect(() => { const handleResize = () => { setIsMobile(window.innerWidth <= 768); @@ -34,7 +34,7 @@ export default function Login() { }; }, []); - + // fired on button click while the user is not signed in. // logs in the user and navigates to home screen if successfully logged in @@ -90,7 +90,7 @@ export default function Login() { ) - + } const styles = { diff --git a/app/src/widgets/dishcard.tsx b/app/src/widgets/dishcard.tsx index 0d030605..f298294b 100644 --- a/app/src/widgets/dishcard.tsx +++ b/app/src/widgets/dishcard.tsx @@ -5,8 +5,7 @@ import mug from "../assets/mug_icon_contained.svg"; import container from "../assets/dish_icon_contained.svg"; export default ({dish,token}) => { - const options = { weekday: 'long', year: 'numeric', month: 'long'}; - const [dishAPI, setDishAPI] = useState([]) + const [dishAPI, setDishAPI] = useState([]) const twoDaysInMs = 86400000 * 2 useEffect(()=>{ axios.get(`${process.env.REACT_APP_BACKEND_ADDRESS}/api/dish`, {headers:{"x-api-key":`${process.env.REACT_APP_API_KEY}`,"session-token":token}, params:{"id":dish.dish}})