Skip to content

Commit f1e70ab

Browse files
committed
Merge branch 'dev' of https://github.com/CS3219-AY2526Sem1/cs3219-ay2526s1-project-g37 into ui-login-signup
2 parents 2b4660c + 93d2b6e commit f1e70ab

20 files changed

+8671
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Commit workflow
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
os: [ubuntu-latest, macos-latest, windows-latest]
10+
node-version: [20.x]
11+
runs-on: ${{ matrix.os }}
12+
defaults:
13+
run:
14+
working-directory: ./frontend/peerprep
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- run: npm ci
21+
- run: npm run lint
22+
- run: npm run build

frontend/peerprep/.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.react-router
2+
build
3+
node_modules
4+
README.md

frontend/peerprep/.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Frontend specific ignores
2+
# dependencies
3+
/node_modules
4+
5+
# build output
6+
/build
7+
/dist
8+
9+
# dotenv files
10+
.env
11+
.env.local
12+
13+
# logs
14+
npm-debug.log*
15+
yarn-error.log*
16+
17+
# Mac
18+
.DS_Store
19+
20+
# editor and IDE files
21+
.vscode/
22+
*.swp
23+
24+
# React Router
25+
/.react-router/
26+
/build/

frontend/peerprep/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM node:20-alpine AS development-dependencies-env
2+
WORKDIR /app
3+
COPY package*.json ./
4+
RUN npm ci
5+
6+
FROM node:20-alpine AS production-dependencies-env
7+
COPY ./package.json package-lock.json /app/
8+
WORKDIR /app
9+
RUN npm ci --omit=dev
10+
11+
FROM node:20-alpine AS build-env
12+
COPY . /app/
13+
COPY --from=development-dependencies-env /app/node_modules /app/node_modules
14+
WORKDIR /app
15+
RUN npm run build
16+
17+
FROM node:20-alpine
18+
COPY ./package.json package-lock.json /app/
19+
COPY --from=production-dependencies-env /app/node_modules /app/node_modules
20+
COPY --from=build-env /app/build /app/build
21+
WORKDIR /app
22+
EXPOSE 3000
23+
CMD ["npm", "start"]

frontend/peerprep/README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Welcome to React Router!
2+
3+
A modern, production-ready template for building full-stack React applications using React Router.
4+
5+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/remix-run/react-router-templates/tree/main/default)
6+
7+
## Features
8+
9+
- 🚀 Server-side rendering
10+
- ⚡️ Hot Module Replacement (HMR)
11+
- 📦 Asset bundling and optimization
12+
- 🔄 Data loading and mutations
13+
- 🔒 TypeScript by default
14+
- 🎉 TailwindCSS for styling
15+
- 📖 [React Router docs](https://reactrouter.com/)
16+
17+
## Getting Started
18+
19+
### Installation
20+
21+
Install the dependencies:
22+
23+
```bash
24+
npm install
25+
```
26+
27+
### Development
28+
29+
Start the development server with HMR:
30+
31+
```bash
32+
npm run dev
33+
```
34+
35+
Your application will be available at `http://localhost:5173`.
36+
37+
## Building for Production
38+
39+
Create a production build:
40+
41+
```bash
42+
npm run build
43+
```
44+
45+
## Deployment
46+
47+
### Docker Deployment
48+
49+
To build and run using Docker:
50+
51+
```bash
52+
docker build -t my-app .
53+
54+
# Run the container
55+
docker run -p 3000:3000 my-app
56+
```
57+
58+
The containerized application can be deployed to any platform that supports Docker, including:
59+
60+
- AWS ECS
61+
- Google Cloud Run
62+
- Azure Container Apps
63+
- Digital Ocean App Platform
64+
- Fly.io
65+
- Railway
66+
67+
### DIY Deployment
68+
69+
If you're familiar with deploying Node applications, the built-in app server is production-ready.
70+
71+
Make sure to deploy the output of `npm run build`
72+
73+
```
74+
├── package.json
75+
├── package-lock.json (or pnpm-lock.yaml, or bun.lockb)
76+
├── build/
77+
│ ├── client/ # Static assets
78+
│ └── server/ # Server-side code
79+
```
80+
81+
### Lint check
82+
To run the lint check:
83+
84+
```bash
85+
npm run lint
86+
```
87+
88+
## Styling
89+
90+
This template comes with [Tailwind CSS](https://tailwindcss.com/) already configured for a simple default starting experience. You can use whatever CSS framework you prefer.
91+
92+
---
93+
94+
Built with ❤️ using React Router.

frontend/peerprep/app/app.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@import "tailwindcss";
2+
3+
@theme {
4+
--font-sans: "Inter", ui-sans-serif, system-ui, sans-serif,
5+
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
6+
}
7+
8+
html,
9+
body {
10+
@apply bg-white dark:bg-gray-950;
11+
12+
@media (prefers-color-scheme: dark) {
13+
color-scheme: dark;
14+
}
15+
}

frontend/peerprep/app/root.tsx

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import {
2+
isRouteErrorResponse,
3+
Links,
4+
Meta,
5+
Outlet,
6+
Scripts,
7+
ScrollRestoration,
8+
} from "react-router";
9+
10+
import '@mantine/core/styles.css';
11+
import { createTheme, MantineProvider } from '@mantine/core';
12+
13+
import type { Route } from "./+types/root";
14+
import "./app.css";
15+
16+
export const links: Route.LinksFunction = () => [
17+
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
18+
{
19+
rel: "preconnect",
20+
href: "https://fonts.gstatic.com",
21+
crossOrigin: "anonymous",
22+
},
23+
{
24+
rel: "stylesheet",
25+
href: "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap",
26+
},
27+
];
28+
29+
const theme = createTheme({
30+
/** mantine theme overrides */
31+
});
32+
33+
export function Layout({ children }: { children: React.ReactNode }) {
34+
return (
35+
<html lang="en">
36+
<head>
37+
<meta charSet="utf-8" />
38+
<meta name="viewport" content="width=device-width, initial-scale=1" />
39+
<Meta />
40+
<Links />
41+
</head>
42+
<body>
43+
{children}
44+
<ScrollRestoration />
45+
<Scripts />
46+
</body>
47+
</html>
48+
);
49+
}
50+
51+
export default function App() {
52+
return (
53+
<MantineProvider theme={theme}>
54+
{<Outlet />}
55+
</MantineProvider>
56+
);
57+
}
58+
59+
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
60+
let message = "Oops!";
61+
let details = "An unexpected error occurred.";
62+
let stack: string | undefined;
63+
64+
if (isRouteErrorResponse(error)) {
65+
message = error.status === 404 ? "404" : "Error";
66+
details =
67+
error.status === 404
68+
? "The requested page could not be found."
69+
: error.statusText || details;
70+
} else if (import.meta.env.DEV && error && error instanceof Error) {
71+
details = error.message;
72+
stack = error.stack;
73+
}
74+
75+
return (
76+
<main className="pt-16 p-4 container mx-auto">
77+
<h1>{message}</h1>
78+
<p>{details}</p>
79+
{stack && (
80+
<pre className="w-full p-4 overflow-x-auto">
81+
<code>{stack}</code>
82+
</pre>
83+
)}
84+
</main>
85+
);
86+
}

frontend/peerprep/app/routes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { type RouteConfig, index } from "@react-router/dev/routes";
2+
3+
export default [index("routes/home.tsx")] satisfies RouteConfig;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Welcome } from "../welcome/welcome";
2+
3+
export function meta() {
4+
return [
5+
{ title: "New React Router App" },
6+
{ name: "description", content: "Welcome to React Router!" },
7+
];
8+
}
9+
10+
export default function Home() {
11+
return <Welcome />;
12+
}
Lines changed: 23 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)