Skip to content

Commit

Permalink
Refactor course id into env variable and enforce min node version in …
Browse files Browse the repository at this point in the history
…package-json
  • Loading branch information
ShreyasKallingal authored and Peter Perfect committed Apr 4, 2024
1 parent d02bfa8 commit 590261a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ NEXTAUTH_URL='http://localhost:3000'
# Ably
ABLY_SERVER_API_KEY='<ABLY_SERVER_API_KEY>'
NEXT_PUBLIC_ABLY_CLIENT_API_KEY='<ABLY_CLIENT_API_KEY>'

# Course Info
COURSE_ID='<COURSE_ID>'
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "simple-office-hours-queue",
"engines" : { "node" : ">18.17" },
"version": "0.1.0",
"private": true,
"prisma": {
Expand Down
3 changes: 1 addition & 2 deletions src/components/layout/Landing.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Flex, Heading, Text } from "@chakra-ui/react";
import { COURSE_ID } from "../../utils/constants";

/**
* Sign in page UI.
Expand All @@ -8,7 +7,7 @@ const Landing = () => {
return (
<Flex direction="column" align="center" justify="center" p={8}>
<Heading as="h1" size="xl" mb={4}>
Welcome to the {COURSE_ID} Office Hours Queue
Welcome to the {process.env.COURSE_ID} Office Hours Queue
</Heading>
<Text mb={4}>
Please sign in with your school email above to join or manage the queue.
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { UserRole } from "@prisma/client";
import { useSession } from "next-auth/react";
import Link from "next/link";
import Router from "next/router";
import { COURSE_ID, DARK_MODE_COLOR } from "../../utils/constants";
import { DARK_MODE_COLOR } from "../../utils/constants";
import { trpc } from "../../utils/trpc";
import AvatarDropdown from "./AvatarDropdown";
import { DarkModeToggle } from "./DarkModeToggle";
Expand Down Expand Up @@ -76,7 +76,7 @@ export const Navbar = () => {
fontWeight="semibold"
fontSize="xl"
>
{COURSE_ID} OH
{process.env.COURSE_ID} OH
</Text>
</Link>
<Divider orientation="vertical" height="50px" ml={4} />
Expand Down
2 changes: 0 additions & 2 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export const COURSE_ID = "CS61B";

export const EMAIL_REGEX =
/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;

Expand Down

0 comments on commit 590261a

Please sign in to comment.