OperationCode / operationcode_frontend

Front-end repository for live site. Please go to `front-end` repo to contribute instead.
https://operationcode.org
MIT License
101 stars 222 forks source link

Use AWS S3 bucket for all images and delete local assets #931

Closed kylemh closed 5 years ago

kylemh commented 6 years ago

Feature

Why is this feature being added?

  1. We're not supposed to be using GitHub as an asset API.
  2. We'll eventually be moving to a CDN, and AWS pairs well with CDNs.
  3. By guarding access to asset generation, we'll ensure higher quality assets (optimized, properly resolute).

What should your feature do?

Remove all local image imports and access them via XHR --> AWS

Here's a list of all the hero banner urls: https://s3.amazonaws.com/operationcode-assets/heroBanners/churchill.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/colin-powell.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/lincoln.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/op_code_con_raleigh.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/stock_family-2.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/stock_family-2_mobile.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/stock_family-3.jpg

Here are all of the MOOC school logo URLs: https://s3.amazonaws.com/operationcode-assets/heroBanners/edx.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/treehouse.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/udacity.jpg

Please add to this checklist if there are any other areas that are using local images:

If you'd like a filename changed for the sake of dynamic reference, simply demand the file you'd like changed in this issue.

dmarchante commented 6 years ago

can anyone finish this out while reworks the FE, or would you rather finish this out when you have time @kylemh

billy-le commented 6 years ago

I'll take this one. I'll reach out to you @kylemh via Slack.

kylemh commented 6 years ago

@lebilly feel free to take this one! The assets are already available to you via S3. The work needed here is simply to stop using the images locally via import and instead create a flexible mapping to the s3 urls.

See src/scenes/home/codeSchools/partnerSchools/partnerSchools.js for an example. (line 34)

I believe a better of doing this moving forward would be to map https://s3.amazonaws.com/operationcode-assets/ as a common variable near the top-level of the repo. Every file should then import that variable and concatenate off of it to generate the correct URL.

Here's a list of all the hero banner urls: https://s3.amazonaws.com/operationcode-assets/heroBanners/churchill.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/colin-powell.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/lincoln.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/op_code_con_raleigh.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/stock_family-2.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/stock_family-2_mobile.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/stock_family-3.jpg

Here are all of the MOOC school logo URLs: https://s3.amazonaws.com/operationcode-assets/heroBanners/edx.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/treehouse.jpg https://s3.amazonaws.com/operationcode-assets/heroBanners/udacity.jpg


If you'd like a filename changed for the sake of dynamic reference, simply demand the file you'd like changed in this issue.

dmarchante commented 6 years ago

@lebilly How is progress going?

kylemh commented 5 years ago

Simply implementing images in this manner from the get-go in the new repo