From cfdccc0d85ee7cf9e330f5c3d111dac681efcdc9 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Tue, 7 Feb 2017 10:00:29 +1300 Subject: [PATCH] Revamp of asset designs --- src/js/components/FollowButton.js | 7 +- .../components/SpotifyAuthenticationFrame.js | 5 +- src/js/components/VersionManager.js | 8 +- src/js/services/pusher/middleware.js | 6 +- src/js/services/spotify/middleware.js | 7 +- src/js/services/ui/middleware.js | 4 +- src/js/services/ui/reducer.js | 2 +- src/js/views/Artist.js | 47 ++++------ src/js/views/Debug.js | 12 ++- src/js/views/Settings.js | 32 +++---- src/scss/global/_forms.scss | 9 ++ src/scss/views/_artist.scss | 85 +++++++------------ 12 files changed, 104 insertions(+), 120 deletions(-) diff --git a/src/js/components/FollowButton.js b/src/js/components/FollowButton.js index ecf4707d..8095d6b2 100755 --- a/src/js/components/FollowButton.js +++ b/src/js/components/FollowButton.js @@ -31,10 +31,13 @@ class FollowButton extends React.Component{ render(){ if( !this.props.spotify_authorized || !this.props.uri ) return false + var className = 'tertiary' + if (this.props.className) className += ' '+this.props.className + if( this.props.is_following === true ){ - return + return }else{ - return + return } } } diff --git a/src/js/components/SpotifyAuthenticationFrame.js b/src/js/components/SpotifyAuthenticationFrame.js index ee9ff000..c32a65e9 100755 --- a/src/js/components/SpotifyAuthenticationFrame.js +++ b/src/js/components/SpotifyAuthenticationFrame.js @@ -104,10 +104,9 @@ class SpotifyAuthenticationFrame extends React.Component{ render(){ return ( - { this.renderAuthorizeButton() } -    - { this.renderRefreshButton() } + { this.renderAuthorizeButton() } + { this.renderRefreshButton() } ); } diff --git a/src/js/components/VersionManager.js b/src/js/components/VersionManager.js index d08e4eae..0e34ece3 100755 --- a/src/js/components/VersionManager.js +++ b/src/js/components/VersionManager.js @@ -33,15 +33,15 @@ class VersionManager extends React.Component{ return } - return + return } render(){ return ( -
+ { this.renderUpgradeButton() } -
{ this.props.pusher.version.current } currently installed
-
+ { this.props.pusher.version.current } installed + ); } } diff --git a/src/js/services/pusher/middleware.js b/src/js/services/pusher/middleware.js index 7fd8942e..5fa23bb0 100755 --- a/src/js/services/pusher/middleware.js +++ b/src/js/services/pusher/middleware.js @@ -130,13 +130,13 @@ const PusherMiddleware = (function(){ request({ action: 'get_version' }) .then( response => { - store.dispatch({ type: 'VERSION', version: response.data.version }) + store.dispatch({ type: 'VERSION', data: response.data }) } ) request({ action: 'get_radio' }) .then( response => { - store.dispatch({ type: 'RADIO', radio: response.data.radio }) + store.dispatch({ type: 'RADIO', data: response.data }) } ) return next(action); @@ -155,7 +155,7 @@ const PusherMiddleware = (function(){ }else{ store.dispatch( uiActions.createNotification('Upgrade failed, please upgrade manually','bad') ) } - store.dispatch({ type: 'VERSION', version: response.data.version }) + store.dispatch({ type: 'VERSION', data: response.data }) } ) return next(action); diff --git a/src/js/services/spotify/middleware.js b/src/js/services/spotify/middleware.js index 6081e4eb..c7de90fa 100755 --- a/src/js/services/spotify/middleware.js +++ b/src/js/services/spotify/middleware.js @@ -86,15 +86,14 @@ const SpotifyMiddleware = (function(){ } break - // when our mopidy server current track changes + // when radio returns case 'RADIO': - // proceed as usual so we don't inhibit default functionality next(action) // only resolve if radio is enabled - if( action.radio.enabled ){ - store.dispatch(spotifyActions.resolveRadioSeeds(action.radio)) + if( action.data.radio.enabled ){ + store.dispatch(spotifyActions.resolveRadioSeeds(action.data.radio)) } break diff --git a/src/js/services/ui/middleware.js b/src/js/services/ui/middleware.js index 6f6c9d2a..3d3a99f5 100755 --- a/src/js/services/ui/middleware.js +++ b/src/js/services/ui/middleware.js @@ -210,8 +210,8 @@ const UIMiddleware = (function(){ break case 'VERSION': - if( action.version.upgrade_available ) - store.dispatch( uiActions.createNotification( 'Version '+action.version.latest+' is available. See settings to upgrade.' ) ) + if( action.data.version.upgrade_available ) + store.dispatch( uiActions.createNotification( 'Version '+action.data.version.latest+' is available. See settings to upgrade.' ) ) next( action ) break diff --git a/src/js/services/ui/reducer.js b/src/js/services/ui/reducer.js index 32e969b2..960b5c1c 100755 --- a/src/js/services/ui/reducer.js +++ b/src/js/services/ui/reducer.js @@ -121,7 +121,7 @@ export default function reducer(ui = {}, action){ case 'RADIO': case 'START_RADIO': - return Object.assign({}, ui, { seeds_resolved: false }, { radio: action.radio }) + return Object.assign({}, ui, { seeds_resolved: false }, { radio: action.data.radio }) case 'RADIO_SEEDS_RESOLVED': var radio = Object.assign({}, ui.radio, { resolved_seeds: action.resolved_seeds }) diff --git a/src/js/views/Artist.js b/src/js/views/Artist.js index 259276d1..67db2b96 100755 --- a/src/js/views/Artist.js +++ b/src/js/views/Artist.js @@ -84,12 +84,6 @@ class Artist extends React.Component{ this.props.spotifyActions.getURL( this.props.artist.albums_more, 'SPOTIFY_ARTIST_ALBUMS_LOADED', this.props.params.uri ); } - play(){ - if (!this.props.artist.uri) return - this.props.uiActions.createNotification('Starting radio...') - this.props.pusherActions.startRadio([this.props.artist.uri]) - } - renderSubViewMenu(){ return (
@@ -105,6 +99,8 @@ class Artist extends React.Component{ } renderBody(){ + var scheme = helpers.uriSource( this.props.params.uri ); + var related_artists = [] if (this.props.artist.related_artists_uris){ for (var i = 0; i < this.props.artist.related_artists_uris.length; i++){ @@ -138,6 +134,17 @@ class Artist extends React.Component{ return (

Biography

+ +
    +
  • + { this.props.artist.followers ? { this.props.artist.followers.total.toLocaleString() } followers,  : null } + { this.props.artist.popularity ? { this.props.artist.popularity }% popularity : null } + { this.props.artist.listeners && scheme == 'local' ? { this.props.artist.listeners.toLocaleString() } listeners : null } +
  • + { scheme == 'spotify' ?
  • Spotify artist
  • : null } + { scheme == 'local' ?
  • Local artist
  • : null } +
+
{ this.props.artist.bio ?

{this.props.artist.bio.content}


Published: { this.props.artist.bio.published }
@@ -183,33 +190,15 @@ class Artist extends React.Component{
- -
-
-

{ this.props.artist.name }

- { this.renderSubViewMenu() } -
-
- -
- +
+

{ this.props.artist.name }

- - { helpers.uriSource(this.props.params.uri) == 'spotify' ? : null } + + { scheme == 'spotify' ? : null }
- -
    -
  • - { this.props.artist.followers ? { this.props.artist.followers.total.toLocaleString() } followers,  : null } - { this.props.artist.popularity ? { this.props.artist.popularity }% popularity : null } - { this.props.artist.listeners && scheme == 'local' ? { this.props.artist.listeners.toLocaleString() } listeners : null } -
  • - { scheme == 'spotify' ?
  • Spotify artist
  • : null } - { scheme == 'local' ?
  • Local artist
  • : null } -
- + { this.renderSubViewMenu() }
diff --git a/src/js/views/Debug.js b/src/js/views/Debug.js index df52f463..f773739c 100755 --- a/src/js/views/Debug.js +++ b/src/js/views/Debug.js @@ -1,7 +1,7 @@ import React, { PropTypes } from 'react' import { connect } from 'react-redux' -import { Link } from 'react-router' +import { Link, hashHistory } from 'react-router' import { bindActionCreators } from 'redux' import FontAwesome from 'react-fontawesome' @@ -55,9 +55,17 @@ class Debug extends React.Component{ } render(){ + + var actions = ( + + ) + return (
-
+
diff --git a/src/js/views/Settings.js b/src/js/views/Settings.js index c114149b..4f8397b1 100755 --- a/src/js/views/Settings.js +++ b/src/js/views/Settings.js @@ -97,7 +97,7 @@ class Settings extends React.Component{ {user.display_name ? user.display_name : user.username} - {!this.props.spotify.authorized ?  (As defined in config file) : null} + {!this.props.spotify.authorized ?  (limited access) : null} ) @@ -107,7 +107,7 @@ class Settings extends React.Component{ Default user -  (As defined in config file) +  (limited access) ) @@ -127,9 +127,17 @@ class Settings extends React.Component{ } render(){ + + var actions = ( + + ) + return (
-
+
@@ -238,7 +246,6 @@ class Settings extends React.Component{
Authentication
-    { this.renderSendAuthorizationButton() }
@@ -264,22 +271,11 @@ class Settings extends React.Component{
-
Version
-
- -
-
- - -
-
+
System
this.resetAllSettings()} /> -    - -
+ +

About

diff --git a/src/scss/global/_forms.scss b/src/scss/global/_forms.scss index be22739e..ef3a95e4 100755 --- a/src/scss/global/_forms.scss +++ b/src/scss/global/_forms.scss @@ -37,6 +37,7 @@ input[type="submit"] { @include animate(); padding: 10px 20px; border: 0; + margin: 0 10px 5px 0; color: #000000; background: $light_grey; @@ -53,6 +54,14 @@ input[type="submit"] { } } + &.rounded { + margin-right: 20px; + padding: 10px 20px; + text-align: center; + min-width: 140px; + border-radius: 20px; + } + &.primary { background: $turquoise; color: #FFFFFF; diff --git a/src/scss/views/_artist.scss b/src/scss/views/_artist.scss index fe0f0bc3..f8181d76 100755 --- a/src/scss/views/_artist.scss +++ b/src/scss/views/_artist.scss @@ -12,67 +12,48 @@ right: 0; bottom: 0; left: 0; + height: auto; } - .thumbnail { - position: absolute; - z-index: 3; - max-width: 240px; - bottom: 0; - left: 40px; - } - - .heading-wrapper { - height: 50vh; + .liner { position: relative; - z-index: 2; + z-index: 1; + padding: 15vh 40px 20px 40px; - .heading { - position: absolute; - bottom: 0; - left: 320px; - - h1 { - color: #FFFFFF; - padding-top: 30px; - padding-bottom: 10px; - } - - .sub-views { - color: #FFFFFF; - - .option { - display: inline-block; - padding: 8px 0; - margin-right: 20px; - font-size: 18px; - font-weight: 400; - border-bottom: 4px solid transparent; - cursor: pointer; - - &.active { - border-color: $off_white; - } - - &:not(.active):hover { - border-color: rgba(255,255,255,0.2); - } - } - } + h1 { + color: #FFFFFF; + padding-bottom: 20px; } - } - - .details-wrapper { - padding-left: 320px; - padding-top: 35px; .actions { - float: left; - margin-right: 20px; + .button { + margin-right: 30px; + } } - .details { - padding-top: 6px; + .sub-views { + color: #FFFFFF; + position: absolute; + bottom: 0; + right: 30px; + + .option { + display: inline-block; + padding: 8px 0; + margin: 0 10px; + font-size: 18px; + font-weight: 400; + border-bottom: 4px solid transparent; + cursor: pointer; + + &.active { + border-color: $off_white; + } + + &:not(.active):hover { + border-color: rgba(255,255,255,0.2); + } + } } }