Restoring search of URI straight to asset; Ability to turn off smooth scrolling; adding reset for album filter

This commit is contained in:
James Barnsley
2019-02-08 16:05:43 +13:00
parent 1f27c7a4e2
commit bcd11855f7
12 changed files with 274 additions and 227 deletions

View File

@ -356,6 +356,9 @@ class App extends React.Component{
if (this.props.slim_mode){
className += ' slim-mode';
}
if (this.props.smooth_scrolling_enabled){
className += ' smooth-scrolling-enabled';
}
if (helpers.isTouchDevice()){
className += ' touch';
} else {
@ -451,6 +454,7 @@ class App extends React.Component{
const mapStateToProps = (state, ownProps) => {
return {
theme: state.ui.theme,
smooth_scrolling_enabled: state.ui.smooth_scrolling_enabled,
shortkeys_enabled: state.ui.shortkeys_enabled,
allow_reporting: state.ui.allow_reporting,
touch_dragging: state.ui.touch_dragging,

5
src/js/bootstrap.js vendored
View File

@ -25,7 +25,6 @@ import googleMiddleware from './services/google/middleware';
import snapcastMiddleware from './services/snapcast/middleware';
import localstorageMiddleware from './services/localstorage/middleware';
// set application defaults
var initialState = {
core: {
outputs: [],
@ -43,8 +42,8 @@ var initialState = {
},
ui: {
theme: 'dark',
smooth_scrolling_enabled: true,
shortkeys_enabled: true,
disable_parallax: false,
allow_reporting: true,
window_focus: true,
slim_mode: false,
@ -70,7 +69,7 @@ var initialState = {
username: null,
connections: {},
version: {
current: '0.0.0'
current: null
},
config: {}
},

View File

@ -18,25 +18,25 @@ class SearchForm extends React.Component{
}
handleSubmit(e){
e.preventDefault()
e.preventDefault();
// check for uri type matching
switch (helpers.uriType(this.props.term)){
switch (helpers.uriType(this.state.term)){
case 'album':
this.props.history.push('/album/'+encodeURIComponent(this.props.term))
this.props.history.push('/album/'+encodeURIComponent(this.state.term))
break
case 'artist':
this.props.history.push('/artist/'+encodeURIComponent(this.props.term))
this.props.history.push('/artist/'+encodeURIComponent(this.state.term))
break
case 'playlist':
this.props.history.push('/playlist/'+encodeURIComponent(this.props.term))
this.props.history.push('/playlist/'+encodeURIComponent(this.state.term))
break
case 'track':
this.props.history.push('/track/'+encodeURIComponent(this.props.term))
this.props.history.push('/track/'+encodeURIComponent(this.state.term))
break
default:

View File

@ -204,6 +204,9 @@ class Artist extends React.Component{
options={filter_options}
handleChange={value => {this.setFilter(value); this.props.uiActions.hideContextMenu() }}
/>
{this.props.sort || this.props.filter ? <a className="button button--discrete button--small" onClick={e => {this.setFilter(null); this.setSort(null);}}>
<Icon name="clear" />Reset
</a> : null}
</h4>
<section className="grid-wrapper no-top-padding">

View File

@ -377,6 +377,7 @@ class Search extends React.Component{
</Header>
<SearchForm
history={this.props.history}
term={this.state.term}
onBlur={term => this.setState({term: term})}
onSubmit={term => this.search(this.state.type, term)}

View File

@ -320,6 +320,16 @@ class Settings extends React.Component {
Enable shortkeys
</span>
</label>
<label>
<input
type="checkbox"
name="smooth_scrolling_enabled"
checked={ this.props.ui.smooth_scrolling_enabled }
onChange={ e => this.props.uiActions.set({ smooth_scrolling_enabled: !this.props.ui.smooth_scrolling_enabled })} />
<span className="label">
Enable smooth scrolling
</span>
</label>
</div>
</div>

View File

@ -73,7 +73,10 @@ body {
}
.smooth-scroll {
scroll-behavior: smooth;
&.smooth-scrolling-enabled,
.smooth-scrolling-enabled & {
scroll-behavior: smooth;
}
}
main {
@ -247,6 +250,11 @@ h4 {
.dropdown-field {
margin-left: 10px;
}
.button {
margin-left: 10px;
margin-bottom: -6px;
}
}
h5 {

View File

@ -337,11 +337,15 @@ select {
}
&--discrete {
border: transparent;
background: transparent;
color: colour(white);
&[disabled],
&[disabled="disabled"] {
border-color: colour(light_grey) !important;
.light-theme & {
color: colour(darkest_grey);
}
&:before {
display: none;
}
}