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

Redirect the homepage to static proxy #7176

Merged
merged 4 commits into from
Sep 17, 2024
Merged

Conversation

goplayoutside3
Copy link
Contributor

@goplayoutside3 goplayoutside3 commented Sep 13, 2024

❌ Do not deploy until Sept 17

Describe your changes.

  • Removed react-router Link components from links we want to hit the static proxy (and passed on to FEM)
  • Added a redirect to the router for /.
  • Noted in PFE's readme this app is no longer used for the homepage so you must have a /subpath when run locally.

How To Review

Visit https://pr-7176.pfe-preview.zooniverse.org and you'll be redirected to "www".
❓ The consequence of adding a redirect like this to the router is you can't use the browser back button 🤔 The only scenario where someone might hit this redirect though is if '/' is used in markdown beyond our control. All other links to the homepage are hardcoded to www.

Visit subpaths that are intended to still use PFE such as /lab and /talk and /projects and see the app still works.

@@ -177,9 +177,9 @@ export default class NotificationSection extends Component {
avatar = <img src={src} className="notification-section__img" alt="Project Avatar" />;
}
return (
<Link to={this.props.slug ? `/projects/${this.props.slug}` : '/'}>
<a href={this.props.slug ? `https://www.zooniverse.org/projects/${this.props.slug}` : 'https://www.zooniverse.org'}>
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 totally sure about this one. Should it be <a href={this.props.slug ?/projects/${this.props.slug} : 'https://www.zooniverse.org'}> because the notifications page is PFE and if there is a slug prop then you'd want to stay on PFE?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I think this can remain as Link. For FEM projects the PFE rerouting will kick in. But this works, and eventually when all projects migrate we'll need to make a handful of similar changes.

@coveralls
Copy link

coveralls commented Sep 13, 2024

Coverage Status

coverage: 56.717%. remained the same
when pulling eb56f38 on redirect-home-links
into 8c0a0c5 on master.

Comment on lines 4 to 7
<div className="content-container">
<p>Your classification stats are now displayed on <Link to="/">your Zooniverse home page</Link>.</p>
</div> No newline at end of file
<p>Your classification stats are now displayed on <Link to="https://www.zooniverse.org">your Zooniverse home page</Link>.</p>
</div>
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 component is a fallback message for the Stats button on your profile page (e.g. https://www.zooniverse.org/users/[login]/stats prior to Sept 17 launch of new pages). Likely to be forever ignored after this PR is deployed, but being thorough 💁‍♀️

Comment on lines 97 to -100
<Route path="/" component={require('./partials/app')}>
<IndexRoute component={HomePageRoot} />
<IndexRoute component={() => <ExternalRedirect newUrl='https://www.zooniverse.org' />} />
<Route path="home" component={ONE_UP_REDIRECT} />
<Route path="home-for-user" component={require('./pages/home-for-user').default} />
Copy link
Contributor Author

@goplayoutside3 goplayoutside3 Sep 13, 2024

Choose a reason for hiding this comment

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

These changes are the most consequential. There has to be a <Route path="/" importing './partials/app' in order for PFE to work at all. However, the ExternalRedirect in IndexRoute does the redirecting when a browser hits /.

I also kept path="home" because I'm unsure of its legacy, but if you hit /home you'll be redirected to the static proxy (and passed on to FEM). It was mentioned here: #6041

@mcbouslog mcbouslog self-assigned this Sep 13, 2024
Copy link
Contributor

@mcbouslog mcbouslog left a comment

Choose a reason for hiding this comment

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

LGTM! Browsing around, clicking links locally works as expected 👍 . Very exciting. Good to update README about running locally, I'm not sure what else we can do.

@goplayoutside3 goplayoutside3 merged commit 8036774 into master Sep 17, 2024
5 checks passed
@goplayoutside3 goplayoutside3 deleted the redirect-home-links branch September 17, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants