Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
685162a
initial conversion to nextjs
szeckirjr May 18, 2023
524b64d
more changes and slow upgrades to nextjs
szeckirjr Jun 18, 2023
59f3382
more change to using nextjs router
szeckirjr Jun 18, 2023
923fb72
fix seeding
szeckirjr Oct 4, 2023
9a5a4ad
adding more handling and new prisma versions
szeckirjr Oct 12, 2023
164f40b
adding more nextjs changes
szeckirjr Dec 7, 2023
29a5e38
create wss server setup in docker compose
Jan 16, 2024
cfb1cc0
remove node_modules from wss folder
Jan 16, 2024
52ed975
Create CourseUp WSS README.md file and a few other changes
Jan 16, 2024
13f1cab
Move postgres docker compose to its own dockerfile
Jan 16, 2024
6cd2074
Create standalone postgres container, npm commands, and documentation
Jan 16, 2024
336a76b
up node version
szeckirjr Jan 18, 2024
909ad3e
fix build
szeckirjr Jan 18, 2024
659b612
update browser list
szeckirjr Jan 18, 2024
91acd11
Merge branch 'aaron/wss' into hello-nextjs
Jan 23, 2024
00d1bd2
un-gitignore .env
Jan 23, 2024
a935bbe
remove shadowDatabaseUrl and databaseUrl to start fix of db seeding i…
Jan 23, 2024
28cdb7a
add fallback formats from dates and datetimes sent from banner (fixes…
Jan 24, 2024
f54927b
update node version for populate-courses workflow
Jan 24, 2024
16a9178
update node version for other workflow files
Jan 24, 2024
fc7df4d
add 'install ts-node' step in pipeline
Jan 24, 2024
528a406
add prisma client install step to pipeline
Jan 24, 2024
fd9218f
making api and lib work
szeckirjr Jan 29, 2024
1e5e96f
add got to dependencies
Jan 30, 2024
23e0c8b
Adding some info to readme
szeckirjr Jan 30, 2024
1b6fdf8
update next
szeckirjr Jan 30, 2024
eb71877
create migration directory for ui overhaul
Jan 30, 2024
7cb02ba
implementing backend into new subrepo
szeckirjr Feb 2, 2024
0d6e3a0
adding header
szeckirjr Feb 2, 2024
a7b292b
adding main page
szeckirjr Feb 3, 2024
6076263
fixing responsiveness
szeckirjr Feb 3, 2024
1bc2360
adding more routes
szeckirjr Feb 5, 2024
5e5a73f
add more routes and fix header
szeckirjr Feb 5, 2024
a90dc18
fix build
szeckirjr Feb 5, 2024
ad713ac
add date fns package
szeckirjr Feb 5, 2024
5b277d9
comment out restful stuff
szeckirjr Feb 5, 2024
3dbbc40
add zod pckg
szeckirjr Feb 5, 2024
992f0a4
add proper prisma generate pre build
szeckirjr Feb 5, 2024
ffc86a5
update navbar button styling
Feb 9, 2024
0d9e6c8
fix bugs in mobile navbar
Feb 10, 2024
c01d082
add blur effect to mobile navbar menu for more contrast
Feb 10, 2024
c0fe13f
performance fix (keeping track of event listeners a bit better)
Feb 10, 2024
cdd6701
refactor mobile navbar into its own component file
Feb 12, 2024
92b648e
finish up mobile navbar component functionality
Feb 12, 2024
0829a52
add home route to NavButtons
Feb 12, 2024
4a5d41b
add better contrast to header
Feb 12, 2024
d82b1ed
add proper type annotations for Content, HeaderContainer, and MobileN…
Feb 27, 2024
9a81e99
Begin work on explore page & implement resizeable panels
Feb 27, 2024
a8e1a18
fix bugs in resize handles
Feb 28, 2024
d703b95
add styling for course display
Feb 28, 2024
a19303f
Refactor CourseDisplay into its own component file for better readabi…
Feb 28, 2024
414aff5
fix bug in Content.tsx that disabled all pointer events in main layout
Feb 29, 2024
af00948
move create context for page bur
Feb 29, 2024
9e92465
fix bug where MobileNavbar shows up on desktop during blur
Feb 29, 2024
42d3c8c
fix types
szeckirjr Mar 4, 2024
1198283
change type & fix button size
szeckirjr Mar 5, 2024
76b3f06
setup themes and add theme toggle
Mar 5, 2024
1481474
add wss folder to nextjs repo lib to fix docker compose issues
Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/lib/wss/node_modules
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ REACT_APP_BACKEND=nextjs
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings

DATABASE_URL="postgresql://admin:admin@localhost:5432/postgres?schema=public"
POSTGRES_PRISMA_URL="postgresql://admin:admin@localhost:5432/postgres?schema=public"
# For authentication when calling the data refresh endpoints
ACCESS_KEY="secret"
ACCESS_KEY="secret"
WSSPORT=1738
6 changes: 3 additions & 3 deletions .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18.19.0
- name: Cache npm dependencies
uses: actions/cache@v1
with:
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18.19.0
- name: Cache npm dependencies
uses: actions/cache@v1
with:
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18.19.0
- name: Cache npm dependencies
uses: actions/cache@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/populate-courses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18.19.0
- name: Cache npm dependencies
uses: actions/cache@v2
with:
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18.19.0
- name: Cache npm dependencies
uses: actions/cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/populate-textbooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18.19.0
- name: Cache npm dependencies
uses: actions/cache@v2
with:
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18.19.0
- name: Cache npm dependencies
uses: actions/cache@v2
with:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/upsert-courses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18.19.0
- name: Cache npm dependencies
uses: actions/cache@v2
with:
Expand All @@ -32,7 +32,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18.19.0
- name: Cache npm dependencies
uses: actions/cache@v2
with:
Expand All @@ -42,5 +42,10 @@ jobs:
npm-
- name: Install dependencies
run: npm ci --ignore-scripts --no-audit --no-progress
# TODO: now its complaining about the prisma client, find a way to install all of these machine dependencies better
- name: Install ts-node globally
run: npm install -g ts-node@10.2.1
- name: Install prisma client globally
run: npm install -g @prisma/client@5.4.2
- name: Execute Script
run: ts-node ./scripts/upsert/courses.ts ${{ github.event.inputs.term }} ${{ github.event.inputs.registrationDate }} ${{ github.event.inputs.dropDate }}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

.env

# dependencies
/lib/wss/node_modules
/node_modules
/.pnp
.pnp.js
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14.18.2
v18.19.0
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ You will require the following to run this application locally:
npx prisma migrate deploy && npx prisma db seed
```

- This will run migrations to apply the latest schema changes to the database as well as seed the database with the latest course data.
- This will run migrations to apply the latest schema changes to the database as well as seed the database with the latest term

6. Start the application using `npm run dev` (or `yarn dev`)
- This will start the Next.js server.
- This will start the Next.js server in development mode.

You will now be able to develop the application. Any changes made to the code will hot-reload upon save.

Expand Down Expand Up @@ -98,6 +98,32 @@ The website uses the npm package [`uvic-course-scraper`](https://github.com/Vike

The motivation of [`uvic-course-scraper`](https://github.com/VikeLabs/uvic-course-scraper) is to abstract away the parsing and scraping required to obtain data. It is not designed to do anything else.

## Conversion to Next.js

The original version of CourseUp is built using [CRA](https://create-react-app.dev/), with the backend being an Express server with a Firebase database. The plan is to convert the application to use Next.js with a PostgreSQL database.
This will allow us to use [Prisma](https://www.prisma.io/) as an ORM, which will make it easier to interact with the database and make more complex queries.

The branch `hello-nextjs` should be treated as the "main" branch, where all development for the migration is taking place. It is very much a work-in-progress right now, with a double stack (CRA + Next.js) setup.
The `main` branch will be kept as-is for production release until the Next.js version is ready to be deployed.

### CRA vs Next.js Folders

Because of the double stack setup, there are a mix of folders:

CRA + Firebase

- `src` - CRA source code (React components, etc. - slowly being modified to work with Next.js)
- `public` - CRA public folder (static assets, etc.)
- `functions` - Firebase functions (backend)

Next.js

- `pages` - Next.js /pages router
- `components` - Next.js components for new UI
- `prisma` - Prisma schema, migrations, and seeders

Other folders usually are shared between the two stacks, like `lib` and `public`

## VikeLabs

This project was developed by students at the [University of Victoria](https://www.uvic.ca) as part of [VikeLabs](https://vikelabs.ca), which is a student-led software development club.
Expand Down
45 changes: 45 additions & 0 deletions components/explore/ExplorePage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Box, Flex, Heading } from '@chakra-ui/react';

import { Term } from 'lib/fetchers';
import { getReadableTerm } from 'lib/utils/terms';

type Props = {
term: Term;
subjects: {
subject: string;
title: string;
}[];
};

export default function ExplorePage({ term, subjects }: Props) {
return (
<Flex wrap="wrap" gap={6}>
{subjects && subjects.length > 1 ? (
subjects.map((subject) => (
<Box
as="a"
href={`/explore/${term}/${subject.subject}`}
key={subject.subject}
minW={200}
w="20%"
minH={100}
flexGrow={1}
p={6}
borderRadius="lg"
shadow="md"
transition="0.5s"
_hover={{ shadow: 'xl' }}
>
<Heading size="md" color="black">
{subject.title}
</Heading>
</Box>
))
) : (
<Box minW={200} w="20%" minH={100} flexGrow={1} p={6} borderRadius="lg" transition="0.5s">
<Heading size="md">No subjects found for {getReadableTerm(term)}</Heading>
</Box>
)}
</Flex>
);
}
7 changes: 7 additions & 0 deletions courseup/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema

# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings

DATABASE_URL="postgresql://admin:admin@localhost:5432/postgres?schema=public"
3 changes: 3 additions & 0 deletions courseup/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
37 changes: 37 additions & 0 deletions courseup/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
1 change: 1 addition & 0 deletions courseup/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.19.0
36 changes: 36 additions & 0 deletions courseup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
31 changes: 31 additions & 0 deletions courseup/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3'
services:
# Container name "database"
postgresql:
# Official Postgres image from DockerHub (we use the last version)
container_name: postgresql
build:
context: .
dockerfile: postgres.Dockerfile
ports:
- 5432:5432
volumes:
- db-data:/var/lib/postgresql/data
# the default PostgreSQL data path.
# It means that every time the repository is modifying the data inside
# of `/var/lib/postgresql/data/`, automatically the change will appear in `db-data`.
# You don't need to create the `db-data` folder. Docker Compose will do it for you.
# - ./tmp/postgresql/:/var/lib/postgresql/data/
wss:
container_name: wss
depends_on:
- postgresql
ports:
- 1738:1738
env_file:
- ./.env
build:
context: .
dockerfile: wss.Dockerfile
volumes:
db-data:
5 changes: 5 additions & 0 deletions courseup/lib/banner/fetch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import makeFetchCookie from 'fetch-cookie';

const _ = makeFetchCookie(fetch);

export type Fetch = typeof _;
Loading