Skip to content

Commit 590261a

Browse files
ShreyasKallingalPeter Perfect
authored and
Peter Perfect
committed
Refactor course id into env variable and enforce min node version in package-json
1 parent d02bfa8 commit 590261a

File tree

6 files changed

+10
-6
lines changed

6 files changed

+10
-6
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ NEXTAUTH_URL='http://localhost:3000'
1414
# Ably
1515
ABLY_SERVER_API_KEY='<ABLY_SERVER_API_KEY>'
1616
NEXT_PUBLIC_ABLY_CLIENT_API_KEY='<ABLY_CLIENT_API_KEY>'
17+
18+
# Course Info
19+
COURSE_ID='<COURSE_ID>'

package-lock.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "simple-office-hours-queue",
3+
"engines" : { "node" : ">18.17" },
34
"version": "0.1.0",
45
"private": true,
56
"prisma": {

src/components/layout/Landing.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Flex, Heading, Text } from "@chakra-ui/react";
2-
import { COURSE_ID } from "../../utils/constants";
32

43
/**
54
* Sign in page UI.
@@ -8,7 +7,7 @@ const Landing = () => {
87
return (
98
<Flex direction="column" align="center" justify="center" p={8}>
109
<Heading as="h1" size="xl" mb={4}>
11-
Welcome to the {COURSE_ID} Office Hours Queue
10+
Welcome to the {process.env.COURSE_ID} Office Hours Queue
1211
</Heading>
1312
<Text mb={4}>
1413
Please sign in with your school email above to join or manage the queue.

src/components/layout/Navbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { UserRole } from "@prisma/client";
1414
import { useSession } from "next-auth/react";
1515
import Link from "next/link";
1616
import Router from "next/router";
17-
import { COURSE_ID, DARK_MODE_COLOR } from "../../utils/constants";
17+
import { DARK_MODE_COLOR } from "../../utils/constants";
1818
import { trpc } from "../../utils/trpc";
1919
import AvatarDropdown from "./AvatarDropdown";
2020
import { DarkModeToggle } from "./DarkModeToggle";
@@ -76,7 +76,7 @@ export const Navbar = () => {
7676
fontWeight="semibold"
7777
fontSize="xl"
7878
>
79-
{COURSE_ID} OH
79+
{process.env.COURSE_ID} OH
8080
</Text>
8181
</Link>
8282
<Divider orientation="vertical" height="50px" ml={4} />

src/utils/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export const COURSE_ID = "CS61B";
2-
31
export const EMAIL_REGEX =
42
/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
53

0 commit comments

Comments
 (0)