From 20d310e31f7946890920b29a98c1bb87df1e39d6 Mon Sep 17 00:00:00 2001 From: Yun Whitman Date: Thu, 20 Jun 2024 23:08:12 -0700 Subject: [PATCH 1/2] Updated edit staff modal to match edit student modal --- src/pages/staff/[user_id].tsx | 22 +++++++++++++++------- src/styles/StaffPage.module.css | 13 +++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/pages/staff/[user_id].tsx b/src/pages/staff/[user_id].tsx index 1998d910..d5e98655 100644 --- a/src/pages/staff/[user_id].tsx +++ b/src/pages/staff/[user_id].tsx @@ -1,18 +1,23 @@ import { useState } from "react"; import { trpc } from "@/client/lib/trpc"; +import { Box, Button, Container, Modal, Stack, TextField } from "@mui/material"; import { useRouter } from "next/router"; import $home from "@/styles/Home.module.css"; import $button from "@/components/design_system/button/Button.module.css"; import $StaffPage from "../../styles/StaffPage.module.css"; import $Modal from "../../styles/Modal.module.css"; -import Stack from "@mui/material/Stack"; -import Box from "@mui/material/Box"; -import Button from "@mui/material/Button"; -import Container from "@mui/material/Container"; -import Modal from "@mui/material/Modal"; +// import Stack from "@mui/material/Stack"; +// import Box from "@mui/material/Box"; +// import Button from "@mui/material/Button"; +// import Container from "@mui/material/Container"; +// import Modal from "@mui/material/Modal"; const ViewParaPage = () => { + const [open, setOpen] = useState(false); + const handleOpen = () => setOpen(true); + const handleClose = () => setOpen(false); + //are we going to add an archive button? const [archiveParaPrompt, setArchiveParaPrompt] = useState(false); const [viewState, setViewState] = useState(0); @@ -21,14 +26,17 @@ const ViewParaPage = () => { const { user_id } = router.query; const { data: me } = trpc.user.getMe.useQuery(); + //maybe remove these two pages? const VIEW_STATES = { MAIN: 0, EDIT: 1 }; const handleEditState = () => { - setViewState(VIEW_STATES.EDIT); + handleOpen(); + //setViewState(VIEW_STATES.EDIT); }; const handleMainState = () => { - setViewState(VIEW_STATES.MAIN); + handleClose(); + //setViewState(VIEW_STATES.MAIN); }; const { data: para, isLoading } = trpc.para.getParaById.useQuery( diff --git a/src/styles/StaffPage.module.css b/src/styles/StaffPage.module.css index 4f643bb5..4946b04a 100644 --- a/src/styles/StaffPage.module.css +++ b/src/styles/StaffPage.module.css @@ -75,3 +75,16 @@ justify-content: space-evenly; padding-top: 2rem; } + +.editModalContent { + background-color: var(--grey-100); /* Ensure it has a background color */ + border-radius: 10px; + padding: 20px; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Add a subtle shadow */ + max-width: 500px; + width: 100%; + margin: auto; /* Center horizontally */ + position: relative; + top: 50%; + transform: translateY(-50%); /* Center vertically */ +} From 29a260f11ca23cd5cee039fb019e91316c1555c6 Mon Sep 17 00:00:00 2001 From: Brandon Cruz-Youll <42663258+BeeSeeWhy@users.noreply.github.com> Date: Tue, 23 Jul 2024 20:57:04 -0700 Subject: [PATCH 2/2] added modal for edit and removed main/edit states --- src/pages/staff/[user_id].tsx | 272 +++++++++++++++++++--------------- 1 file changed, 156 insertions(+), 116 deletions(-) diff --git a/src/pages/staff/[user_id].tsx b/src/pages/staff/[user_id].tsx index d5e98655..64eaf396 100644 --- a/src/pages/staff/[user_id].tsx +++ b/src/pages/staff/[user_id].tsx @@ -1,17 +1,19 @@ import { useState } from "react"; import { trpc } from "@/client/lib/trpc"; -import { Box, Button, Container, Modal, Stack, TextField } from "@mui/material"; +import { + Box, + Button, + Container, + Modal, + Stack, + TextField, + Typography, +} from "@mui/material"; import { useRouter } from "next/router"; import $home from "@/styles/Home.module.css"; import $button from "@/components/design_system/button/Button.module.css"; import $StaffPage from "../../styles/StaffPage.module.css"; -import $Modal from "../../styles/Modal.module.css"; - -// import Stack from "@mui/material/Stack"; -// import Box from "@mui/material/Box"; -// import Button from "@mui/material/Button"; -// import Container from "@mui/material/Container"; -// import Modal from "@mui/material/Modal"; +import $Modal from "@/components/design_system/modal/Modal.module.css"; const ViewParaPage = () => { const [open, setOpen] = useState(false); @@ -26,17 +28,12 @@ const ViewParaPage = () => { const { user_id } = router.query; const { data: me } = trpc.user.getMe.useQuery(); - //maybe remove these two pages? - const VIEW_STATES = { MAIN: 0, EDIT: 1 }; - const handleEditState = () => { handleOpen(); - //setViewState(VIEW_STATES.EDIT); }; const handleMainState = () => { handleClose(); - //setViewState(VIEW_STATES.MAIN); }; const { data: para, isLoading } = trpc.para.getParaById.useQuery( @@ -108,123 +105,166 @@ const ViewParaPage = () => {

{para?.first_name} {para?.last_name}

- - {/* Edit button only to be shown when view state is set to MAIN */} - {viewState === VIEW_STATES.MAIN && ( + + - )} - {/* Save and Cancel buttons only to be shown when view state is set to EDIT */} - {viewState === VIEW_STATES.EDIT && ( - - - - - )} + - {/* if view state is "EDIT" then show the edit version of the student page */} - {viewState === VIEW_STATES.EDIT &&

Edit Profile

} - - {viewState === VIEW_STATES.MAIN && ( - - -
-

Email

-

{para?.email}

-
-
-
+ + +
+

Email

+

{para?.email}

+
+
- )} +
- {viewState === VIEW_STATES.EDIT && ( - -
- - - -

:

- -
- - -

:

- -
- + + + + + - -

:

- + + + + + + + + + + + + + + + + + +
- - - - - - - -
- )} + +
+ {/* Archiving Staff Modal appears when "Archive" button is pressed*/}