Skip to content

Commit 8525e17

Browse files
committed
fixed nits
1 parent 74a15a0 commit 8525e17

16 files changed

Lines changed: 152 additions & 421 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ node_modules
1111
dist
1212
dist-ssr
1313
*.local
14+
.yarn
1415

1516
# Editor directories and files
1617
.vscode/*

README.md

Lines changed: 56 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,69 @@
1-
# React + TypeScript + Vite
1+
# ACM @ UIUC — RSVP Portal
22

3-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3+
Frontend for the ACM @ UIUC event RSVP system. Built with React, TypeScript, Vite, and Mantine UI.
44

5-
Currently, two official plugins are available:
5+
## Stack
66

7-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
7+
- **React 19** + **TypeScript**
8+
- **Vite** — dev server and bundler
9+
- **Mantine v8** — UI components and notifications
10+
- **`@acm-uiuc/core-client`** — typed SDK for the Core API
11+
- **`@azure/msal-react`** — Microsoft SSO authentication
12+
- **Cloudflare Turnstile** — bot protection on RSVP/cancel/profile actions
13+
- **React Router v7** — client-side routing
914

10-
## React Compiler
15+
## Getting Started
1116

12-
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13-
14-
## Expanding the ESLint configuration
17+
```bash
18+
yarn install
19+
yarn dev # local-dev (points to QA API)
20+
yarn dev:qa # dev build against QA API
21+
```
1522

16-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
23+
## Build
1724

18-
```js
19-
export default defineConfig([
20-
globalIgnores(['dist']),
21-
{
22-
files: ['**/*.{ts,tsx}'],
23-
extends: [
24-
// Other configs...
25+
```bash
26+
yarn build # production build
27+
yarn build:dev # dev environment build
28+
yarn build:prod # production environment build
29+
yarn typecheck # type-check without emitting
30+
```
2531

26-
// Remove tseslint.configs.recommended and replace with this
27-
tseslint.configs.recommendedTypeChecked,
28-
// Alternatively, use this for stricter rules
29-
tseslint.configs.strictTypeChecked,
30-
// Optionally, add this for stylistic rules
31-
tseslint.configs.stylisticTypeChecked,
32+
## Environments
3233

33-
// Other configs...
34-
],
35-
languageOptions: {
36-
parserOptions: {
37-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
38-
tsconfigRootDir: import.meta.dirname,
39-
},
40-
// other options...
41-
},
42-
},
43-
])
44-
```
34+
Configured in `src/config.ts` via `VITE_RUN_ENVIRONMENT`:
4535

46-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
36+
| Environment | Value | API |
37+
|-------------|-------------|----------------------------------|
38+
| Local dev | `local-dev` | `core.aws.qa.acmuiuc.org` |
39+
| QA/Dev | `dev` | `core.aws.qa.acmuiuc.org` |
40+
| Production | `prod` | `core.acm.illinois.edu` |
4741

48-
```js
49-
// eslint.config.js
50-
import reactX from 'eslint-plugin-react-x'
51-
import reactDom from 'eslint-plugin-react-dom'
42+
## Project Structure
5243

53-
export default defineConfig([
54-
globalIgnores(['dist']),
55-
{
56-
files: ['**/*.{ts,tsx}'],
57-
extends: [
58-
// Other configs...
59-
// Enable lint rules for React
60-
reactX.configs['recommended-typescript'],
61-
// Enable lint rules for React DOM
62-
reactDom.configs.recommended,
63-
],
64-
languageOptions: {
65-
parserOptions: {
66-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
67-
tsconfigRootDir: import.meta.dirname,
68-
},
69-
// other options...
70-
},
71-
},
72-
])
7344
```
45+
src/
46+
├── common/
47+
│ ├── types/ # Shared types (re-exported from SDK + enrichment types)
48+
│ └── utils/ # apiError, notifyError helpers
49+
├── components/
50+
│ ├── AuthContext/ # MSAL auth provider + useAuth()
51+
│ ├── EventsContext/ # Fetches all events on mount; useEvents()
52+
│ ├── ProfileContext/ # Fetches RSVP profile after auth; useProfile()
53+
│ ├── RsvpsContext/ # Fetches user RSVPs, enriches with event data; useRsvps()
54+
│ ├── Layout/ # MainLayout shell
55+
│ └── Logo/
56+
├── pages/
57+
│ ├── events/ # Upcoming events list + RSVP flow
58+
│ ├── rsvps/ # My RSVPs (view, cancel)
59+
│ ├── profile/ # RSVP profile create/edit
60+
│ └── Home.page.tsx # Dashboard
61+
└── App.tsx / Router.tsx / main.tsx
62+
```
63+
64+
## Architecture Notes
65+
66+
- **Context-based caching**`EventsContext`, `ProfileContext`, and `RsvpsContext` each fetch once and expose a `refetch()` for manual refresh. Provider order in `main.tsx`: `Auth → Events → Profile → RSVPs`.
67+
- **SDK usage** — all API calls go through `@acm-uiuc/core-client`. Auth tokens (`xUiucToken`) and Turnstile tokens (`xTurnstileResponse`) are passed as typed request parameters, not headers.
68+
- **Empty-body responses** — RSVP POST and DELETE return 201/200 with empty bodies. Use the `Raw` SDK variant (`apiV1Rsvp...Raw`) and skip `.value()` to avoid JSON parse errors.
69+
- **Error notifications** — all errors surface via `showApiErrorNotification()` (`src/common/utils/notifyError.tsx`) which shows a Mantine notification with the error title, message, optional request ID, and a mailto report link.

src/assets/react.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/common/types/event.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
1-
export interface Event {
2-
id: string;
3-
title: string;
4-
description: string;
5-
location: string;
6-
locationLink?: string;
7-
host: string;
8-
start: string;
9-
end?: string;
10-
featured: boolean;
11-
rsvpEnabled: boolean;
12-
repeats?: string;
13-
imageUrl?: string;
14-
}
1+
export type { ApiV1EventsGet200ResponseInner as Event } from '@acm-uiuc/core-client';

src/common/types/rsvp.ts

Lines changed: 4 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
export interface RsvpItem {
2-
createdAt: number;
3-
eventId: string;
4-
userId: string;
5-
}
1+
export type {
2+
ApiV1RsvpProfileMeGet200Response as RsvpProfile,
3+
ApiV1RsvpEventEventIdGet200ResponseInner as RsvpItem,
4+
} from '@acm-uiuc/core-client';
65

76
export interface EnrichedRsvp {
87
eventId: string;
@@ -17,186 +16,6 @@ export interface EnrichedRsvp {
1716
featured?: boolean;
1817
}
1918

20-
export interface RsvpProfile {
21-
gradYear: number;
22-
gradMonth: string;
23-
expectedDegree: string;
24-
intendedMajor: string;
25-
interests: string[];
26-
dietaryRestrictions: string[];
27-
updatedAt: number;
28-
}
29-
30-
export interface MyProfileViewProps {
31-
getProfile: () => Promise<RsvpProfile | null>;
32-
updateProfile: (profile: Omit<RsvpProfile, 'updatedAt'>, turnstileToken: string) => Promise<void>;
33-
isFirstTime: boolean;
34-
}
35-
36-
export const SCHOOL_YEARS = ["Freshman", "Sophomore", "Junior", "Senior", "Graduate"];
37-
38-
export const MAJORS = [
39-
"ACES Undeclared",
40-
"Accountancy",
41-
"Accountancy + Data Science",
42-
"Actuarial Science",
43-
"Advertising",
44-
"Aerospace Engineering",
45-
"African American Studies",
46-
"Agricultural & Biological Engineering",
47-
"Agricultural & Consumer Economics",
48-
"Agricultural Leadership, Education, & Communications",
49-
"Agronomy",
50-
"Animal Sciences",
51-
"Anthropology",
52-
"Architectural Studies",
53-
"Art & Art History",
54-
"Art Education",
55-
"Art History",
56-
"Art Undeclared",
57-
"Asian American Studies",
58-
"Astronomy",
59-
"Astronomy + Data Science",
60-
"Astrophysics",
61-
"Atmospheric Sciences",
62-
"Biochemistry",
63-
"Bioengineering",
64-
"Brain & Cognitive Science",
65-
"Business + Data Science",
66-
"Business Undeclared",
67-
"Chemical Engineering",
68-
"Chemical Engineering + Data Science",
69-
"Chemistry",
70-
"Civil Engineering",
71-
"Classics",
72-
"Communication",
73-
"Community Health",
74-
"Comparative & World Literature",
75-
"Computer Engineering",
76-
"Computer Science",
77-
"Computer Science + Advertising",
78-
"Computer Science + Animal Sciences",
79-
"Computer Science + Anthropology",
80-
"Computer Science + Astronomy",
81-
"Computer Science + Bioengineering",
82-
"Computer Science + Chemistry",
83-
"Computer Science + Crop Sciences",
84-
"Computer Science + Economics",
85-
"Computer Science + Education",
86-
"Computer Science + Geography & Geographic Information Science",
87-
"Computer Science + Linguistics",
88-
"Computer Science + Music",
89-
"Computer Science + Philosophy",
90-
"Computer Science + Physics",
91-
"Creative Writing",
92-
"Crop Sciences",
93-
"Dance",
94-
"Dietetics and Nutrition",
95-
"Early Childhood Education",
96-
"Earth, Society, & Environmental Sustainability",
97-
"East Asian Languages & Cultures",
98-
"Econometrics & Quantitative Economics",
99-
"Economics",
100-
"Electrical Engineering",
101-
"Elementary Education",
102-
"Engineering Mechanics",
103-
"Engineering Technology & Management for Agricultural Systems",
104-
"Engineering Undeclared",
105-
"English",
106-
"Environmental Engineering",
107-
"Finance",
108-
"Finance + Data Science",
109-
"Food Science",
110-
"French",
111-
"French (Teaching)",
112-
"Gender & Women's Studies",
113-
"Geography & Geographic Information Science",
114-
"Geology",
115-
"German (Teaching)",
116-
"Germanic Studies",
117-
"Global Studies",
118-
"Graphic Design",
119-
"History",
120-
"History of Art",
121-
"Hospitality Management",
122-
"Human Development & Family Studies",
123-
"Individual Plans of Study",
124-
"Industrial Design",
125-
"Industrial Engineering",
126-
"Information Sciences",
127-
"Information Sciences + Data Science",
128-
"Information Systems",
129-
"Innovation, Leadership & Engineering Entrepreneurship",
130-
"Instrumental Music",
131-
"Integrative Biology",
132-
"Interdisciplinary Health Sciences",
133-
"Interdisciplinary Studies",
134-
"Italian",
135-
"Jazz Performance",
136-
"Journalism",
137-
"Kinesiology",
138-
"Landscape Architecture",
139-
"Latin American Studies",
140-
"Latina/Latino Studies",
141-
"Learning & Education Studies",
142-
"Liberal Studies",
143-
"Linguistics",
144-
"Linguistics and TESL",
145-
"Lyric Theatre",
146-
"Management",
147-
"Marketing",
148-
"Materials Science & Engineering",
149-
"Materials Science & Engineering + Data Science",
150-
"Mathematics",
151-
"Mathematics & Computer Science",
152-
"Mechanical Engineering",
153-
"Media",
154-
"Media & Cinema Studies",
155-
"Middle Grades Education",
156-
"Molecular & Cellular Biology",
157-
"Molecular and Cellular Biology + Data Science",
158-
"Music",
159-
"Music Composition",
160-
"Music Education",
161-
"Music Technology",
162-
"Musicology",
163-
"Natural Resources & Environmental Sciences",
164-
"Neural Engineering",
165-
"Neuroscience",
166-
"Nuclear, Plasma, & Radiological Engineering",
167-
"Nuclear, Plasma, and Radiological Engineering + Data Science",
168-
"Nutrition and Health",
169-
"Operations Management",
170-
"Philosophy",
171-
"Physics",
172-
"Plant Biotechnology",
173-
"Political Science",
174-
"Portuguese",
175-
"Psychology",
176-
"Recreation, Sport & Tourism",
177-
"Religion",
178-
"Russian, East European, & Eurasian Studies",
179-
"Secondary Education",
180-
"Slavic Studies",
181-
"Social Work",
182-
"Sociology",
183-
"Spanish",
184-
"Spanish (Teaching)",
185-
"Special Education",
186-
"Speech & Hearing Science",
187-
"Statistics",
188-
"Statistics & Computer Science",
189-
"Strategy, Innovation and Entrepreneurship",
190-
"Studio Art",
191-
"Supply Chain Management",
192-
"Sustainability in Food & Environmental Systems",
193-
"Sustainable Design",
194-
"Systems Engineering and Design",
195-
"Teaching - Middle Grades Education",
196-
"Theatre",
197-
"Urban Studies & Planning",
198-
"Voice"
199-
];
20019

20120
export const COMMON_INTERESTS = [
20221
"AI/Machine Learning",

0 commit comments

Comments
 (0)