Splitting out helpers into separate files
This commit is contained in:
@ -2,18 +2,17 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import ReactGA from 'react-ga';
|
||||
import Link from '../../components/Link';
|
||||
|
||||
import Modal from './Modal';
|
||||
import Icon from '../../components/Icon';
|
||||
|
||||
import * as coreActions from '../../services/core/actions';
|
||||
import * as uiActions from '../../services/ui/actions';
|
||||
import * as mopidyActions from '../../services/mopidy/actions';
|
||||
import * as spotifyActions from '../../services/spotify/actions';
|
||||
import * as pusherActions from '../../services/pusher/actions';
|
||||
import * as helpers from '../../helpers';
|
||||
import {
|
||||
uriSource,
|
||||
uriType,
|
||||
} from '../../util/helpers';
|
||||
|
||||
class EditRadio extends React.Component {
|
||||
constructor(props) {
|
||||
@ -110,7 +109,7 @@ class EditRadio extends React.Component {
|
||||
}
|
||||
|
||||
for (let i = 0; i < uris.length; i++) {
|
||||
if (helpers.uriSource(uris[i]) !== 'spotify') {
|
||||
if (uriSource(uris[i]) !== 'spotify') {
|
||||
this.setState({ error_message: 'Non-Spotify URIs not supported' });
|
||||
return;
|
||||
} if (seeds.indexOf(uris[i]) > -1) {
|
||||
@ -120,7 +119,7 @@ class EditRadio extends React.Component {
|
||||
}
|
||||
|
||||
// Resolve
|
||||
switch (helpers.uriType(uris[i])) {
|
||||
switch (uriType(uris[i])) {
|
||||
case 'track':
|
||||
this.props.spotifyActions.getTrack(uris[i]);
|
||||
break;
|
||||
@ -155,7 +154,7 @@ class EditRadio extends React.Component {
|
||||
for (let i = 0; i < this.state.seeds.length && i < 5; i++) {
|
||||
const uri = this.state.seeds[i];
|
||||
if (uri) {
|
||||
if (helpers.uriType(uri) == 'artist') {
|
||||
if (uriType(uri) == 'artist') {
|
||||
if (this.props.artists && this.props.artists.hasOwnProperty(uri)) {
|
||||
seeds.push(this.props.artists[uri]);
|
||||
} else {
|
||||
@ -164,7 +163,7 @@ class EditRadio extends React.Component {
|
||||
uri,
|
||||
});
|
||||
}
|
||||
} else if (helpers.uriType(uri) == 'track') {
|
||||
} else if (uriType(uri) == 'track') {
|
||||
if (this.props.tracks && this.props.tracks.hasOwnProperty(uri)) {
|
||||
seeds.push(this.props.tracks[uri]);
|
||||
} else {
|
||||
@ -195,7 +194,7 @@ class EditRadio extends React.Component {
|
||||
{!seed.unresolved ? (
|
||||
<span className="mid_grey-text">
|
||||
(
|
||||
{helpers.uriType(seed.uri)}
|
||||
{uriType(seed.uri)}
|
||||
)
|
||||
</span>
|
||||
) : null}
|
||||
|
||||
Reference in New Issue
Block a user