-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add RWC admin dashboard view (#147)
- Loading branch information
1 parent
a27a56e
commit 449f2b0
Showing
36 changed files
with
956 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"cSpell.words": [ | ||
"Cigs", | ||
"fagerstrom" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 30 additions & 3 deletions
33
src/app/dashboard/admin/programs/rigs-without-cigs/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,44 @@ | ||
import { Box, Typography } from "@mui/material"; | ||
import { ReactNode } from "react"; | ||
|
||
export default function RigsWithoutCigsProgramPage(): ReactNode { | ||
import RigsWithoutCigsDashboard from "@/components/AdminDashboard/RigsWithoutCigsDashboard"; | ||
import { getRigsWithoutCigsProgramEnrollments } from "@/server/api/program-enrollments/queries"; | ||
|
||
export default async function RigsWithoutCigsProgramPage(): Promise<ReactNode> { | ||
const [rigsWithoutCigsProgramEnrollments, error] = | ||
await getRigsWithoutCigsProgramEnrollments(); | ||
|
||
if (error !== null) { | ||
return ( | ||
<Box | ||
sx={{ | ||
height: "100vh", | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}} | ||
> | ||
<Typography> | ||
There was an error fetching Rigs Without Cigs program enrollments | ||
</Typography> | ||
</Box> | ||
); | ||
} | ||
|
||
return ( | ||
<Box | ||
sx={{ | ||
height: "100vh", | ||
display: "flex", | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
marginTop: "100px", | ||
padding: 4, | ||
}} | ||
> | ||
<Typography>Rigs Without Cigs Program</Typography> | ||
<RigsWithoutCigsDashboard | ||
rigsWithoutCigsProgramEnrollments={rigsWithoutCigsProgramEnrollments} | ||
/> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/components/AdminDashboard/RigsWithoutCigsDashboard/FagerstromTestHistoryModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
"use client"; | ||
|
||
import InfoIcon from "@mui/icons-material/Info"; | ||
import { Box, Button, Fade, Modal, Typography } from "@mui/material"; | ||
import { ReactNode, useState } from "react"; | ||
|
||
import RigsWithoutCigsHistory from "@/components/ClientDashboard/RigsWithoutCigs/RigsWithoutCigsHistory"; | ||
import { ClientUser, FagerstromTest, ProgramEnrollment, User } from "@/types"; | ||
|
||
type FagerstromTestHistoryModalProps = { | ||
initialFagerstromTests: FagerstromTest[]; | ||
user: User; | ||
programEnrollment: ProgramEnrollment; | ||
}; | ||
|
||
const style = { | ||
position: "absolute", | ||
top: "50%", | ||
left: "50%", | ||
transform: "translate(-50%, -50%)", | ||
width: "min(90vw, 900px)", | ||
maxHeight: "80vh", | ||
overflowY: "auto", | ||
bgcolor: "background.paper", | ||
boxShadow: 2, | ||
p: 4, | ||
display: "flex", | ||
flexDirection: "column", | ||
alignItems: "center", | ||
gap: 2, | ||
}; | ||
|
||
export default function FagerstromTestHistoryModal({ | ||
initialFagerstromTests, | ||
user, | ||
programEnrollment, | ||
}: FagerstromTestHistoryModalProps): ReactNode { | ||
const [open, setOpen] = useState(false); | ||
const [fagerstromTests, setFagerstromTests] = useState( | ||
initialFagerstromTests, | ||
); | ||
|
||
return ( | ||
<Box width="100%"> | ||
{/* Info Button */} | ||
<Button variant="contained" onClick={() => setOpen(true)}> | ||
<InfoIcon /> | ||
</Button> | ||
|
||
{/* Modal */} | ||
<Modal | ||
aria-labelledby="transition-modal-title" | ||
aria-describedby="transition-modal-description" | ||
open={open} | ||
onClose={() => setOpen(false)} | ||
closeAfterTransition | ||
> | ||
<Fade in={open}> | ||
<Box sx={style}> | ||
<Typography variant="h4">Fagerstrom Test History</Typography> | ||
<RigsWithoutCigsHistory | ||
user={user as ClientUser} | ||
fagerstromTests={fagerstromTests} | ||
setFagerstromTests={setFagerstromTests} | ||
programEnrollment={programEnrollment} | ||
/> | ||
<Button | ||
variant="outlined" | ||
onClick={() => setOpen(false)} | ||
sx={{ width: "50%" }} | ||
> | ||
Close | ||
</Button> | ||
</Box> | ||
</Fade> | ||
</Modal> | ||
</Box> | ||
); | ||
} |
Oops, something went wrong.