Skip to content

Commit

Permalink
Reorganized web pages and added stub pages for Sanctuary (#68)
Browse files Browse the repository at this point in the history
Problem
In preparing the front end for integrating Sanctuary, exisitng pages
needed to be reorganized and new pages added.

Solution
- Pages are organized first by user group (medical and sanctuary) and
then by function (home, search, form).
- Stub pages for Sanctuary were added.
- The ProtectedNavbar component was updated to reflect the new page
organization (defaults to medical routes).
- TODOs were added to easily locate where routes need to be dynamically
generated based on user group.
- Medical component Home renamed to MedicalHome for clarity.

Ticket URL
N/A

Documentation
N/A

Tests Run
- Manually tested new pages and navigation.
  • Loading branch information
critch646 authored Jan 22, 2024
1 parent b4d970b commit 0ed558a
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 12 deletions.
12 changes: 6 additions & 6 deletions app/web/components/ProtectedNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ProtectedNavbar: React.FC = () => {
<Divider />
<List>
<ListItem key="New Entry" disablePadding>
<ListItemButton href="/forms/form" sx={{ textAlign: "center" }}>
<ListItemButton href="/medical/form" sx={{ textAlign: "center" }}>{/* TODO: Implement logic for user's group form */}
<ListItemText primary="New Entry" />
</ListItemButton>
</ListItem>
Expand Down Expand Up @@ -74,19 +74,19 @@ const ProtectedNavbar: React.FC = () => {
display: { xs: "none", sm: "block", fontWeight: "bold" },
}}
>
<Link href="/home">Home</Link>
<Link href="/medical/home">Home</Link>{/* TODO: Implement logic for user's group home */}
</Typography>
<Box sx={{ display: { xs: "none", sm: "block" } }}>
<Button
href="/search/encounters"
href="/medical/search"
sx={{ color: "#fff", fontWeight: "bold" }}
>
>{/* TODO: Implement logic for user's group search */}
List Entries
</Button>
<Button
href="/forms/form"
href="/medical/form"
sx={{ color: "#fff", fontWeight: "bold" }}
>
>{/* TODO: Implement logic to user's group form */}
New Entry
</Button>
<Button
Expand Down
4 changes: 2 additions & 2 deletions app/web/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function SignIn() {
React.useEffect(() => {
const token = window.localStorage.getItem("auth-token");
if (token) {
router.push("/forms/form");
router.push("/medical/form"); // TODO: Implement logic for user's group form
}
}, [router]);

Expand All @@ -40,7 +40,7 @@ export default function SignIn() {
if (typeof email === "string" && typeof password === "string") {
const errorMessage = await login(email, password);
if (!errorMessage) {
router.push("/forms/form");
router.push("/medical/form"); // TODO: Implement logic for user's group form
} else {
setErrorMessage(errorMessage);
setError(true);
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions app/web/pages/home.tsx → app/web/pages/medical/home.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Typography from "@mui/material/Typography";
import Container from "@mui/material/Container";

import { ProtectedRoute } from "../contexts/auth";
import ProtectedNavbar from "../components/ProtectedNavbar";
import { ProtectedRoute } from "../../contexts/auth";
import ProtectedNavbar from "../../components/ProtectedNavbar";

function Home() {
function MedicalHome() {
return (
<>
<Container>
Expand All @@ -28,4 +28,4 @@ function Home() {
);
}

export default ProtectedRoute(Home);
export default ProtectedRoute(MedicalHome);
File renamed without changes.
16 changes: 16 additions & 0 deletions app/web/pages/sanctuary/form.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import Container from "@mui/material/Container";
import Typography from "@mui/material/Typography";
import { ProtectedRoute } from "../../contexts/auth";



function SanctuaryIntakeForm(): JSX.Element {
return (
<Container maxWidth="md">
<Typography variant="h1">Sanctuary Form</Typography>
</Container>
);
}

export default ProtectedRoute(SanctuaryIntakeForm);
16 changes: 16 additions & 0 deletions app/web/pages/sanctuary/home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import Container from "@mui/material/Container";
import Typography from "@mui/material/Typography";
import { ProtectedRoute } from "../../contexts/auth";



function SanctuaryHome(): JSX.Element {
return (
<Container maxWidth="md">
<Typography variant="h1">Sanctuary Home</Typography>
</Container>
);
}

export default ProtectedRoute(SanctuaryHome);
16 changes: 16 additions & 0 deletions app/web/pages/sanctuary/search.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import Container from "@mui/material/Container";
import Typography from "@mui/material/Typography";
import { ProtectedRoute } from "../../contexts/auth";



function SanctuaryIntakeSearch(): JSX.Element {
return (
<Container maxWidth="md">
<Typography variant="h1">Sanctuary Search</Typography>
</Container>
);
}

export default ProtectedRoute(SanctuaryIntakeSearch);

0 comments on commit 0ed558a

Please sign in to comment.