Splitting out helpers into separate files
This commit is contained in:
@ -2,34 +2,23 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import { Route, Switch } from 'react-router-dom';
|
||||
|
||||
import Link from '../../components/Link';
|
||||
|
||||
import Header from '../../components/Header';
|
||||
import List from '../../components/List';
|
||||
import TrackList from '../../components/TrackList';
|
||||
import GridItem from '../../components/GridItem';
|
||||
import DropdownField from '../../components/Fields/DropdownField';
|
||||
import Icon from '../../components/Icon';
|
||||
import URILink from '../../components/URILink';
|
||||
import ErrorBoundary from '../../components/ErrorBoundary';
|
||||
|
||||
import * as helpers from '../../helpers';
|
||||
import * as uiActions from '../../services/ui/actions';
|
||||
import * as mopidyActions from '../../services/mopidy/actions';
|
||||
import {
|
||||
formatImages,
|
||||
} from '../../util/helpers';
|
||||
|
||||
class LibraryBrowse extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
class LibraryBrowse extends React.Component {
|
||||
componentDidMount() {
|
||||
this.loadDirectory();
|
||||
this.props.uiActions.setWindowTitle('Browse');
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
componentWillReceiveProps(nextProps) {
|
||||
// mopidy goes online
|
||||
if (!this.props.mopidy_connected && nextProps.mopidy_connected) {
|
||||
this.loadDirectory(nextProps);
|
||||
@ -45,7 +34,7 @@ class LibraryBrowse extends React.Component {
|
||||
render() {
|
||||
const grid_items = [];
|
||||
if (this.props.directory) {
|
||||
for (const subdirectory of this.props.directory.subdirectories) {
|
||||
for (const subdirectory of this.props.directory.subdirectories) {
|
||||
switch (subdirectory.name) {
|
||||
case 'Dirble':
|
||||
subdirectory.icons = ['/iris/assets/backgrounds/browse-dirble.jpg'];
|
||||
@ -93,7 +82,7 @@ class LibraryBrowse extends React.Component {
|
||||
grid_items.push({
|
||||
name: subdirectory.name,
|
||||
link: `/library/browse/${encodeURIComponent(subdirectory.uri)}`,
|
||||
icons: helpers.formatImages(subdirectory.icons),
|
||||
icons: formatImages(subdirectory.icons),
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -114,7 +103,7 @@ class LibraryBrowse extends React.Component {
|
||||
item={item}
|
||||
key={index}
|
||||
link={item.link}
|
||||
type="browse"
|
||||
type="browse"
|
||||
/>
|
||||
),
|
||||
)
|
||||
@ -139,4 +128,4 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
mopidyActions: bindActionCreators(mopidyActions, dispatch),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(LibraryBrowse);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(LibraryBrowse);
|
||||
|
||||
Reference in New Issue
Block a user