Skip to content

Commit

Permalink
feat: Add RWC admin dashboard view (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
RudraPatel2003 authored Feb 23, 2025
1 parent a27a56e commit 449f2b0
Show file tree
Hide file tree
Showing 36 changed files with 956 additions and 67 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,15 @@ jobs:
node-version: "lts/iron"
cache: "pnpm"

- name: Restore dependencies and Next.js cache
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: Install dependencies
run: pnpm install
run: pnpm install --frozen-lockfile
12 changes: 11 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,18 @@ jobs:
node-version: "lts/iron"
cache: "pnpm"

- name: Restore dependencies and Next.js cache
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: Install dependencies
run: pnpm install
run: pnpm install --frozen-lockfile

- name: Create .env file
run: |
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"Cigs",
"fagerstrom"
]
}
1 change: 1 addition & 0 deletions src/app/dashboard/admin/applications/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default async function AdminDashboardPage(): Promise<ReactNode> {
height: "100vh",
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
<PendingApplicationDashboard programEnrollments={programEnrollments} />
Expand Down
33 changes: 30 additions & 3 deletions src/app/dashboard/admin/programs/rigs-without-cigs/page.tsx
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>
);
}
1 change: 1 addition & 0 deletions src/app/dashboard/client/rigs-without-cigs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default async function RigsWithoutCigsPage(): Promise<ReactNode> {
const [user, error] = await getUserByEmail(session.user.email, {
populateProgramEnrollments: true,
populateEnrollmentForm: true,
populateFagerstromTests: true,
});

if (error !== null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const style = {
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
width: "40vw",
width: "min(90vw, 700px)",
maxHeight: "80vh",
overflowY: "auto",
bgcolor: "background.paper",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default function ClientManagementDashboard({

return (
<Box sx={{ width: "95%", height: "75%", marginTop: "100px" }}>
<Typography align="center" variant="h4" sx={{ m: 2 }}>
<Typography align="center" variant="h6">
Clients
</Typography>
<Box display="flex" alignItems="center" sx={{ py: 2 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type ActivityStatus =
| "inactiveFor8Weeks"
| "noTrackingForms";

export type Row = {
type Row = {
id?: string;
lastName: string;
firstName: string;
Expand Down Expand Up @@ -206,7 +206,7 @@ export default function HealthyHabitsClientDashboard({
return (
<>
<Box>
<Typography align="center" variant="h4" sx={{ m: 2 }}>
<Typography align="center" variant="h6">
Healthy Habits Clients
</Typography>
<Box display="flex" alignItems="center" sx={{ py: 2 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const style = {
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
width: "80vw",
width: "min(90vw, 900px)",
maxHeight: "80vh",
overflowY: "auto",
bgcolor: "background.paper",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const style = {
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
width: "40vw",
width: "min(90vw, 700px)",
maxHeight: "80vh",
overflowY: "auto",
bgcolor: "background.paper",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default function ScheduledMeetings({

return (
<Box>
<Typography align="center" variant="h4" sx={{ m: 2 }}>
<Typography align="center" variant="h6">
Scheduled Meetings
</Typography>
<Box sx={{ display: "flex", alignItems: "center", width: "100%" }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default function UrgentMeetingRequests({
return (
<>
<Box>
<Typography align="center" variant="h4" sx={{ m: 2 }}>
<Typography align="center" variant="h6">
Urgent Meeting Requests
</Typography>
<Box display="flex" alignItems="center" sx={{ py: 2 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const style = {
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
width: "40vw",
width: "min(90vw, 700px)",
maxHeight: "80vh",
overflowY: "auto",
bgcolor: "background.paper",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default function PendingApplicationDashboard({
return (
<>
<Box sx={{ width: "95%", height: "75%", marginTop: "100px" }}>
<Typography align="center" variant="h4" sx={{ m: 2 }}>
<Typography align="center" variant="h6">
Pending Applications
</Typography>
<Box display="flex" alignItems="center" sx={{ py: 2 }}>
Expand Down
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>
);
}
Loading

0 comments on commit 449f2b0

Please sign in to comment.