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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ Make sure you have Node 8 and `npm` 5 or greater. It's recommended you manage yo

### Viewing the Website

Open your web browser of choice and go to `https://localhost:3735/`
The root `/` is redirected to www.zooniverse.org because this frontend app is no longer used for the homepage. Point your browser to a subpath to view this app run locally.

If you want to _login_ via the Panoptes API and _view authenticated pages,_ then you'll need to set up and use `https://local.zooniverse.org:3735` instead of using localhost:3735. Otherwise, you'll run into CORS errors. (You need to add the hostname to your hosts file, pointing to local. Instructions are on [our Stackoverflow](https://stackoverflow.com/c/zooniverse/questions/109).)
Open your web browser of choice and go to `https://localhost:3735/lab`

If you want to _login_ via the Panoptes API and _view authenticated pages,_ then you'll need to set up and use `https://local.zooniverse.org:3735/lab` instead of using localhost:3735. Otherwise, you'll run into CORS errors. (You need to add the hostname to your hosts file, pointing to local. Instructions are on [our Stackoverflow](https://stackoverflow.com/c/zooniverse/questions/109).)

**Troubleshooting: web browser blocks local website**

Expand Down
9 changes: 4 additions & 5 deletions app/layout/account-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,13 @@ export default class AccountBar extends React.Component {
<Translate content="accountMenu.profile" />
</Link>
<br />
<Link
<a
role="menuitem"
to="/"
href="https://www.zooniverse.org"
className="site-nav__link"
onClick={this.logClick ? this.logClick.bind(this, 'accountMenu.home') : null}
>
<Translate content="accountMenu.home" />
</Link>
</a>
<br />
<Link
role="menuitem"
Expand Down Expand Up @@ -207,4 +206,4 @@ AccountBar.contextTypes = {
AccountBar.propTypes = {
params: PropTypes.object,
isMobile: PropTypes.bool
};
};
17 changes: 6 additions & 11 deletions app/layout/site-nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,12 @@ const SiteNav = createReactClass({
})}
>
{!!this.state.isMobile &&
<Link
to="/"
<a
href="https://www.zooniverse.org"
className="site-nav__link"
activeClassName="site-nav__link--active"
onlyActiveOnIndex={true}
onClick={!!this.logClick ? this.logClick.bind(this, 'mainNav.home') : null}
>
<Translate content="siteNav.home" />
</Link>
</a>
}
<Link
to="/projects"
Expand Down Expand Up @@ -191,14 +188,12 @@ const SiteNav = createReactClass({
render() {
return (
<nav className="site-nav">
<IndexLink
to="/"
<a
href="https://www.zooniverse.org"
className="site-nav__link"
activeClassName="site-nav__link--active"
onClick={!!this.logClick ? this.logClick.bind(this, 'logo') : null}
>
{ZOO_LOGO}
</IndexLink>
</a>

{!this.state.isMobile && this.renderLinks()}

Expand Down
6 changes: 1 addition & 5 deletions app/pages/notifications/notification-section.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ describe('Notification Section', function() {
assert.equal(wrapper.find('.notification-section__title').text(), 'Zooniverse');
});

it('should link to the home page', function () {
assert.equal(wrapper.find('Link').prop('to'), '/');
});

it('shows the Zooniverse logo', function () {
assert.equal(wrapper.find('ZooniverseLogo').length, 1);
});
Expand Down Expand Up @@ -147,7 +143,7 @@ describe('Notification Section', function() {
user={{ id: '1' }}
/>,
{
context: { notificationsCounter },
context: { notificationsCounter },
disableLifeCycleMethods: true
}
);
Expand Down
4 changes: 2 additions & 2 deletions app/pages/profile/stats.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ React = require 'react'

module.exports = (props) =>
<div className="content-container">
<p>Your classification stats are now displayed on <Link to="/">your Zooniverse home page</Link>.</p>
</div>
<p>Your classification stats are now displayed on <Link to="https://www.zooniverse.org">your Zooniverse home page</Link>.</p>
</div>
4 changes: 2 additions & 2 deletions app/pages/profile/user.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class ProfileUser extends Component {
);
} else {
return (
<Link to="/#projects" className={classes} onClick={this.logClick.bind(this, 'stats')}>
<a href={`https://www.zooniverse.org/users/${this.props.profileUser.login}/stats`} className={classes}>
<Translate content="profile.nav.stats" />
</Link>
</a>
);
}
}
Expand Down
3 changes: 1 addition & 2 deletions app/router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ class ExternalRedirect extends React.Component {

export const routes = (
<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} />
Comment on lines 97 to -100
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


<Route path="about" onEnter={redirectAboutPage} ignoreScrollBehavior>
<Route path="team" onEnter={redirectAboutPage} />
Expand Down
Loading