diff --git a/src/Components/DashboardPage/TechnicianButtons.tsx b/src/Components/DashboardPage/TechnicianButtons.tsx index c388b58..793c782 100644 --- a/src/Components/DashboardPage/TechnicianButtons.tsx +++ b/src/Components/DashboardPage/TechnicianButtons.tsx @@ -10,13 +10,13 @@ import NoteIcon from "@mui/icons-material/Note"; import { colors } from "../../styles"; import ScienceIcon from "@mui/icons-material/Science"; import ColorizeIcon from "@mui/icons-material/Colorize"; -import { Dispatch, SetStateAction } from "react"; - -type props = { - SetAddSKUModalOpen: Dispatch>; - SetAddItemModalOpen: Dispatch>; -}; -export default function TechnicianButtons(props: props) { +import Popup from "reactjs-popup"; +import AddItemModal from "../AddItemModal/AddItemModal"; +import AddSKUModal from "../AddSKUModal/AddSKUModal"; +import { useState } from "react"; +export default function TechnicianButtons() { + const [addSKUmodalOpen, SetAddSKUModalOpen] = useState(false); + const [additemmodalOpen, SetAddItemModalOpen] = useState(false); const navigate = useNavigate(); const queries = useQueries({ queries: [ @@ -99,7 +99,7 @@ export default function TechnicianButtons(props: props) { }, }} onClick={() => { - props.SetAddItemModalOpen(true); + SetAddItemModalOpen(true); }} > { - props.SetAddSKUModalOpen(true); + SetAddSKUModalOpen(true); }} > + SetAddSKUModalOpen(false)} + modal + position={"top center"} + contentStyle={{ + width: "32rem", + borderRadius: 16, + borderColor: "grey", + borderStyle: "solid", + borderWidth: 1, + padding: 16, + alignContent: "center", + justifyContent: "center", + textAlign: "center", + }} + > + + + SetAddItemModalOpen(false)} + modal + position={"top center"} + contentStyle={{ + width: "32rem", + borderRadius: 16, + borderColor: "grey", + borderStyle: "solid", + borderWidth: 1, + padding: 16, + alignContent: "center", + justifyContent: "center", + textAlign: "center", + }} + > + + ); } diff --git a/src/Pages/DashboardPage/DashboardPage.tsx b/src/Pages/DashboardPage/DashboardPage.tsx index ec58fa6..f5b89fd 100644 --- a/src/Pages/DashboardPage/DashboardPage.tsx +++ b/src/Pages/DashboardPage/DashboardPage.tsx @@ -6,10 +6,6 @@ import { EquipmentInstancesAPI, UserAPI, } from "../../Components/API/API"; -import { useState } from "react"; -import AddSKUModal from "../../Components/AddSKUModal/AddSKUModal"; -import Popup from "reactjs-popup"; -import AddItemModal from "../../Components/AddItemModal/AddItemModal"; import RestrictedComponent from "../../Components/RestrictedComponent/RestrictedComponent"; import TechnicianWidgets from "../../Components/DashboardPage/TechnicianWidgets"; import TechnicianButtons from "../../Components/DashboardPage/TechnicianButtons"; @@ -34,9 +30,6 @@ export default function Dashboard() { }); const isLoading = queries.some((result) => result.isLoading); - const [addSKUmodalOpen, SetAddSKUModalOpen] = useState(false); - const [additemmodalOpen, SetAddItemModalOpen] = useState(false); - if (isLoading) { return (
@@ -71,52 +64,11 @@ export default function Dashboard() { - + - SetAddSKUModalOpen(false)} - modal - position={"top center"} - contentStyle={{ - width: "32rem", - borderRadius: 16, - borderColor: "grey", - borderStyle: "solid", - borderWidth: 1, - padding: 16, - alignContent: "center", - justifyContent: "center", - textAlign: "center", - }} - > - - - SetAddItemModalOpen(false)} - modal - position={"top center"} - contentStyle={{ - width: "32rem", - borderRadius: 16, - borderColor: "grey", - borderStyle: "solid", - borderWidth: 1, - padding: 16, - alignContent: "center", - justifyContent: "center", - textAlign: "center", - }} - > - -
); }