Commit Graph

10 Commits

Author SHA1 Message Date
Aditya Thakral eacb858faa Fix comments
continuous-integration/drone/push Build is passing Details
2022-08-08 01:05:20 -07:00
Aditya Thakral 2cbba93d9d Add json schema
continuous-integration/drone/push Build is passing Details
2022-08-07 17:37:45 -07:00
Aditya Thakral a7eac7b81e Create members api 2022-08-07 17:01:43 -07:00
Amy Wang 14ef810ad9 Image Optimization - Create new ImagePool for each batch (#470)
continuous-integration/drone/push Build is passing Details
We have been having issues with the image optimization script consuming egregious amounts of memory and failing CI as a result.

This PR changes the script so that we use a new `ImagePool` to process each batch of images.

Co-authored-by: Amy <>
Reviewed-on: #470
Reviewed-by: Shahan Neda <>
2022-06-28 22:54:20 -04:00
Amy Wang 443925190e Improve image optimization run-time and memory usage (#457)
continuous-integration/drone/push Build is passing Details
This PR aims to resolve the issues surrounding the optimize-images script, at least in the short term, in order to unblock other work.

**Problems:** Our optimize-images script was taking a very long time to run (~7 minutes in CI, when successful). This led to two problems:
1. It was near impossible to run the script locally.
2. CI jobs would often get killed on the optimize-images step.

1. Resize the images in `images/events` prior to optimizing them, similar to what is done for the images in `images/team`. This solution on its own reduced the run-time of the script to ~30 seconds locally on Amy's laptop, which is comparable to the run-time of the script back when it was originally written.
2. EDIT: Copy/resize/optimize the images in batches of 32 at a time. The reason why the CI job was being killed is because the script would run out of memory, however this change should resolve that while also keeping build times reasonable (~30 sec locally/when deploying on caffeine, ~3 min in CI). ~~As a temporary fix, this PR also replaces the images in `images/events` with their resized + optimized versions. (For some unknown reason, Solution 1 is not sufficient to solve Problem 2.)~~

This PR also adds some logging to the script so we can get a (slightly) better sense of where the script is getting stuck.

Related issue: #456

Co-authored-by: Amy <>
Reviewed-on: #457
Reviewed-by: Shahan Neda <>
2022-06-04 19:31:00 -04:00
Shahan Nedadahandeh f12ffbb925 Add endDate to events (#446)
continuous-integration/drone/push Build is passing Details
Added endDate to events.
2022-05-25 20:58:12 -04:00
Shahan Nedadahandeh bb78a3d53d Warning Header (Closes #205) (#394)
continuous-integration/drone/push Build is passing Details
In order to solve the issues discussed below, we decided to put the warnings in a json file, since they can be easily imported into a javascript file and webpack automatically bundles them with the client side app, so no static props is needed.


To get the warning data, since it is something that needs to be on all pages, it makes sense for the component to go in the app.js file (similar to the nav bar). However, next.js has a cumbersome issue that it does not support getStaticProps in the app.ts file (and getStaticProps only works in page files), thus we have no way of requesting the warning data easily in the \<WarningHeader\> Component. (

Here is my solution:
- Request the warning data on the client side through the use of an api.
    - I made a warning api (/api/currentWarning) which sends a json of the current warning
    - Advantage: warnings will always be up to date since it is recalculated on every request
    - Advantage: It can potentially incorporate with other CSC services who might need to know about the warning (eg linktree?)
    - Disadvantage: can get expensive if we have a lot of warnings, to fix this I can cache the current warning and only re-read the files every 24h if this is a problem, but if we don’t have that many warnings I think it should be fine
    - Disadvantage: listed below:

The current problem with what I implemented is that it doesn’t build in the production environment:
- The way we build the website, when we call “next export” that disables any api endpoints.
- According to this, if we want to allow api endpoints, we have to just do “next build”. This has implications that the site won’t be completely static anymore, but the other solutions also have similar problems  ( though the GitHub post says that next will still optimize for static with only next build).

Another advantage of allowing api’s is that maybe in the future we will implement other features where an api might be useful.

If you want to try it out, my branch works fine locally (when just running npm run dev or npm run build”)

Other possible solutions:
- Use getInitialProps inside _app.js, but this has the downside that it will “disable Automatic Static Optimization in pages without Static Generation.” (, which I believe will slow the whole site down, but, we will be able to still use the old build command I think, I am not sure of the full effect of this.
	- However, implementing this would also be relatively simple.

- Add the warning request to the getStaticProps of every single page, possibly through some wrapper component around every single page, this has the disadvantage that we need to do a lot of refactoring of all the pages of the site and cant use the intended “_app.ts” wrapper.

- Add warning header only to the homepage (or maybe one or two other important pages).

Co-authored-by: shahanneda <>
Reviewed-on: #394
Reviewed-by: Amy <>
2022-02-22 23:29:53 -05:00
Amy Wang aae5c9adef Image Optimization Script (#348)
continuous-integration/drone/push Build is passing Details
A build-time script to optimize images. Note that going forward, all images should be placed in `images` instead of `public/images`.

Co-authored-by: Amy <>
Reviewed-on: #348
Reviewed-by: Aditya Thakral <>
Reviewed-by: n3parikh <>
Co-authored-by: Amy <>
Co-committed-by: Amy <>
2021-10-31 16:58:14 -04:00
Aditya Thakral 47352f4e82 Change date format for events and news (#343)
continuous-integration/drone/push Build is passing Details

Reviewed-on: #343
Reviewed-by: b38peng <>
Co-authored-by: Aditya Thakral <>
Co-committed-by: Aditya Thakral <>
2021-10-13 21:36:08 -04:00
Aditya Thakral 34fb652fb9 Dynamically generate event calendar (#332)
continuous-integration/drone/push Build is passing Details
Closes #134

- Dynamically generates the calendar before the export step
- I tested it with google calendar, updates are propagating as expected (it takes a day for google calendar to get updated)

You can try adding this URL to your calendar to test things out:

Reviewed-on: #332
Reviewed-by: n3parikh <>
Co-authored-by: Aditya Thakral <>
Co-committed-by: Aditya Thakral <>
2021-09-27 16:20:18 -04:00