Replacing all Link with custom Link that scrolls to the top (so we can detect forward vs backward navigation)

This commit is contained in:
James Barnsley
2018-10-24 21:34:41 +13:00
parent 42414b25d3
commit 0bafa7e97b
43 changed files with 265 additions and 118 deletions

View File

@ -2,8 +2,8 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import Link from '../components/Link';
import LazyLoadListener from '../components/LazyLoadListener'
import Header from '../components/Header'
import TrackList from '../components/TrackList'
@ -223,7 +223,7 @@ class Artist extends React.Component{
<div className="col col--w5"></div>
{artist.related_artists ? <div className="col col--w25 related-artists"><h4>Related artists</h4><div className="list-wrapper"><RelatedArtists artists={artist.related_artists.slice(0,6)} /></div><Link to={global.baseURL+'artist/'+artist.uri+'/related-artists'} className="button grey">All related artists</Link></div> : null}
{artist.related_artists && artist.related_artists.length > 0 ? <div className="col col--w25 related-artists"><h4>Related artists</h4><div className="list-wrapper"><RelatedArtists artists={artist.related_artists.slice(0,6)} /></div><Link to={global.baseURL+'artist/'+artist.uri+'/related-artists'} className="button grey">All related artists</Link></div> : null}
<div className="cf"></div>

View File

@ -1,12 +1,13 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { Link, hashHistory } from 'react-router'
import { hashHistory } from 'react-router'
import { bindActionCreators } from 'redux'
import Header from '../components/Header'
import Thumbnail from '../components/Thumbnail'
import Icon from '../components/Icon'
import Link from '../components/Link';
import * as uiActions from '../services/ui/actions'
import * as pusherActions from '../services/pusher/actions'

View File

@ -2,7 +2,8 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link, hashHistory } from 'react-router'
import { hashHistory } from 'react-router'
import Link from '../components/Link';
import ReactGA from 'react-ga'
import TrackList from '../components/TrackList'

View File

@ -1,7 +1,8 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { hashHistory, Link } from 'react-router'
import { hashHistory } from 'react-router'
import Link from '../components/Link';
import { bindActionCreators } from 'redux'
import Icon from '../components/Icon'

View File

@ -1,7 +1,8 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { Link, hashHistory } from 'react-router'
import { hashHistory } from 'react-router'
import Link from '../components/Link';
import { bindActionCreators } from 'redux'
import Header from '../components/Header'

View File

@ -1,7 +1,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { Link } from 'react-router'
import Link from '../components/Link';
import { bindActionCreators } from 'redux'
import Header from '../components/Header'

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import Link from '../../components/Link';
import PlaylistGrid from '../../components/PlaylistGrid'
import Header from '../../components/Header'

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import Link from '../../components/Link';
import Header from '../../components/Header'
import Icon from '../../components/Icon'

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { Link } from 'react-router';
import Link from '../../components/Link';
import AlbumGrid from '../../components/AlbumGrid';
import List from '../../components/List';

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { Link } from 'react-router';
import Link from '../../components/Link';
import Header from '../../components/Header';
import ArtistGrid from '../../components/ArtistGrid';

View File

@ -2,7 +2,8 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link, hashHistory } from 'react-router'
import { hashHistory } from 'react-router'
import Link from '../../components/Link';
import Header from '../../components/Header'
import List from '../../components/List'

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import Link from '../../components/Link';
import PlaylistGrid from '../../components/PlaylistGrid'
import List from '../../components/List'

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import Link from '../../components/Link';
import TrackList from '../../components/TrackList'
import Header from '../../components/Header'

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import Link from '../../components/Link'
import ReactGA from 'react-ga'
import Modal from './Modal';

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import Link from '../../components/Link'
import ReactGA from 'react-ga'
import Modal from './Modal';

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import Link from '../../components/Link'
import ReactGA from 'react-ga'
import Modal from './Modal';

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import Link from '../../components/Link'
import ReactGA from 'react-ga'
import Modal from './Modal';

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import Link from '../../components/Link'
import ReactGA from 'react-ga'
import Modal from './Modal';

View File

@ -2,7 +2,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import Link from '../../components/Link'
import ReactGA from 'react-ga'
import Modal from './Modal';

View File

@ -2,7 +2,8 @@
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { Link, hashHistory } from 'react-router';
import { hashHistory } from 'react-router'
import Link from '../../components/Link'
import ReactGA from 'react-ga';
import Modal from './Modal';

View File

@ -1,7 +1,7 @@
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import Link from '../../components/Link'
import { createStore, bindActionCreators } from 'redux';
import Modal from './Modal';

View File

@ -1,7 +1,7 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { Link } from 'react-router'
import Link from '../../components/Link'
import { createStore, bindActionCreators } from 'redux'
import Modal from './Modal';