Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS: add /about and /projects base paths #2519

Merged
merged 3 commits into from
Nov 10, 2021
Merged

Conversation

eatyourgreens
Copy link
Contributor

  • Set next.config.basePath to /about for content pages and /projects for projects.
  • Remove the corresponding page paths so that page URLs don't change.
  • Update asset prefix URLs so that static assets don't break.

Package:
app-project
app-content-pages

Towards #2518.

Review Checklist

General

  • Are the tests passing locally and on Travis?
  • Is the documentation up to date?

Components

Apps

  • Does it work in all major browsers: Firefox, Chrome, Edge, Safari?
  • Does it work on mobile?
  • Can you yarn panic && yarn bootstrap or docker-compose up --build and app works as expected?

Publishing

  • Is the changelog updated?
  • Are the dependencies updated for apps and libraries that are using the newly published library?

Post-merging

@eatyourgreens eatyourgreens added enhancement New feature or request ops Changes that affect how something is built or deployed labels Nov 5, 2021
@eatyourgreens eatyourgreens requested review from camallen and a team November 5, 2021 10:31
@eatyourgreens
Copy link
Contributor Author

@@ -61,7 +61,7 @@ spec:
- containerPort: 3000
env:
- name: PROJECT_ASSET_PREFIX
value: https://fe-project.zooniverse.org
value: https://fe-project.zooniverse.org/projects
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed to https://www.zooniverse.org/projects, once routing is set up.

@@ -153,7 +153,7 @@ spec:
- containerPort: 3000
env:
- name: CONTENT_ASSET_PREFIX
value: https://fe-content-pages.zooniverse.org
value: https://fe-content-pages.zooniverse.org/about
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can change to https://www.zooniverse.org/about.

@@ -51,7 +51,7 @@ spec:
- containerPort: 3000
env:
- name: PROJECT_ASSET_PREFIX
value: https://fe-project.preview.zooniverse.org
value: https://fe-project.preview.zooniverse.org/projects
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can change to https://frontend.preview.zooniverse.org/projects.

@@ -135,7 +135,7 @@ spec:
- containerPort: 3000
env:
- name: CONTENT_ASSET_PREFIX
value: https://fe-content-pages.preview.zooniverse.org
value: https://fe-content-pages.preview.zooniverse.org/about
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can change to https://frontend.preview.zooniverse.org/about.

 - Set `next.config.basePath` to `/about` for content pages and `/projects` for projects.
 - Remove the corresponding page paths so that page URLs don't change.
 - Update asset prefix URLs so that static assets don't break.
@eatyourgreens
Copy link
Contributor Author

@camallen would it be ok to merge this? I’d like to see how it works behind nginx, on staging.

@eatyourgreens
Copy link
Contributor Author

Looking at the placeholder images for subjects, on a staging page, those are being served directly from https://fe-project.preview.zooniverse.org/subject-placeholder.png. That won't break here, they'll still be served to the browser from fe-project, but that's another static asset that should be served via the CDN.

https://frontend.preview.zooniverse.org/projects/eatyourgreens/-project-testing-ground/classify/workflow/3223?env=staging
A screenshot of Zooniverse logo placeholder images listed under Your Recent Classifications.

@eatyourgreens
Copy link
Contributor Author

There's one other static image that's served directly from the origin at the moment: https://fe-project.preview.zooniverse.org/simple-avatar.png on the team pages.

https://frontend.preview.zooniverse.org/projects/eatyourgreens/-project-testing-ground/about/team?env=staging

Copy link
Contributor

@camallen camallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - happy to get this to staging and iterate. One assumption is this won't impact any production deployment when it ships - we need to be quick to fix any issues if they arise on production.

@@ -29,6 +29,7 @@ const COMMIT_ID = process.env.COMMIT_ID || commitID()

const nextConfig = {
assetPrefix,
basePath: '/about',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we allow this to be modified by ENV var with the default /about as fallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. It changes the URL of all the pages served by the app and I'm not sure I see the value of changing those from /about/team and /about/publications to a different URL.

@@ -19,9 +19,10 @@ function commitID () {
}
}

const basePath = '/projects'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again - any use in allowing this to be set via ENV var with the above as fallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. I'm not sure about the value of changing project URLs away from /projects/:owner:/:project:, with the associated overhead of updating our static setup.

@github-actions github-actions bot added the approved This PR is approved for merging label Nov 10, 2021
@eatyourgreens
Copy link
Contributor Author

One assumption is this won't impact any production deployment when it ships - we need to be quick to fix any issues if they arise on production.

Agreed. That's why I'd like to get it out on staging: so we can test it out when URL rewriting is in place.

@eatyourgreens eatyourgreens merged commit 3825231 into master Nov 10, 2021
@eatyourgreens eatyourgreens deleted the next-basepaths branch November 10, 2021 10:14
eatyourgreens added a commit that referenced this pull request Nov 10, 2021
#2519 added /projects as a base path for the project app. This PR updates links, which have been hardcoded with `/projects` and now point to `/projects/projects/:owner:/:name:`.
eatyourgreens added a commit that referenced this pull request Nov 10, 2021
#2519 added /projects as a base path for the project app. This PR updates links, which have been hardcoded with `/projects` and now point to `/projects/projects/:owner:/:name:`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved This PR is approved for merging enhancement New feature or request ops Changes that affect how something is built or deployed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants