Attempting to resolve scroll restoration

This commit is contained in:
James Barnsley
2018-02-16 16:58:46 +13:00
parent 5a8eca13be
commit 7d1819e9bd
46 changed files with 353 additions and 140 deletions

View File

@ -81,6 +81,19 @@ class App extends React.Component{
}*/
}
componentDidUpdate(prevProps){
// We've navigated to a new location
if (this.props.location !== prevProps.location) {
// Close context menu
this.props.uiActions.hideContextMenu();
console.log(prevProps.location);
$(window).scrollTop(0)
}
}
shouldTriggerShortcut(e){
// When we're focussed on certian elements, don't fire any shortcuts

View File

@ -166,21 +166,21 @@ export default class Parallax extends React.Component{
image.y = ((this.state.canvas.height / 2 ) - (image.height / 2 ) ) + ((percent / 100 ) * 100);
// Actually draw the image on the canvas
context.drawImage(image.object, image.x, image.y, image.width, image.height)
context.drawImage(image.object, image.x, image.y, image.width, image.height);
// now update our component
self.setState({ image: image });
}
// Construct a gradient overlay
context.rect(0, 0, this.state.canvas.width, this.state.canvas.height)
let gradient = context.createLinearGradient(0, 0, 0, this.state.canvas.height)
gradient.addColorStop(0, 'rgba(24,24,24,0)')
gradient.addColorStop(0.9, 'rgba(24,24,24,1)')
context.fillStyle = gradient
context.rect(0, 0, this.state.canvas.width, this.state.canvas.height);
let gradient = context.createLinearGradient(0, 0, 0, this.state.canvas.height);
gradient.addColorStop(0, 'rgba(24,24,24,0)');
gradient.addColorStop(0.9, 'rgba(24,24,24,1)');
context.fillStyle = gradient;
// And now drop it into place
context.fill()
context.fill();
}
render(){

View File

@ -47,10 +47,8 @@ console.error = function(message, error){
// setup our analytics tracking
ReactGA.initialize('UA-64701652-3');
function handleUpdate(){
ReactGA.set({ page: window.location.hash })
ReactGA.pageview(window.location.hash)
$(window).scrollTop(0)
store.dispatch({type: 'HIDE_CONTEXT_MENU'})
ReactGA.set({ page: window.location.hash });
ReactGA.pageview(window.location.hash);
}
global.baseURL = '/'

View File

@ -55,10 +55,10 @@ class User extends React.Component{
}
render(){
var user_id = helpers.getFromUri('userid',this.props.params.uri)
var user_id = helpers.getFromUri('userid',this.props.params.uri);
if (helpers.isLoading(this.props.load_queue,['spotify_users/'+user_id,'spotify_users/'+user_id+'/playlists/?'])){
return (
<div className="body-loader">
<div className="body-loader loading">
<div className="loader"></div>
</div>
)

View File

@ -98,7 +98,7 @@
}
&.play {
margin-bottom: -6px;
margin-bottom: -4px;
.icon {
svg {
@ -108,6 +108,8 @@
}
&.active {
color: $turquoise !important;
svg {
fill: $turquoise !important;
}
@ -123,6 +125,7 @@
bottom: 8px;
&.playback {
bottom: 6px;
left: 10px;
width: 125px;
text-align: center;

View File

@ -57,7 +57,7 @@ aside{
line-height: 18px;
.icon {
padding-right: 12px;
padding-right: 10px;
vertical-align: top;
margin-top: 0;

View File

@ -69,8 +69,6 @@
.field.current-user {
.text {
padding: 14px 14px 14px 0px;
.user {
border: 0;
position: relative;