diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2db4d62..d939c47 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,4 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs +# Force push code to GitLab for deployment name: Mirror diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 942805b..82094f0 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -5,7 +5,7 @@ name: Node.js CI on: push: - branches: [ "main", "dcrepublic-dev", "v6ctor-dev"] + branches: ["main", "dcrepublic-dev", "v6ctor-dev"] jobs: build: diff --git a/README.md b/README.md index 4ea97c2..72972ff 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ go mod tidy ``` ```bash -go run main.go -semester=[spring|fall] -year=[202x] #defautl is fall 2024 +go run main.go -semester=spring -year=2025 # Change to semester of choice ``` diff --git a/components/navbar.tsx b/components/navbar.tsx index 397508f..a1ab752 100644 --- a/components/navbar.tsx +++ b/components/navbar.tsx @@ -18,66 +18,33 @@ import { DropdownItem, } from "@nextui-org/dropdown"; import { Link } from "@nextui-org/link"; -import { Spacer } from "@nextui-org/spacer"; import NextLink from "next/link"; import { usePathname } from "next/navigation"; import { button as buttonStyles } from "@nextui-org/theme"; import InputIcon from "@mui/icons-material/Input"; +import AccountCircleIcon from "@mui/icons-material/AccountCircle"; import axios from "axios"; import { siteConfig } from "../config/site"; import { ThemeSwitch } from "../components/theme-switch"; import { title } from "../components/primitives"; +import { Button } from "@nextui-org/button"; export const Navbar = (props: any) => { const pathname = usePathname(); const { data: session, status } = useSession(); - let authenticated; - let loginLink: any; - let adminDashLink: any; - let nameButton; - - if (props.hasOwnProperty("login")) { - loginLink = null; - nameButton = null; - } else { - if (status === "authenticated") { - authenticated = true; - axios - .post("/api/user", { - session: session, - }) - .then(function (response) { - //console.log(response); - }) - .catch(function (error) { - console.log(error); - }); - - loginLink = ( -
signOut()}> - Log out -
- ); - - if (session.user?.role === "admin") { - adminDashLink = ( - -
Admin
-
- ); - } - nameButton = session.user?.name; - } else { - authenticated = false; - loginLink = <>; - nameButton = ( -
- Log In -
- ); - } + if (status === "authenticated") { + axios + .post("/api/user", { + session: session, + }) + .then((response) => { + //console.log(response); + }) + .catch((error) => { + console.log(error); + }); } return ( @@ -103,23 +70,23 @@ export const Navbar = (props: any) => { - - - + + {siteConfig.navItems.map((item) => ( + + {item.label} + + ))} { - - - {} - : () => signIn("keycloak", { callbackUrl: "/" }) - } - > - {nameButton} - - - - {authenticated ? ( + {status === "authenticated" ? ( + + + + - {adminDashLink} - {loginLink} + {/* Causes an awful error if rendered conditionally */} + {/* + Admin + */} + signOut()}> + Sign Out + - ) : ( - <> - )} - + + ) : ( + + )} @@ -167,46 +133,53 @@ export const Navbar = (props: any) => { {/* Mobile?*/} - -
- {siteConfig.navItems.map((item, index) => ( - - - {item.label} - - - ))} + {/* +
+ {siteConfig.navItems.map((item, index) => ( + + + {item.label} + + + ))} - - - - {} - : () => signIn("keycloak", { callbackUrl: "/" }) - } - > - {nameButton} - - + + + + {} + : () => signIn("keycloak", { callbackUrl: "/" }) + } + > + {nameButton} + + - {authenticated ? ( - - {loginLink} - - ) : ( - <> - )} - - -
-
+ {authenticated ? ( + { + authenticated + ? signOut() + : signIn("keycloak", { callbackUrl: "/" }); + }} + > + Sign Out + + ) : ( + <> + )} + + +
+
*/} ); diff --git a/docker-compose.debug.yml b/docker-compose.debug.yml index 533f81a..a389da7 100644 --- a/docker-compose.debug.yml +++ b/docker-compose.debug.yml @@ -17,7 +17,7 @@ services: - 9229:9229 networks: - internal - command: sh -c "npm install --silent && npx prisma generate && npm run dev " + command: sh -c "npm install --silent && npx prisma migrate dev --name init && npx prisma generate && npm run dev " postgres: image: postgres:16.4-bullseye