Eslint autofix

This commit is contained in:
James Barnsley
2021-03-23 21:21:00 +13:00
parent 7dd6e80315
commit 1ce85499f9
114 changed files with 675 additions and 813 deletions

View File

@ -137759,32 +137759,30 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
// Value not set, default to first option
if (value === null || value === undefined) {
selectedOptions = [optionsProp[0]];
} else {
if (this.isMultiSelect()) {
var _iterator = _createForOfIteratorHelper(value),
_step;
} else if (this.isMultiSelect()) {
var _iterator = _createForOfIteratorHelper(value),
_step;
try {
var _loop = function _loop() {
var multiSelectValue = _step.value;
selectedOptions = [].concat(_toConsumableArray(selectedOptions), _toConsumableArray(optionsProp.filter(function (option) {
return option.value === multiSelectValue;
})));
};
try {
var _loop = function _loop() {
var multiSelectValue = _step.value;
selectedOptions = [].concat(_toConsumableArray(selectedOptions), _toConsumableArray(optionsProp.filter(function (option) {
return option.value === multiSelectValue;
})));
};
for (_iterator.s(); !(_step = _iterator.n()).done;) {
_loop();
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
for (_iterator.s(); !(_step = _iterator.n()).done;) {
_loop();
}
} else {
selectedOptions = optionsProp.filter(function (option) {
return option.value === value;
});
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
} else {
selectedOptions = optionsProp.filter(function (option) {
return option.value === value;
});
}
}
@ -137855,7 +137853,7 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
"data-qa-file": "DropdownField"
}, icon ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Icon__WEBPACK_IMPORTED_MODULE_1__["default"], {
name: icon,
type: icon_type ? icon_type : 'material',
type: icon_type || 'material',
"data-qa-node": "Icon",
"data-qa-file": "DropdownField"
}) : null, !noLabel && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", {
@ -140772,8 +140770,8 @@ var VolumeControl = /*#__PURE__*/function (_React$Component) {
mute = _this$props.mute,
volume = _this$props.volume,
vertical = _this$props.vertical;
var sliderClassName = "slider slider--volume";
if (mute) sliderClassName += " slider--muted";
var sliderClassName = 'slider slider--volume';
if (mute) sliderClassName += ' slider--muted';
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
className: "slider__wrapper slider__wrapper--".concat(vertical ? 'vertical' : 'horiztonal', " ").concat(className),
"data-qa-node": "div",
@ -141832,7 +141830,7 @@ var updateScrollPosition = function updateScrollPosition(_ref) {
previous: {
pathname: pathname
}
})); // And now scroll to the top of the page. This can be disabled to allow in-page navigation of
})); // And now scroll to the top of the page. This can be disabled to allow in-page navigation of
// tabs, etc
if (!retainScroll) Object(_util_helpers__WEBPACK_IMPORTED_MODULE_2__["scrollTo"])(scrollTarget, scrollTarget);
@ -142244,8 +142242,8 @@ var ListItem = function ListItem(_ref) {
* Handled as a click, rather than an object so we can direct to a link, UNLESS we have clicked
* on a sub-link (we may have nested links to Albums for example). HTML does not allow nested
* <a> tags.
*
* @param {Object} e
*
* @param {Object} e
*/
@ -142916,7 +142914,7 @@ var Notifications = /*#__PURE__*/function (_React$Component) {
return process.notification;
});
if (!processes) return null;
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, processes.map(function (process) {
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment, null, processes.map(function (process) {
return _this.renderProcess(process);
}));
});
@ -148346,7 +148344,6 @@ var SnapcastGroups = function SnapcastGroups(props) {
}, 0) / groupClients.length;
}
;
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
className: "snapcast__group",
key: group.id,
@ -148707,7 +148704,7 @@ __webpack_require__.r(__webpack_exports__);
var image = mapImageSizes();
var class_name = 'thumbnail thumbnail--loaded';
if (props.fill) class_name += " thumbnail--fill";
if (props.fill) class_name += ' thumbnail--fill';
if (props.size) class_name += " thumbnail--".concat(props.size);
if (props.circle) class_name += ' thumbnail--circle';
if (props.className) class_name += " ".concat(props.className);
@ -150304,7 +150301,7 @@ var I18n = function I18n(_ref) {
return i18n(path, params, transform);
}
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, !contentAfter && children, i18n(path, params, transform), contentAfter && children);
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment, null, !contentAfter && children, i18n(path, params, transform), contentAfter && children);
};
/* harmony default export */ __webpack_exports__["default"] = ({
@ -151489,8 +151486,6 @@ var CoreMiddleware = function () {
store.dispatch(mopidyActions.getAlbum(action.uri, action.options));
break;
}
;
};
Object(_util_library__WEBPACK_IMPORTED_MODULE_7__["ensureLoaded"])({
@ -151755,10 +151750,10 @@ var CoreMiddleware = function () {
break;
/**
* Loaded more linked assets
* Often fired during lazy-loading or async asset grabbing.
* We link the parent to these indexed records by {type}s_uris
* */
* Loaded more linked assets
* Often fired during lazy-loading or async asset grabbing.
* We link the parent to these indexed records by {type}s_uris
* */
case 'LOADED_MORE':
var parent_type_plural = "".concat(action.parent_type, "s");
@ -152161,7 +152156,7 @@ var sendRequest = function sendRequest(dispatch, getState, endpoint, params) {
mode: 'cors',
headers: {
'User-Agent': 'Iris/1.0',
'Authorization': "Discogs key=".concat(key, ", secret=").concat(secret)
Authorization: "Discogs key=".concat(key, ", secret=").concat(secret)
}
};
@ -152170,9 +152165,9 @@ var sendRequest = function sendRequest(dispatch, getState, endpoint, params) {
if (response.status >= 200 && response.status < 300) {
return Promise.resolve(response);
} else {
return Promise.reject(new Error(response.statusText));
}
return Promise.reject(new Error(response.statusText));
}
fetch(url, config).then(status).then(function (response) {
@ -152446,7 +152441,7 @@ function getTrackLyrics(uri, path) {
});
var lyrics_html = lyrics.html();
lyrics_html = lyrics_html.replace(/(\[)/g, '<span class="mid_grey-text">[');
lyrics_html = lyrics_html.replace(/(\])/g, ']</span>'); //console.debug(lyrics_html);
lyrics_html = lyrics_html.replace(/(\])/g, ']</span>'); // console.debug(lyrics_html);
dispatch(coreActions.itemLoaded({
uri: uri,
@ -152504,7 +152499,6 @@ function findTrackLyrics(uri) {
dispatch(getTrackLyrics(track.uri, lyrics_result.path));
}
;
dispatch(uiActions.stopLoading(loader_key));
}, function (error) {
dispatch(uiActions.stopLoading(loader_key));
@ -153046,7 +153040,7 @@ function loveTrack(uri) {
content: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", {
"data-qa-node": "span",
"data-qa-file": "actions"
}, "Loved ", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_URILink__WEBPACK_IMPORTED_MODULE_4__["default"], {
}, "Loved", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_URILink__WEBPACK_IMPORTED_MODULE_4__["default"], {
type: "track",
uri: uri,
"data-qa-node": "URILink",
@ -153081,7 +153075,7 @@ function unloveTrack(uri) {
content: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", {
"data-qa-node": "span",
"data-qa-file": "actions"
}, "Unloved ", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_URILink__WEBPACK_IMPORTED_MODULE_4__["default"], {
}, "Unloved", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_URILink__WEBPACK_IMPORTED_MODULE_4__["default"], {
uri: uri,
"data-qa-node": "URILink",
"data-qa-file": "actions"
@ -153862,11 +153856,11 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var js_sha256__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(js_sha256__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _locale__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../locale */ "./src/js/locale/index.js");
/* harmony import */ var _util_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../util/helpers */ "./src/js/util/helpers.js");
/* harmony import */ var _util_format__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../util/format */ "./src/js/util/format.js");
/* harmony import */ var _util_arrays__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../util/arrays */ "./src/js/util/arrays.js");
/* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @sentry/utils */ "./node_modules/@sentry/utils/esm/index.js");
/* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @sentry/utils */ "./node_modules/@sentry/utils/esm/index.js");
/* harmony import */ var _locale__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../locale */ "./src/js/locale/index.js");
/* harmony import */ var _util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../util/helpers */ "./src/js/util/helpers.js");
/* harmony import */ var _util_format__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../util/format */ "./src/js/util/format.js");
/* harmony import */ var _util_arrays__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../util/arrays */ "./src/js/util/arrays.js");
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@ -153915,8 +153909,8 @@ var discogsActions = __webpack_require__(/*! ../discogs/actions.js */ "./src/js/
/**
* Fetch the method of our Mopidy API that is being called, by string
*
* @param {String} call
* @param {Object} socket
* @param {String} call
* @param {Object} socket
*/
@ -154079,7 +154073,7 @@ var MopidyMiddleware = function () {
var request = function request(store, call) {
var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return new Promise(function (resolve, reject) {
var loaderId = Object(_util_helpers__WEBPACK_IMPORTED_MODULE_5__["generateGuid"])();
var loaderId = Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["generateGuid"])();
var loaderKey = "mopidy_".concat(call);
store.dispatch(uiActions.startLoading(loaderId, loaderKey));
@ -154150,8 +154144,8 @@ var MopidyMiddleware = function () {
}
store.dispatch(uiActions.updateProcess(processKey, {
content: Object(_locale__WEBPACK_IMPORTED_MODULE_4__["i18n"])('services.mopidy.searching', {
provider: Object(_util_helpers__WEBPACK_IMPORTED_MODULE_5__["titleCase"])(uri_scheme.replace(':', '')),
content: Object(_locale__WEBPACK_IMPORTED_MODULE_5__["i18n"])('services.mopidy.searching', {
provider: Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["titleCase"])(uri_scheme.replace(':', '')),
type: requestType
}),
remaining: queue.length
@ -154165,7 +154159,7 @@ var MopidyMiddleware = function () {
if (result.albums) {
result.albums.forEach(function (album) {
if (album.uri) {
albums[album.uri] = _objectSpread(_objectSpread({}, albums[album.uri]), Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatAlbum"])(album));
albums[album.uri] = _objectSpread(_objectSpread({}, albums[album.uri]), Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatAlbum"])(album));
}
});
}
@ -154173,12 +154167,12 @@ var MopidyMiddleware = function () {
if (result.tracks) {
result.tracks.forEach(function (track) {
if (track.album && track.album.uri) {
albums[track.album.uri] = _objectSpread(_objectSpread({}, albums[track.album.uri]), Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatAlbum"])(track.album));
albums[track.album.uri] = _objectSpread(_objectSpread({}, albums[track.album.uri]), Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatAlbum"])(track.album));
}
});
}
return Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["indexToArray"])(albums);
return Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["indexToArray"])(albums);
},
artists: function artists(response) {
var result = response[0];
@ -154187,7 +154181,7 @@ var MopidyMiddleware = function () {
if (result.artists) {
result.artists.forEach(function (artist) {
if (artist.uri) {
artists[artist.uri] = _objectSpread(_objectSpread({}, artists[artist.uri]), Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatArtist"])(artist));
artists[artist.uri] = _objectSpread(_objectSpread({}, artists[artist.uri]), Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatArtist"])(artist));
}
});
}
@ -154197,14 +154191,14 @@ var MopidyMiddleware = function () {
if (track.artists) {
track.artists.forEach(function (artist) {
if (artist && artist.uri) {
artists[artist.uri] = _objectSpread(_objectSpread({}, artists[artist.uri]), Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatArtist"])(artist));
artists[artist.uri] = _objectSpread(_objectSpread({}, artists[artist.uri]), Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatArtist"])(artist));
}
});
}
});
}
return Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["indexToArray"])(artists);
return Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["indexToArray"])(artists);
},
playlists: function playlists(response) {
var playlists = response.filter(function (item) {
@ -154212,15 +154206,15 @@ var MopidyMiddleware = function () {
return item.name.toLowerCase().includes(term.toLowerCase());
});
return playlists.map(function (playlist) {
return _objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatPlaylist"])(playlist)), {}, {
uri: Object(_util_helpers__WEBPACK_IMPORTED_MODULE_5__["encodeMopidyUri"])(playlist.uri)
return _objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatPlaylist"])(playlist)), {}, {
uri: Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["encodeMopidyUri"])(playlist.uri)
});
});
},
tracks: function tracks(response) {
var _response$0$tracks = response[0].tracks,
tracks = _response$0$tracks === void 0 ? [] : _response$0$tracks;
return Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatTracks"])(tracks);
return Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatTracks"])(tracks);
}
};
request(store, method, data).then(function (response) {
@ -154290,7 +154284,7 @@ var MopidyMiddleware = function () {
break;
case 'MOPIDY_DISCONNECTED':
Object(_util_helpers__WEBPACK_IMPORTED_MODULE_5__["setFavicon"])('favicon_error.png');
Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["setFavicon"])('favicon_error.png');
break;
case 'MOPIDY_DEBUG':
@ -154344,15 +154338,15 @@ var MopidyMiddleware = function () {
/*
// Focus has just been regained
if (action.window_focus === true) {
store.dispatch(mopidyActions.getCurrentTrack());
store.dispatch(mopidyActions.getStreamTitle());
store.dispatch(mopidyActions.getPlayState());
store.dispatch(mopidyActions.getVolume());
store.dispatch(mopidyActions.getMute());
store.dispatch(mopidyActions.getConsume());
store.dispatch(mopidyActions.getRandom());
store.dispatch(mopidyActions.getRepeat());
store.dispatch(mopidyActions.getTimePosition());
store.dispatch(mopidyActions.getCurrentTrack());
store.dispatch(mopidyActions.getStreamTitle());
store.dispatch(mopidyActions.getPlayState());
store.dispatch(mopidyActions.getVolume());
store.dispatch(mopidyActions.getMute());
store.dispatch(mopidyActions.getConsume());
store.dispatch(mopidyActions.getRandom());
store.dispatch(mopidyActions.getRepeat());
store.dispatch(mopidyActions.getTimePosition());
}
*/
next(action);
@ -154373,16 +154367,16 @@ var MopidyMiddleware = function () {
break;
/**
* General playback
**/
* General playback
* */
case 'MOPIDY_PLAY_STATE':
store.dispatch(uiActions.setWindowTitle(null, action.play_state));
if (action.play_state == 'playing') {
Object(_util_helpers__WEBPACK_IMPORTED_MODULE_5__["setFavicon"])('favicon.png');
Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["setFavicon"])('favicon.png');
} else {
Object(_util_helpers__WEBPACK_IMPORTED_MODULE_5__["setFavicon"])('favicon_paused.png');
Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["setFavicon"])('favicon_paused.png');
}
next(action);
@ -154407,7 +154401,7 @@ var MopidyMiddleware = function () {
store.dispatch(pusherActions.deliverBroadcast('notification', {
notification: {
content: "".concat(store.getState().pusher.username + (store.getState().mopidy.play_state == 'paused' ? ' resumed' : ' started'), " playback"),
icon: store.getState().core.current_track ? Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["getTrackIcon"])(store.getState().core.current_track, store.getState().core) : false
icon: store.getState().core.current_track ? Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["getTrackIcon"])(store.getState().core.current_track, store.getState().core) : false
}
}));
break;
@ -154421,7 +154415,7 @@ var MopidyMiddleware = function () {
store.dispatch(pusherActions.deliverBroadcast('notification', {
notification: {
content: "".concat(store.getState().pusher.username, " paused playback"),
icon: store.getState().core.current_track ? Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["getTrackIcon"])(store.getState().core.current_track, store.getState().core) : false
icon: store.getState().core.current_track ? Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["getTrackIcon"])(store.getState().core.current_track, store.getState().core) : false
}
}));
});
@ -154440,7 +154434,7 @@ var MopidyMiddleware = function () {
store.dispatch(pusherActions.deliverBroadcast('notification', {
notification: {
content: "".concat(store.getState().pusher.username, " skipped \"").concat(store.getState().core.current_track.name, "\""),
icon: store.getState().core.current_track ? Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["getTrackIcon"])(store.getState().core.current_track, store.getState().core) : false
icon: store.getState().core.current_track ? Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["getTrackIcon"])(store.getState().core.current_track, store.getState().core) : false
}
}));
});
@ -154452,7 +154446,7 @@ var MopidyMiddleware = function () {
store.dispatch(pusherActions.deliverBroadcast('notification', {
notification: {
content: "".concat(store.getState().pusher.username, " stopped playback"),
icon: store.getState().core.current_track ? Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["getTrackIcon"])(store.getState().core.current_track, store.getState().core) : false
icon: store.getState().core.current_track ? Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["getTrackIcon"])(store.getState().core.current_track, store.getState().core) : false
}
}));
});
@ -154619,7 +154613,7 @@ var MopidyMiddleware = function () {
var playlist = store.getState().core.items[action.uri];
if (playlist && playlist.tracks) {
store.dispatch(mopidyActions.playURIs(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', playlist.tracks), action.uri, action.shuffle));
store.dispatch(mopidyActions.playURIs(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', playlist.tracks), action.uri, action.shuffle));
break;
}
@ -154638,7 +154632,7 @@ var MopidyMiddleware = function () {
var _playlist = store.getState().core.items[action.uri];
if (_playlist && _playlist.tracks) {
store.dispatch(mopidyActions.enqueueURIs(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', _playlist.tracks), action.uri, action.shuffle));
store.dispatch(mopidyActions.enqueueURIs(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', _playlist.tracks), action.uri, action.shuffle));
break;
}
@ -154682,7 +154676,7 @@ var MopidyMiddleware = function () {
}
store.dispatch(uiActions.startProcess(action.type, {
content: Object(_locale__WEBPACK_IMPORTED_MODULE_4__["i18n"])('services.mopidy.adding_uris', {
content: Object(_locale__WEBPACK_IMPORTED_MODULE_5__["i18n"])('services.mopidy.adding_uris', {
count: remaining
}),
remaining: remaining,
@ -154690,11 +154684,11 @@ var MopidyMiddleware = function () {
}));
store.dispatch(pusherActions.deliverBroadcast('notification', {
notification: {
content: Object(_locale__WEBPACK_IMPORTED_MODULE_4__["i18n"])('services.mopidy.adding_uris_broadcast', {
content: Object(_locale__WEBPACK_IMPORTED_MODULE_5__["i18n"])('services.mopidy.adding_uris_broadcast', {
username: store.getState().pusher.username,
count: remaining
}),
icon: store.getState().core.current_track ? Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["getTrackIcon"])(store.getState().core.current_track, store.getState().core) : false
icon: store.getState().core.current_track ? Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["getTrackIcon"])(store.getState().core.current_track, store.getState().core) : false
}
})); // Prepare our URIS into batches. This allows performance gain of several URIs at once
// (which is a blocking request), but not so many that it locks the Mopidy server.
@ -154732,7 +154726,7 @@ var MopidyMiddleware = function () {
if (at_position !== null) at_position += uris.length;
store.dispatch(uiActions.updateProcess(action.type, {
remaining: remaining,
content: Object(_locale__WEBPACK_IMPORTED_MODULE_4__["i18n"])('services.mopidy.adding_uris', {
content: Object(_locale__WEBPACK_IMPORTED_MODULE_5__["i18n"])('services.mopidy.adding_uris', {
count: remaining
})
}));
@ -154764,7 +154758,7 @@ var MopidyMiddleware = function () {
}
if (action.shuffle) {
urisToPlay = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["shuffle"])(urisToPlay);
urisToPlay = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["shuffle"])(urisToPlay);
} // Stop the radio
@ -154914,7 +154908,7 @@ var MopidyMiddleware = function () {
if (_queue.length) {
store.dispatch(uiActions.startProcess(action.type, {
content: Object(_locale__WEBPACK_IMPORTED_MODULE_4__["i18n"])('services.mopidy.searching'),
content: Object(_locale__WEBPACK_IMPORTED_MODULE_5__["i18n"])('services.mopidy.searching'),
total: _queue.length,
remaining: _queue.length
}));
@ -154931,7 +154925,7 @@ var MopidyMiddleware = function () {
uris: uris
}).then(function (response) {
if (!response) return;
Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["indexToArray"])(response).forEach(function (item) {
Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["indexToArray"])(response).forEach(function (item) {
store.dispatch(coreActions["load".concat(item.___model__)](item.uri));
});
});
@ -154943,7 +154937,7 @@ var MopidyMiddleware = function () {
uri: action.uri
}).then(function (response) {
if (!response) return;
var playlist = Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatPlaylist"])(_objectSpread(_objectSpread({
var playlist = Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatPlaylist"])(_objectSpread(_objectSpread({
images: {}
}, response), {}, {
type: 'playlist',
@ -154953,13 +154947,13 @@ var MopidyMiddleware = function () {
if (response.tracks) {
request(store, 'library.lookup', {
uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', response.tracks)
uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', response.tracks)
}).then(function (tracksResponse) {
var tracks = response.tracks.map(function (simpleTrack) {
var fullTracks = tracksResponse[simpleTrack.uri];
return _objectSpread(_objectSpread({}, simpleTrack), fullTracks.length ? fullTracks[0] : {});
});
playlist.tracks = Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["injectSortId"])(Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatTracks"])(tracks));
playlist.tracks = Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["injectSortId"])(Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatTracks"])(tracks));
store.dispatch(coreActions.itemLoaded(playlist));
});
} else {
@ -154973,7 +154967,7 @@ var MopidyMiddleware = function () {
uri: action.key
}).then(function (response) {
if (!response) {
store.dispatch(coreActions.handleException(Object(_locale__WEBPACK_IMPORTED_MODULE_4__["i18n"])('errors.uri_not_found', {
store.dispatch(coreActions.handleException(Object(_locale__WEBPACK_IMPORTED_MODULE_5__["i18n"])('errors.uri_not_found', {
uri: action.key
})));
return;
@ -155123,14 +155117,14 @@ var MopidyMiddleware = function () {
name: action.name,
uri_scheme: action.scheme
}).then(function (response) {
var playlist = Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatPlaylist"])(_objectSpread(_objectSpread(_objectSpread({}, response), action), {}, {
var playlist = Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatPlaylist"])(_objectSpread(_objectSpread(_objectSpread({}, response), action), {}, {
can_edit: true,
type: 'playlist',
provider: 'mopidy'
}));
store.dispatch(uiActions.createNotification({
content: Object(_locale__WEBPACK_IMPORTED_MODULE_4__["i18n"])('actions.created', {
name: Object(_locale__WEBPACK_IMPORTED_MODULE_4__["i18n"])('playlist.title')
content: Object(_locale__WEBPACK_IMPORTED_MODULE_5__["i18n"])('actions.created', {
name: Object(_locale__WEBPACK_IMPORTED_MODULE_5__["i18n"])('playlist.title')
})
}));
store.dispatch(coreActions.addToLibrary('mopidy:library:playlists', playlist));
@ -155142,8 +155136,8 @@ var MopidyMiddleware = function () {
uri: action.uri
}).then(function () {
store.dispatch(uiActions.createNotification({
content: Object(_locale__WEBPACK_IMPORTED_MODULE_4__["i18n"])('actions.deleted', {
name: Object(_locale__WEBPACK_IMPORTED_MODULE_4__["i18n"])('playlist.title')
content: Object(_locale__WEBPACK_IMPORTED_MODULE_5__["i18n"])('actions.deleted', {
name: Object(_locale__WEBPACK_IMPORTED_MODULE_5__["i18n"])('playlist.title')
})
}));
store.dispatch(coreActions.removeFromLibrary('mopidy:library:playlists', action.uri));
@ -155158,12 +155152,12 @@ var MopidyMiddleware = function () {
if (!_response) return;
var response = _response[uri];
if (!response || !response.length) return;
response = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["sortItems"])(response, 'track_number');
response = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["sortItems"])(response, 'track_number');
var album = _objectSpread(_objectSpread({}, response[0].album), {}, {
source: 'local',
artists: Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatArtists"])(response[0].artists),
tracks: Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatTracks"])(response)
artists: Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatArtists"])(response[0].artists),
tracks: Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatTracks"])(response)
});
store.dispatch(coreActions.itemLoaded(album));
@ -155187,7 +155181,7 @@ var MopidyMiddleware = function () {
for (var _i5 = 0; _i5 < response.length; _i5++) {
if (response[_i5].album) {
(function () {
var album = _objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatAlbum"])(response[_i5].album)), {}, {
var album = _objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatAlbum"])(response[_i5].album)), {}, {
uri: response[_i5].album.uri
});
@ -155224,9 +155218,9 @@ var MopidyMiddleware = function () {
var artist = _objectSpread({
uri: action.uri,
provider: 'mopidy',
albums_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', albums),
tracks: Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatTracks"])(response)
}, raw_artist ? Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatArtist"])(raw_artist) : {});
albums_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', albums),
tracks: Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatTracks"])(response)
}, raw_artist ? Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatArtist"])(raw_artist) : {});
store.dispatch(coreActions.itemLoaded(artist)); // We may not have a raw_artist if the tracks' artist is not found (ie the requested
// artist may be the albumartist).
@ -155273,7 +155267,7 @@ var MopidyMiddleware = function () {
case 'MOPIDY_CURRENT_TRACK_LOADED':
{
store.dispatch(uiActions.setCurrentTrackTransition(false));
var track = Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatTrack"])(action.tl_track);
var track = Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatTrack"])(action.tl_track);
if (track.uri) {
store.dispatch({
@ -155294,7 +155288,7 @@ var MopidyMiddleware = function () {
if (response && response >= 0) {
// Get the full track object from our tracklist
// We know it will be here, as the tlid refers to an item in this list
var _track = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["applyFilter"])('tlid', response, store.getState().core.queue, true);
var _track = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["applyFilter"])('tlid', response, store.getState().core.queue, true);
if (_track && _track.uri) {
store.dispatch({
@ -155319,11 +155313,11 @@ var MopidyMiddleware = function () {
uris: _uris
}).then(function (_response) {
if (!_response) return;
var tracks = Object(lodash__WEBPACK_IMPORTED_MODULE_3__["compact"])(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["indexToArray"])(_response).map(function (results) {
return results.length ? Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatTrack"])(results[0]) : null;
var tracks = Object(lodash__WEBPACK_IMPORTED_MODULE_3__["compact"])(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["indexToArray"])(_response).map(function (results) {
return results.length ? Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatTrack"])(results[0]) : null;
}));
store.dispatch(coreActions.itemsLoaded(tracks));
store.dispatch(mopidyActions.getImages(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', tracks)));
store.dispatch(mopidyActions.getImages(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', tracks)));
tracks.forEach(function (track) {
if (full) {
if (store.getState().lastfm.authorization) {
@ -155353,12 +155347,12 @@ var MopidyMiddleware = function () {
uri: 'local:directory?type=track'
}).then(function (_response) {
if (!_response || !_response.length) return;
var uris = Object(lodash__WEBPACK_IMPORTED_MODULE_3__["sampleSize"])(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', _response), action.limit);
var uris = Object(lodash__WEBPACK_IMPORTED_MODULE_3__["sampleSize"])(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', _response), action.limit);
request(store, 'library.lookup', {
uris: uris
}).then(function (_response) {
if (!_response) return;
var random_tracks = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["indexToArray"])(_response).map(function (results) {
var random_tracks = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["indexToArray"])(_response).map(function (results) {
return results[0];
});
var view = store.getState().core.view || {};
@ -155384,13 +155378,11 @@ var MopidyMiddleware = function () {
if (images) {
itemsWithImages.push({
uri: uri,
images: Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatImages"])(Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["digestMopidyImages"])(store.getState().mopidy, images))
images: Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatImages"])(Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["digestMopidyImages"])(store.getState().mopidy, images))
});
} else {
store.dispatch(lastfmActions.getImages(uri));
}
;
});
if (itemsWithImages.length) {
@ -155415,14 +155407,14 @@ var MopidyMiddleware = function () {
var subdirectoryImagesToLoad = [];
results.forEach(function (item) {
if (item.__model__ === 'Track') {
tracks.push(Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatTrack"])(item));
tracks.push(Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatTrack"])(item));
} else if (item.__model__ === 'Ref' && item.type === 'track') {
tracks.push(Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatTrack"])(_objectSpread(_objectSpread({}, item), {}, {
tracks.push(Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatTrack"])(_objectSpread(_objectSpread({}, item), {}, {
loading: true
})));
trackUrisToLoad.push(item.uri);
} else if (item.__model__ === 'Ref' && item.type === 'album') {
subdirectories.push(Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatAlbum"])(_objectSpread(_objectSpread({}, item), {}, {
subdirectories.push(Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatAlbum"])(_objectSpread(_objectSpread({}, item), {}, {
loading: true
})));
subdirectoryImagesToLoad.push(item.uri);
@ -155445,7 +155437,7 @@ var MopidyMiddleware = function () {
uris: trackUrisToLoad
}).then(function (response) {
var fullTrackObjects = Object.values(response).map(function (t) {
return t.length > 0 ? Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatTrack"])(t[0]) : undefined;
return t.length > 0 ? Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatTrack"])(t[0]) : undefined;
});
store.dispatch({
type: 'MOPIDY_DIRECTORY_LOADED',
@ -155459,8 +155451,6 @@ var MopidyMiddleware = function () {
});
}
;
if (subdirectoryImagesToLoad.length) {
request(store, 'library.getImages', {
uris: subdirectoryImagesToLoad
@ -155469,7 +155459,7 @@ var MopidyMiddleware = function () {
var images = response[subdir.uri] || undefined;
if (images) {
images = Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatImages"])(Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["digestMopidyImages"])(store.getState().mopidy, images));
images = Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatImages"])(Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["digestMopidyImages"])(store.getState().mopidy, images));
}
return _objectSpread(_objectSpread({}, subdir), {}, {
@ -155550,14 +155540,14 @@ var MopidyMiddleware = function () {
var response = raw_response.map(function (artist) {
return _objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatArtist"])(artist)), {}, {
return _objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatArtist"])(artist)), {}, {
uri: artist.uri.replace('local:directory?albumartist=', '').replace('local:directory?artist=', '')
});
});
store.dispatch(coreActions.itemsLoaded(response));
store.dispatch(coreActions.libraryLoaded({
uri: 'mopidy:library:artists',
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', response)
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', response)
}));
store.dispatch(uiActions.processFinished(action.type));
});
@ -155570,8 +155560,8 @@ var MopidyMiddleware = function () {
}));
request(store, 'playlists.asList').then(function (listResponse) {
// Remove any Spotify playlists. These will be handled by our Spotify API
var playlist_uris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', listResponse).filter(function (playlistUri) {
return Object(_util_helpers__WEBPACK_IMPORTED_MODULE_5__["uriSource"])(playlistUri) !== 'spotify';
var playlist_uris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', listResponse).filter(function (playlistUri) {
return Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriSource"])(playlistUri) !== 'spotify';
});
var libraryPlaylists = [];
store.dispatch(uiActions.updateProcess(action.type, {
@ -155584,10 +155574,10 @@ var MopidyMiddleware = function () {
request(store, 'playlists.lookup', {
uri: uri
}).then(function (response) {
libraryPlaylists.push(Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatPlaylist"])({
libraryPlaylists.push(Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatPlaylist"])({
name: response.name,
uri: response.uri,
can_edit: Object(_util_helpers__WEBPACK_IMPORTED_MODULE_5__["uriSource"])(response.uri) === 'm3u',
can_edit: Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriSource"])(response.uri) === 'm3u',
last_modified: response.last_modified,
// By not including actual tracks they will be fetched when needed. We don't
// want these simple tracks because they don't contain duration, artist, etc.
@ -155601,7 +155591,7 @@ var MopidyMiddleware = function () {
store.dispatch(coreActions.itemsLoaded(libraryPlaylists));
store.dispatch(coreActions.libraryLoaded({
uri: 'mopidy:library:playlists',
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', libraryPlaylists)
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', libraryPlaylists)
}));
store.dispatch(uiActions.processFinished(action.type));
}
@ -155626,7 +155616,7 @@ var MopidyMiddleware = function () {
request(store, 'library.browse', {
uri: store.getState().mopidy.library_albums_uri
}).then(function (browseResponse) {
var allUris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', browseResponse);
var allUris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', browseResponse);
store.dispatch(uiActions.updateProcess(action.type, {
remaining: allUris.length,
total: allUris.length
@ -155650,12 +155640,12 @@ var MopidyMiddleware = function () {
request(store, 'library.lookup', {
uris: _uris3
}).then(function (lookupResponse) {
var libraryItems = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["indexToArray"])(lookupResponse).map(function (tracks) {
var libraryItems = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["indexToArray"])(lookupResponse).map(function (tracks) {
return _objectSpread({
artists: tracks[0].artists ? Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatArtists"])(tracks[0].artists) : null,
tracks: Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatTracks"])(tracks),
artists: tracks[0].artists ? Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatArtists"])(tracks[0].artists) : null,
tracks: Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatTracks"])(tracks),
last_modified: tracks[0].last_modified
}, Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatAlbum"])(tracks[0].album));
}, Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatAlbum"])(tracks[0].album));
});
if (libraryItems.length) {
@ -155668,7 +155658,7 @@ var MopidyMiddleware = function () {
store.dispatch(uiActions.processFinished(action.type));
store.dispatch(coreActions.libraryLoaded({
uri: 'mopidy:library:albums',
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', browseResponse)
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', browseResponse)
}));
}
};
@ -155684,7 +155674,7 @@ var MopidyMiddleware = function () {
request(store, 'library.browse', {
uri: store.getState().mopidy.library_tracks_uri
}).then(function (browseResponse) {
var allUris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', browseResponse);
var allUris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', browseResponse);
store.dispatch(uiActions.updateProcess(action.type, {
remaining: allUris.length,
total: allUris.length
@ -155708,8 +155698,8 @@ var MopidyMiddleware = function () {
request(store, 'library.lookup', {
uris: _uris4
}).then(function (lookupResponse) {
var libraryItems = Object(lodash__WEBPACK_IMPORTED_MODULE_3__["compact"])(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["indexToArray"])(lookupResponse).map(function (results) {
return results.length ? Object(_util_format__WEBPACK_IMPORTED_MODULE_6__["formatTrack"])(results[0]) : null;
var libraryItems = Object(lodash__WEBPACK_IMPORTED_MODULE_3__["compact"])(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["indexToArray"])(lookupResponse).map(function (results) {
return results.length ? Object(_util_format__WEBPACK_IMPORTED_MODULE_7__["formatTrack"])(results[0]) : null;
}));
if (libraryItems.length) {
@ -155722,7 +155712,7 @@ var MopidyMiddleware = function () {
store.dispatch(uiActions.processFinished(action.type));
store.dispatch(coreActions.libraryLoaded({
uri: 'mopidy:library:tracks',
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_7__["arrayOf"])('uri', browseResponse)
items_uris: Object(_util_arrays__WEBPACK_IMPORTED_MODULE_8__["arrayOf"])('uri', browseResponse)
}));
}
};
@ -156185,7 +156175,7 @@ function addQueueMetadata() {
}
/**
* Pinned URIs
**/
* */
function getPinned() {
return {
@ -156744,8 +156734,8 @@ var PusherMiddleware = function () {
break;
/**
* Pinned uris
**/
* Pinned uris
* */
case 'PUSHER_GET_PINNED':
request(store, 'get_pinned').then(function (response) {
@ -158227,15 +158217,15 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
var coreActions = __webpack_require__(/*! ../../services/core/actions */ "./src/js/services/core/actions.js");
var coreActions = __webpack_require__(/*! ../core/actions */ "./src/js/services/core/actions.js");
var uiActions = __webpack_require__(/*! ../../services/ui/actions */ "./src/js/services/ui/actions.js");
var uiActions = __webpack_require__(/*! ../ui/actions */ "./src/js/services/ui/actions.js");
var mopidyActions = __webpack_require__(/*! ../../services/mopidy/actions */ "./src/js/services/mopidy/actions.js");
var mopidyActions = __webpack_require__(/*! ../mopidy/actions */ "./src/js/services/mopidy/actions.js");
var lastfmActions = __webpack_require__(/*! ../../services/lastfm/actions */ "./src/js/services/lastfm/actions.js");
var lastfmActions = __webpack_require__(/*! ../lastfm/actions */ "./src/js/services/lastfm/actions.js");
var geniusActions = __webpack_require__(/*! ../../services/genius/actions */ "./src/js/services/genius/actions.js");
var geniusActions = __webpack_require__(/*! ../genius/actions */ "./src/js/services/genius/actions.js");
/**
* Send an ajax request to the Spotify API
*
@ -158958,12 +158948,12 @@ function following(uri) {
content: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", {
"data-qa-node": "span",
"data-qa-file": "actions"
}, "Removed ", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_URILink__WEBPACK_IMPORTED_MODULE_4__["default"], {
}, "Removed", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_URILink__WEBPACK_IMPORTED_MODULE_4__["default"], {
type: type,
uri: uri,
"data-qa-node": "URILink",
"data-qa-file": "actions"
}, asset ? asset.name : type), " from library")
}, asset ? asset.name : type), ' ', "from library")
}));
} else if (method === 'PUT' || method === 'POST') {
dispatch(coreActions.addToLibrary("spotify:library:".concat(type, "s"), asset));
@ -158971,12 +158961,12 @@ function following(uri) {
content: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", {
"data-qa-node": "span",
"data-qa-file": "actions"
}, "Added ", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_URILink__WEBPACK_IMPORTED_MODULE_4__["default"], {
}, "Added", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_URILink__WEBPACK_IMPORTED_MODULE_4__["default"], {
type: type,
uri: uri,
"data-qa-node": "URILink",
"data-qa-file": "actions"
}, asset ? asset.name : type), " to library")
}, asset ? asset.name : type), ' ', "to library")
}));
}
}, function (error) {
@ -159218,8 +159208,6 @@ function getUser(uri) {
fetchPlaylists("users/".concat(userId, "/playlists?limit=40").concat(forceRefetch ? "&refetch=".concat(Date.now()) : ''));
}
;
};
}
/**
@ -159479,8 +159467,6 @@ function getPlaylist(uri) {
if (full) {
dispatch(getPlaylistTracks(uri, options));
}
;
}, function (error) {
dispatch(coreActions.handleException('Could not load playlist', error));
});
@ -163516,7 +163502,9 @@ var getFromUri = function getFromUri(element, uri) {
case 'seeds':
if (exploded[1] == 'discover') {
return exploded[2];
} else if (exploded[1] === 'radio') {
}
if (exploded[1] === 'radio') {
var seeds = exploded[2].split(',');
return seeds.map(function (seed) {
return seed.replace(/_/gi, ':');
@ -163592,7 +163580,7 @@ var isObject = function isObject(value) {
};
/**
* Convert an array of strings to an array of RegExp objects
*
*
* @param {Array} keys
*/
@ -163755,8 +163743,6 @@ var iconFromKeyword = function iconFromKeyword(name) {
_iterator2.f();
}
}
;
};
/**
* Scroll to the top of the page
@ -164324,8 +164310,6 @@ var storageFactory = function () {
} catch (exception) {
return false;
}
;
}();
/**
* Get a storage value
@ -169756,7 +169740,6 @@ var LyricsContent = function LyricsContent(_ref2) {
})), ".");
}
;
if (!lyrics) return null;
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
className: "lyrics",
@ -177952,7 +177935,6 @@ var Lyrics = function Lyrics(_ref2) {
});
}
;
return null;
};

File diff suppressed because one or more lines are too long

View File

@ -106,7 +106,7 @@
// Release details
// These are automatically injected to built HTML
var build = "1616485783";
var build = "1616487615";
var version = "3.57.1";
// Construct the script tag

View File

@ -5,7 +5,7 @@ const blacklist = [
'me/tracks',
'me/albums',
'me/following',
'refresh_spotify_token'
'refresh_spotify_token',
];
function inBlacklist(url) {
for (const item of blacklist) {
@ -16,11 +16,9 @@ function inBlacklist(url) {
return false;
}
self.addEventListener('activate', function(event) {
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys().then((cacheNames) => {
return Promise.all(cacheNames.map((cacheName) => caches.delete(cacheName)));
})
caches.keys().then((cacheNames) => Promise.all(cacheNames.map((cacheName) => caches.delete(cacheName)))),
);
});
@ -30,41 +28,39 @@ self.addEventListener('fetch', (event) => {
event.respondWith(
// Opens Cache objects that start with 'font'.
caches.open('iris').then((cache) => {
return cache.match(request)
.then((response) => {
if (response) {
return response;
}
caches.open('iris').then((cache) => cache.match(request)
.then((response) => {
if (response) {
return response;
}
// Not cached, so we make the request, return that and also save response in cache
return fetch(request)
.then((liveResponse) => {
const isBlacklisted = inBlacklist(request.url);
// Not cached, so we make the request, return that and also save response in cache
return fetch(request)
.then((liveResponse) => {
const isBlacklisted = inBlacklist(request.url);
// Only cache successful GET requests
if (
!isBlacklisted
// Only cache successful GET requests
if (
!isBlacklisted
&& request.method === 'GET'
&& liveResponse.status >= 200
&& liveResponse.status < 400
) {
// Fixes Edge browser "'chrome-extension' is unsupported" issue
// See https://stackoverflow.com/questions/49157622/service-worker-typeerror-when-opening-chrome-extension
if (!/^https?:$/i.test(new URL(request.url).protocol)) return;
) {
// Fixes Edge browser "'chrome-extension' is unsupported" issue
// See https://stackoverflow.com/questions/49157622/service-worker-typeerror-when-opening-chrome-extension
if (!/^https?:$/i.test(new URL(request.url).protocol)) return;
cache.put(request, liveResponse.clone());
} else {
console.info(`Not caching ${isBlacklisted ? '(blacklisted) ' : ''}${request.method} ${request.url}`);
}
cache.put(request, liveResponse.clone());
} else {
console.info(`Not caching ${isBlacklisted ? '(blacklisted) ' : ''}${request.method} ${request.url}`);
}
return liveResponse;
});
return liveResponse;
});
// Exceptions from match() or fetch()
}).catch((error) => {
throw error;
});
}),
}).catch((error) => {
throw error;
})),
);
});

View File

@ -107,23 +107,23 @@ export class App extends React.Component {
}
// Load query param settings
const configs = ['ui', 'spotify', 'pusher', 'snapcast', 'mopidy', 'google', 'lastfm', 'genius']
const params = new URLSearchParams(window.location.search)
var changed = []
var urlParams = params.forEach((v, k) => {
const configs = ['ui', 'spotify', 'pusher', 'snapcast', 'mopidy', 'google', 'lastfm', 'genius'];
const params = new URLSearchParams(window.location.search);
const changed = [];
const urlParams = params.forEach((v, k) => {
if (!configs.includes(k)) return;
try {
storage.set(k, JSON.parse(v))
changed.push(k)
storage.set(k, JSON.parse(v));
changed.push(k);
} catch (error) {
console.error(error)
console.error(error);
}
})
});
if (changed.length > 0) {
changed.forEach((k) => params.delete(k))
const url = window.location.toString().replace(window.location.search, params.toString())
changed.forEach((k) => params.delete(k));
const url = window.location.toString().replace(window.location.search, params.toString());
console.log(`Settings changed, redirecting to ${url}`, changed);
window.location.assign(url)
window.location.assign(url);
}
this.handleInstallPrompt = this.handleInstallPrompt.bind(this);
@ -259,7 +259,7 @@ export class App extends React.Component {
} = this.state;
let className = `${theme}-theme app-inner`;
className += ` ${navigator.onLine ? 'online' : 'offline'}`
className += ` ${navigator.onLine ? 'online' : 'offline'}`;
if (wide_scrollbar_enabled) {
className += ' wide-scrollbar';
}

View File

@ -1,4 +1,3 @@
import React, { memo } from 'react';
import GridItem from './GridItem';
import { encodeUri } from '../util/format';
@ -14,12 +13,12 @@ export default memo(({
<div className={`grid grid--tiles ${className} ${mini ? 'grid--mini' : ''}`}>
{
categories.map((category) => (
<GridItem
key={category.uri}
type="category"
item={category}
link={`/discover/categories/${encodeUri(category.uri)}`}
/>
<GridItem
key={category.uri}
type="category"
item={category}
link={`/discover/categories/${encodeUri(category.uri)}`}
/>
))
}
</div>

View File

@ -1,4 +1,3 @@
import React, { createRef } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -664,9 +663,10 @@ class ContextMenu extends React.Component {
onClick={() => {
setSelectedTracks([]);
hideContextMenu();
}}>
<Icon name="close" />
</span>
}}
>
<Icon name="close" />
</span>
</div>
</div>
);
@ -768,7 +768,7 @@ class ContextMenu extends React.Component {
} = this.props;
let list = null;
let isLoading = false;
const isLoading = false;
if (submenu === 'add-to-playlist') {
let playlists = [
@ -796,7 +796,6 @@ class ContextMenu extends React.Component {
);
if (playlists.length) {
list = playlists.map((playlist) => {
// Allows us to css target last-child
const ElementTag = playlist.is_pinned ? 'em' : 'span';
@ -825,7 +824,7 @@ class ContextMenu extends React.Component {
>
<span className="context-menu__item__label">
<Icon name="arrow_back" />
<span>
<span>
<I18n path="actions.back" />
</span>
</span>
@ -978,15 +977,15 @@ class ContextMenu extends React.Component {
'spotify_me/tracks/contains',
'spotify_me/playlists/contains',
'spotify_me/albums/contains',
'spotify_me/artists/contains'
]
'spotify_me/artists/contains',
],
)
) {
toggle_in_library = (
<div className="context-menu__item">
<a className="context-menu__item__link">
<span className="context-menu__item__label mid_grey-text">
<I18n path="actions.add_to_library" />
<I18n path="actions.add_to_library" />
</span>
</a>
</div>
@ -1010,7 +1009,7 @@ class ContextMenu extends React.Component {
<div className="context-menu__item">
<a className="context-menu__item__link">
<span className="context-menu__item__label mid_grey-text">
<I18n path="context_menu.love_track" />
<I18n path="context_menu.love_track" />
</span>
</a>
</div>
@ -1027,7 +1026,7 @@ class ContextMenu extends React.Component {
);
}
let toggle_pinned = (
const toggle_pinned = (
<div className="context-menu__item">
<a className="context-menu__item__link" onClick={() => this.togglePinned(context.is_pinned)}>
<span className="context-menu__item__label">

View File

@ -1,4 +1,3 @@
import { memo } from 'react';
import { i18n } from '../locale';
@ -87,7 +86,6 @@ const dater = (type, data) => {
var date = new Date(data);
return `${date.getDate()}/${date.getMonth() + 1}/${date.getFullYear()}`;
case 'ago':
var date = new Date(data);
var diff = new Date() - date;

View File

@ -10,11 +10,13 @@ import { indexToArray } from '../util/arrays';
class DebugInfo extends React.Component {
constructor(props) {
super(props);
this.state = { localForageLength: 0 }
}
this.state = { localForageLength: 0 };
}
componentDidMount() {
localForage.length().then((localForageLength) => this.setState({ localForageLength }))
}
localForage.length().then((localForageLength) => this.setState({ localForageLength }));
}
localStorageSize() {
let data = '';
@ -69,12 +71,12 @@ class DebugInfo extends React.Component {
<div className="debug-info-section">
<div className="debug-info-item">
Version:
Version:
{' '}
{version}
</div>
<div className="debug-info-item">
Build:
Build:
{' '}
{build}
</div>
@ -83,45 +85,45 @@ class DebugInfo extends React.Component {
<div className="debug-info-section">
<h5>State</h5>
<div className="debug-info-item">
{`Items: ${Object.keys(items).length}`}
{`Items: ${Object.keys(items).length}`}
</div>
<div className="debug-info-item">
{`Coldstore items: ${this.state.localForageLength}`}
{`Coldstore items: ${this.state.localForageLength}`}
</div>
<div className="debug-info-item">
{`Notifications: ${Object.keys(notifications).length}`}
{`Notifications: ${Object.keys(notifications).length}`}
</div>
<div className="debug-info-item">
{`Processes: ${Object.keys(processes).length}`}
{`Processes: ${Object.keys(processes).length}`}
</div>
<div className="debug-info-item">
{`Enqueue batches: ${enqueue_uris_batches.length}`}
{`Enqueue batches: ${enqueue_uris_batches.length}`}
</div>
<div className="debug-info-item">
{`Cached URLs: ${Object.keys(getStorage('cache')).length}`}
{`Cached URLs: ${Object.keys(getStorage('cache')).length}`}
</div>
</div>
<div className="debug-info-section">
<h5>Config</h5>
<div className="debug-info-item">
{`Slim mode: ${slim_mode ? 'on' : 'off'}`}
{`Slim mode: ${slim_mode ? 'on' : 'off'}`}
</div>
<div className="debug-info-item">
{`Test mode: ${test_mode ? 'on' : 'off'}`}
{`Test mode: ${test_mode ? 'on' : 'off'}`}
</div>
<div className="debug-info-item">
{`Touch: ${isTouchDevice() ? 'on' : 'off'}`}
{`Touch: ${isTouchDevice() ? 'on' : 'off'}`}
</div>
<div className="debug-info-item">
{`LocalStorage usage: ${localStorageUsage.used}kb (~${localStorageUsage.percent}%)`}
{`LocalStorage usage: ${localStorageUsage.used}kb (~${localStorageUsage.percent}%)`}
</div>
<div className="debug-info-item">
{`Selected tracks: ${selected_tracks.length}`}
{`Selected tracks: ${selected_tracks.length}`}
<br />
{
selected_tracks.map((track_key, index) => (
<div key={`${track_key}_${index}`}>{track_key}</div>
<div key={`${track_key}_${index}`}>{track_key}</div>
))
}
</div>

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -75,7 +74,8 @@ class Dragger extends React.Component {
return (
<div
className="dragger" style={{
className="dragger"
style={{
left: position_x,
top: position_y,
}}

View File

@ -1,4 +1,3 @@
import React from 'react';
import ErrorMessage from './ErrorMessage';

View File

@ -1,4 +1,3 @@
import React, { memo } from 'react';
import { i18n } from '../locale';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React, { memo } from 'react';
import Icon from '../Icon';

View File

@ -1,4 +1,3 @@
import React from 'react';
import Sortable from 'react-sortablejs';
import Icon from '../Icon';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { i18n } from '../../locale';
import Button from '../Button';

View File

@ -1,4 +1,3 @@
import React from 'react';
import Icon from '../Icon';
import { removeDuplicates } from '../../util/arrays';
@ -32,7 +31,7 @@ export default class DropdownField extends React.Component {
setExpanded(expanded = !this.state.expanded) {
if (expanded) {
this.setState({ expanded, changed: false, });
this.setState({ expanded, changed: false });
window.addEventListener('click', this.handleClick, false);
} else {
this.setState({ expanded });
@ -94,17 +93,15 @@ export default class DropdownField extends React.Component {
// Value not set, default to first option
if (value === null || value === undefined) {
selectedOptions = [optionsProp[0]];
} else {
if (this.isMultiSelect()) {
for (let multiSelectValue of value) {
selectedOptions = [
...selectedOptions,
...optionsProp.filter(option => option.value === multiSelectValue),
];
}
} else {
selectedOptions = optionsProp.filter(option => option.value === value);
} else if (this.isMultiSelect()) {
for (const multiSelectValue of value) {
selectedOptions = [
...selectedOptions,
...optionsProp.filter((option) => option.value === multiSelectValue),
];
}
} else {
selectedOptions = optionsProp.filter((option) => option.value === value);
}
}
@ -143,7 +140,7 @@ export default class DropdownField extends React.Component {
let className = `dropdown-field ${classNameProp}`;
if (expanded) className += ' dropdown-field--expanded';
if (no_status_icon) className += ' dropdown-field--no-status-icon';
if (no_status_icon) className += ' dropdown-field--no-status-icon';
if (no_label) className += ' dropdown-field--no-label';
if (button) className += ' dropdown-field--buttonify';
@ -155,7 +152,7 @@ export default class DropdownField extends React.Component {
return (
<div className={className} data-uid={this.uid}>
<div className={`dropdown-field__label${button ? ` button ${button}` : ''}`} onClick={(e) => this.setExpanded()}>
{icon ? <Icon name={icon} type={icon_type ? icon_type : 'material'} /> : null}
{icon ? <Icon name={icon} type={icon_type || 'material'} /> : null}
{!noLabel && (
<span className="text">
<span className="dropdown-field__label__value">
@ -174,14 +171,14 @@ export default class DropdownField extends React.Component {
options.map((option) => {
const is_selected = selectedOptions.includes(option);
return (
<div
className={`dropdown-field__options__item ${option.className ? option.className : ''}`}
key={option.value}
onClick={(e) => this.handleChange(option.value, is_selected)}
>
{!no_status_icon && is_selected && selected_icon}
{option.label}
</div>
<div
className={`dropdown-field__options__item ${option.className ? option.className : ''}`}
key={option.value}
onClick={(e) => this.handleChange(option.value, is_selected)}
>
{!no_status_icon && is_selected && selected_icon}
{option.label}
</div>
);
})
}

View File

@ -1,4 +1,3 @@
import React from 'react';
import Icon from '../Icon';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import Link from '../Link';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React, { memo } from 'react';
import Icon from '../Icon';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { throttle } from '../../util/helpers';

View File

@ -1,4 +1,3 @@
import React, { memo } from 'react';
import Icon from '../Icon';
import { I18n } from '../../locale';
@ -8,14 +7,14 @@ export default memo((props) => {
return (
<button className={`control mute-control ${props.noTooltip ? '' : 'tooltip '}${props.className ? props.className : ''}`} onClick={() => props.onMuteChange(false)}>
<Icon className="red-text" name="volume_off" />
{props.noTooltip ? null : <span className="tooltip__content"><I18n path="playback_controls.unmute"/></span>}
{props.noTooltip ? null : <span className="tooltip__content"><I18n path="playback_controls.unmute" /></span>}
</button>
);
}
return (
<button className={`control mute-control ${props.noTooltip ? '' : 'tooltip '}${props.className ? props.className : ''}`} onClick={() => props.onMuteChange(true)}>
<Icon className="muted" name="volume_mute" />
{props.noTooltip ? null : <span className="tooltip__content"><I18n path="playback_controls.mute"/></span>}
{props.noTooltip ? null : <span className="tooltip__content"><I18n path="playback_controls.mute" /></span>}
</button>
);
});

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -60,7 +59,7 @@ class OutputControl extends React.Component {
snapcastActions,
snapcast_groups,
snapcast_clients: clients,
show_disconnected_clients
show_disconnected_clients,
} = this.props;
const groups = indexToArray(snapcast_groups);
@ -115,7 +114,7 @@ class OutputControl extends React.Component {
/>
</div>
</div>
)
);
})
}
</div>

View File

@ -1,5 +1,5 @@
import React from 'react';
import { useSelector, useDispatch } from 'react-redux'
import { useSelector, useDispatch } from 'react-redux';
import * as pusherActions from '../../services/pusher/actions';
import Icon from '../Icon';
import Button from '../Button';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import Sortable from 'react-sortablejs';
import Icon from '../Icon';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import Icon from '../Icon';
@ -32,7 +31,7 @@ export default class TextField extends React.Component {
}
handleFocus = () => {
this.setState({ in_focus: true, saved: false, });
this.setState({ in_focus: true, saved: false });
}
handleBlur = () => {

View File

@ -1,4 +1,3 @@
import React from 'react';
import { throttle } from '../../util/helpers';
@ -21,8 +20,8 @@ export default class VolumeControl extends React.Component {
vertical,
} = this.props;
let sliderClassName = "slider slider--volume";
if (mute) sliderClassName += " slider--muted";
let sliderClassName = 'slider slider--volume';
if (mute) sliderClassName += ' slider--muted';
return (
<div className={`slider__wrapper slider__wrapper--${vertical ? 'vertical' : 'horiztonal'} ${className}`}>

View File

@ -1,4 +1,3 @@
import React, { memo } from 'react';
import ContextMenuTrigger from './ContextMenuTrigger';

View File

@ -44,9 +44,9 @@ class Hotkeys extends React.Component {
// Ignore text input fields
if (
(target.nodeName === 'INPUT' && (target.type === 'text' || target.type === 'number')) ||
target.nodeName === 'TEXTAREA' ||
(target.nodeName === 'BUTTON' && key === ' ')) {
(target.nodeName === 'INPUT' && (target.type === 'text' || target.type === 'number'))
|| target.nodeName === 'TEXTAREA'
|| (target.nodeName === 'BUTTON' && key === ' ')) {
return;
}

View File

@ -1,8 +1,9 @@
import React, { memo } from 'react';
import FontAwesome from 'react-fontawesome';
export default memo(({ name, type, className, onClick }) => {
export default memo(({
name, type, className, onClick,
}) => {
if (!name || name === '') return null;
const fullClassName = `icon icon--${type || 'material'} ${className || ''}`;

View File

@ -1,4 +1,3 @@
import React from 'react';
import { throttle } from '../util/helpers';
import Loader from './Loader';
@ -42,8 +41,7 @@ export default class LazyLoadListener extends React.Component {
const window_height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
// At, or half a screen from bottom of the page
if (scrollTop > (scrollHeight - offsetHeight - (window_height / 2))) {
if (scrollTop > (scrollHeight - offsetHeight - (window_height / 2))) {
// Immediately stop listening to avoid duplicating pagination requests
this.setState(
{ listening: false },

View File

@ -11,8 +11,7 @@ const updateScrollPosition = ({
state,
pathname,
},
}) => {
}) => {
// Fetch the current scroll position of our #main element and save to our history's state, so
// clicking 'back' etc will restore the previous scroll position.
// This doesn't trigger lazy-load elements (unless scrolling exposes the LazyLoader component).
@ -29,10 +28,10 @@ const updateScrollPosition = ({
},
);
// And now scroll to the top of the page. This can be disabled to allow in-page navigation of
// And now scroll to the top of the page. This can be disabled to allow in-page navigation of
// tabs, etc
if (!retainScroll) scrollTo(scrollTarget, (scrollTarget));
}
};
/**
* Extends react-router's Link but provides the ability to hook in to the navigation event
@ -51,7 +50,9 @@ const Link = ({
if (!to) return <span className={className}>{children}</span>;
const history = useHistory();
const location = useLocation();
const onClick = () => updateScrollPosition({ history, location, retainScroll, scrollTarget });
const onClick = () => updateScrollPosition({
history, location, retainScroll, scrollTarget,
});
// Decode both links. This handles issues where one link is encoded and the other isn't, but
// they're otherwise identical

View File

@ -23,21 +23,21 @@ const LinksSentence = memo(({ items, className, nolinks }) => {
var content = <span>{name}</span>;
} else {
var content = (
<URILink
className="links-sentence__item links-sentence__item--link"
uri={uri}
type={type}
>
{name}
</URILink>
);
<URILink
className="links-sentence__item links-sentence__item--link"
uri={uri}
type={type}
>
{name}
</URILink>
);
}
return (
<span key={`index_${uri}`}>
{content}
{separator}
</span>
<span key={`index_${uri}`}>
{content}
{separator}
</span>
);
})
}

View File

@ -1,6 +1,6 @@
import React from 'react';
import { SmartList } from './SmartList';
import { ListItem } from './ListItem'
import { ListItem } from './ListItem';
const List = ({
items,

View File

@ -123,13 +123,13 @@ const ListItem = ({
}),
);
};
/**
* Handled as a click, rather than an object so we can direct to a link, UNLESS we have clicked
* on a sub-link (we may have nested links to Albums for example). HTML does not allow nested
* <a> tags.
*
* @param {Object} e
*
* @param {Object} e
*/
const onClick = (e) => {
let to = '';

View File

@ -1,4 +1,3 @@
import React, { Fragment } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -259,9 +258,9 @@ class Notifications extends React.Component {
if (!processes) return null;
return (
<Fragment>
<>
{processes.map((process) => this.renderProcess(process))}
</Fragment>
</>
);
}

View File

@ -53,6 +53,6 @@ const Parallax = ({
)}
</div>
);
}
};
export default handleViewport(Parallax);

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -231,7 +230,7 @@ class PlaybackControls extends React.Component {
direction={transition_direction}
>
{transition_track && transition_direction && (
<div className={`current-track current-track__outgoing`}>
<div className="current-track current-track__outgoing">
<div className="text">
<div className="title">
{transition_track.name}

View File

@ -1,4 +1,3 @@
import React, { memo } from 'react';
import { I18n } from '../locale';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -46,18 +45,18 @@ class PusherConnectionList extends React.Component {
}
return (
<div className={is_me ? 'connection cf me' : 'connection cf'} key={connection.connection_id}>
<div className="col col--w30">
{ connection.username }
{is_me && <I18n path="settings.pusher_connection_list.you" />}
</div>
<div className="col col--w70">
{connection.ip}
<span className="mid_grey-text">
{` (${connection.connection_id})`}
</span>
</div>
</div>
<div className={is_me ? 'connection cf me' : 'connection cf'} key={connection.connection_id}>
<div className="col col--w30">
{ connection.username }
{is_me && <I18n path="settings.pusher_connection_list.you" />}
</div>
<div className="col col--w70">
{connection.ip}
<span className="mid_grey-text">
{` (${connection.connection_id})`}
</span>
</div>
</div>
);
})
}

View File

@ -1,4 +1,3 @@
import React, { memo } from 'react';
import Thumbnail from './Thumbnail';
import URILink from './URILink';
@ -7,7 +6,7 @@ export default memo(({ artists, uiActions: { showContextMenu } = {} }) => {
if (!artists) return null;
const onContextMenu = (e, item) => {
if (showContextMenu){
if (showContextMenu) {
e.preventDefault();
showContextMenu({
e,

View File

@ -1,4 +1,3 @@
export default (props) => {
window.addEventListener('resize', handleWindowResize, false);

View File

@ -76,7 +76,7 @@ const SearchResults = ({
{type === 'albums' && <Grid items={results} show_source_icon mini={all} />}
{type === 'playlists' && <Grid items={results} show_source_icon mini={all} />}
{type === 'tracks' && <TrackList tracks={results} uri={`iris:search:${query.type}:${encodedTerm}`} show_source_icon />}
{/*<LazyLoadListener enabled={this.props.artists_more && spotify_search_enabled} loadMore={loadMore} />*/}
{/* <LazyLoadListener enabled={this.props.artists_more && spotify_search_enabled} loadMore={loadMore} /> */}
{resultsCount > results.length && (
<Button uri={`iris:search:${type}:${encodedTerm}`} debug>

View File

@ -1,5 +1,5 @@
import React from 'react';
import { useStore, useDispatch } from 'react-redux'
import { useStore, useDispatch } from 'react-redux';
import Link from './Link';
import Icon from './Icon';
import TextField from './Fields/TextField';
@ -125,7 +125,7 @@ const Servers = ({
<TextField
type="text"
value={server.name}
onChange={value => dispatch(mopidyActions.updateServer({ id: server.id, name: value }))}
onChange={(value) => dispatch(mopidyActions.updateServer({ id: server.id, name: value }))}
autosave
/>
</div>
@ -137,7 +137,7 @@ const Servers = ({
<div className="input">
<TextField
value={server.host}
onChange={value => dispatch(mopidyActions.updateServer({ id: server.id, host: value }))}
onChange={(value) => dispatch(mopidyActions.updateServer({ id: server.id, host: value }))}
autosave
/>
</div>
@ -150,7 +150,7 @@ const Servers = ({
<TextField
type="text"
value={server.port}
onChange={value => dispatch(mopidyActions.updateServer({ id: server.id, port: value }))}
onChange={(value) => dispatch(mopidyActions.updateServer({ id: server.id, port: value }))}
autosave
/>
</div>

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -296,7 +295,7 @@ class Services extends React.Component {
snapcast: {
enabled: snapcastEnabled,
connected: snapcastConnected,
}
},
} = this.props;
const spotify_icon = spotifyUser ? (
@ -448,7 +447,7 @@ class Services extends React.Component {
case 'genius':
return <div className="sub-tabs__content">{this.renderGenius()}</div>;
case 'snapcast':
return <div className="sub-tabs__content">{<Snapcast match={this.props.match} />}</div>;
return <div className="sub-tabs__content"><Snapcast match={this.props.match} /></div>;
default:
return null;
}

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -11,8 +10,7 @@ import * as uiActions from '../services/ui/actions';
import * as mopidyActions from '../services/mopidy/actions';
import { I18n, i18n } from '../locale';
class Sidebar extends React.Component {
class Sidebar extends React.Component {
closeSidebar = () => {
const {
uiActions: {

View File

@ -31,7 +31,7 @@ const SmartListBatch = handleViewport(
const itemIndex = (bi = 0, ii = 0) => {
if (bi === 0) return ii;
return ii + (chunkSize * bi);
}
};
return (
<div className={`smart-list__batch ${className}`} ref={forwardedRef}>

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -99,7 +98,7 @@ const Snapcast = (props) => {
{connected && enabled && <SnapcastGroups match={match} history={history} />}
</div>
);
}
};
const mapStateToProps = (state) => ({
snapcast: state.snapcast,

View File

@ -1,4 +1,3 @@
import React from 'react';
import VolumeControl from './Fields/VolumeControl';
import MuteControl from './Fields/MuteControl';
@ -7,7 +6,9 @@ import TextField from './Fields/TextField';
import SelectField from './Fields/SelectField';
import { I18n, i18n } from '../locale';
const SnapcastClients = ({ actions, group, clients, groups }) => {
const SnapcastClients = ({
actions, group, clients, groups,
}) => {
if (!clients || clients.length <= 0) {
return (
<p className="no-results">
@ -105,6 +106,6 @@ const SnapcastClients = ({ actions, group, clients, groups }) => {
}
</div>
);
}
};
export default SnapcastClients;

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -51,7 +50,7 @@ const SnapcastGroups = (props) => {
(acc, client) => acc + (client.volume || 0),
0,
) / groupClients.length;
};
}
return (
<div className="snapcast__group" key={group.id}>
@ -112,15 +111,15 @@ const SnapcastGroups = (props) => {
/>
</div>
);
}
};
const renderMenuItem = (simpleGroup) => {
const group = collate(simpleGroup, { clients });
const anyClients = (
!show_disconnected_clients && (
!group.clients ||
!group.clients.length ||
!group.clients.filter((client) => client.connected).length
!group.clients
|| !group.clients.length
|| !group.clients.filter((client) => client.connected).length
)
);
return (
@ -143,7 +142,7 @@ const SnapcastGroups = (props) => {
</div>
</Link>
);
}
};
return (
<div className="sub-tabs snapcast__groups" id="services-snapcast-groups">
@ -155,7 +154,7 @@ const SnapcastGroups = (props) => {
{renderGroup()}
</div>
);
}
};
const mapStateToProps = (state, ownProps) => ({
show_disconnected_clients: (

View File

@ -1,4 +1,3 @@
import React, { memo } from 'react';
import Link from './Link';
import Icon from './Icon';
@ -37,7 +36,7 @@ export default memo((props) => {
const image = mapImageSizes();
let class_name = 'thumbnail thumbnail--loaded';
if (props.fill) class_name += ` thumbnail--fill`;
if (props.fill) class_name += ' thumbnail--fill';
if (props.size) class_name += ` thumbnail--${props.size}`;
if (props.circle) class_name += ' thumbnail--circle';
if (props.className) class_name += ` ${props.className}`;
@ -77,7 +76,7 @@ export default memo((props) => {
{props.glow && image && (
<div
className="thumbnail__image thumbnail__image--glow"
style={{ backgroundImage: `url("${image}")`}}
style={{ backgroundImage: `url("${image}")` }}
/>
)}
<div className="thumbnail__actions">

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';

View File

@ -13,7 +13,7 @@ const i18n = (path, params = {}, transform) => {
let value = get((dictionary), path, '');
value = value.replace(
paramsRegExp,
(replaceText, key) => params.hasOwnProperty(key) ? params[key] : '',
(replaceText, key) => (params.hasOwnProperty(key) ? params[key] : ''),
);
switch (transform) {
@ -44,11 +44,11 @@ const I18n = ({
return i18n(path, params, transform);
}
return (
<Fragment>
<>
{!contentAfter && children}
{i18n(path, params, transform)}
{contentAfter && children}
</Fragment>
</>
);
};

View File

@ -109,7 +109,6 @@ export function searchResultsLoaded(query, resultType, results) {
};
}
/**
* Record getters
*
@ -215,7 +214,6 @@ export function removeFromLibrary(uri, itemUri) {
};
}
/**
* Record loaders
*
@ -477,7 +475,6 @@ export function addTracksToPlaylist(uri, tracks_uris) {
}
}
/**
* Asset libraries
* */

View File

@ -79,7 +79,6 @@ const CoreMiddleware = (function () {
}
}
// Strip out non-essential store info
delete exported_state.core.albums;
delete exported_state.core.artists;
@ -432,7 +431,7 @@ const CoreMiddleware = (function () {
default:
store.dispatch(mopidyActions.getAlbum(action.uri, action.options));
break;
};
}
};
ensureLoaded({
store,
@ -681,7 +680,7 @@ const CoreMiddleware = (function () {
next(action);
break;
/**
/**
* Loaded more linked assets
* Often fired during lazy-loading or async asset grabbing.
* We link the parent to these indexed records by {type}s_uris
@ -718,7 +717,7 @@ const CoreMiddleware = (function () {
// Merge any extra data (eg more_track's albums)
if (action.extra_data) {
records = records.map(record => ({ ...record, ...action.extra_data }));
records = records.map((record) => ({ ...record, ...action.extra_data }));
}
// If we're a list of playlists, we need to manually filter Spotify's new URI structure

View File

@ -1,4 +1,3 @@
import { arrayOf } from '../../util/arrays';
export default function reducer(core = {}, action) {
@ -56,7 +55,6 @@ export default function reducer(core = {}, action) {
var radio = { ...core.radio, resolved_seeds: action.resolved_seeds };
return { ...core, radio };
/**
* Index updates
* These actions are only ever called by middleware after we've digested one more many assets

View File

@ -1,4 +1,3 @@
import { generateGuid } from '../../util/helpers';
import { formatArtist } from '../../util/format';
@ -12,8 +11,7 @@ const uiActions = require('../ui/actions');
* @param endpoint = String
* @param params = String
* */
const sendRequest = (dispatch, getState, endpoint, params) => new Promise((resolve, reject) => {
const sendRequest = (dispatch, getState, endpoint, params) => new Promise((resolve, reject) => {
const key = 'CXIwsVMAjrXIVitBWgqd';
const secret = 'KiEUfwKpebxRnEHlKoXnYIftJxeuqjTK';
const url = `https://api.discogs.com/${endpoint}?${params}`;
@ -27,7 +25,7 @@ const sendRequest = (dispatch, getState, endpoint, params) => new Promise((resol
mode: 'cors',
headers: {
'User-Agent': 'Iris/1.0',
'Authorization': `Discogs key=${key}, secret=${secret}`
Authorization: `Discogs key=${key}, secret=${secret}`,
},
};
@ -35,19 +33,18 @@ const sendRequest = (dispatch, getState, endpoint, params) => new Promise((resol
dispatch(uiActions.stopLoading(loader_key));
if (response.status >= 200 && response.status < 300) {
return Promise.resolve(response)
} else {
return Promise.reject(new Error(response.statusText))
return Promise.resolve(response);
}
return Promise.reject(new Error(response.statusText));
}
fetch(url, config)
.then(status)
.then(response => response.json())
.then(data => {
.then((response) => response.json())
.then((data) => {
resolve(data);
})
.catch(error => {
.catch((error) => {
reject(error);
});
});

View File

@ -90,7 +90,6 @@ const sendRequest = (dispatch, getState, endpoint, method = 'GET', data = false)
});
});
/**
* Handle authorization process
* */
@ -115,7 +114,6 @@ export function importAuthorization(authorization) {
};
}
/**
* Get current user
* */
@ -192,7 +190,7 @@ export function getTrackLyrics(uri, path) {
lyrics_html = lyrics_html.replace(/(\[)/g, '<span class="mid_grey-text">[');
lyrics_html = lyrics_html.replace(/(\])/g, ']</span>');
//console.debug(lyrics_html);
// console.debug(lyrics_html);
dispatch(coreActions.itemLoaded({
uri,
@ -255,7 +253,7 @@ export function findTrackLyrics(uri) {
// Immediately go and get the first result's lyrics
const lyrics_result = lyrics_results[0];
dispatch(getTrackLyrics(track.uri, lyrics_result.path));
};
}
dispatch(uiActions.stopLoading(loader_key));
},
(error) => {

View File

@ -2,8 +2,7 @@ const coreActions = require('../core/actions');
const geniusActions = require('./actions');
const GeniusMiddleware = (function () {
return (store) => (next) => (action) => {
return (store) => (next) => (action) => {
switch (action.type) {
case 'GENIUS_ME_LOADED':
store.dispatch(coreActions.userLoaded(action.me));
@ -19,7 +18,6 @@ const GeniusMiddleware = (function () {
next(action);
break;
// This action is irrelevant to us, pass it on to the next middleware
default:
return next(action);

View File

@ -1,4 +1,3 @@
export function set(data) {
return {
type: 'GOOGLE_SET',

View File

@ -5,7 +5,8 @@ import {
formatArtists,
formatTracks,
} from '../../util/format';
import { i18n } from '../../locale';
import { i18n } from '../../locale';
const coreActions = require('../core/actions');
const mopidyActions = require('../mopidy/actions');
const uiActions = require('../ui/actions');
@ -26,7 +27,7 @@ const GoogleMiddleware = (function () {
return (store) => (next) => (action) => {
switch (action.type) {
case 'GOOGLE_GET_LIBRARY_ALBUMS': {
store.dispatch(uiActions.startProcess(action.type, { notification: false }) );
store.dispatch(uiActions.startProcess(action.type, { notification: false }));
request(
store,

View File

@ -104,7 +104,7 @@ const sendSignedRequest = (dispatch, getState, params) => new Promise((resolve,
dispatch(uiActions.stopLoading(loader_key));
if (response.status >= 200 && response.status < 300) {
return Promise.resolve(response)
return Promise.resolve(response);
}
return Promise.reject(new Error(response.statusText));
}
@ -125,7 +125,6 @@ const sendSignedRequest = (dispatch, getState, params) => new Promise((resolve,
});
});
/**
* Handle authorization process
* */
@ -151,7 +150,6 @@ export function importAuthorization(authorization) {
};
}
/**
* Non-signed requests
* */
@ -286,7 +284,6 @@ export function getAlbum(uri, artist, album, mbid = false) {
};
}
export function getImages(context, uri) {
return (dispatch, getState) => {
let record = getState().core[context][uri];
@ -352,7 +349,6 @@ export function getImages(context, uri) {
};
}
/**
* Signed requests
* */
@ -387,7 +383,10 @@ export function loveTrack(uri) {
userloved: true,
}));
dispatch(uiActions.createNotification({
content: <span>Loved <URILink type="track" uri={uri}>{asset ? asset.name : type}</URILink></span>,
content: <span>
Loved
<URILink type="track" uri={uri}>{asset ? asset.name : type}</URILink>
</span>,
}));
},
);
@ -424,7 +423,10 @@ export function unloveTrack(uri) {
userloved: false,
}));
dispatch(uiActions.createNotification({
content: <span>Unloved <URILink uri={uri}>{asset ? asset.name : type}</URILink></span>,
content: <span>
Unloved
<URILink uri={uri}>{asset ? asset.name : type}</URILink>
</span>,
}));
},
);

View File

@ -1,6 +1,6 @@
import ReactGA from 'react-ga';
import { formatUser } from '../../util/format';
import { formatUser } from '../../util/format';
const coreActions = require('../core/actions');
const uiActions = require('../ui/actions');
const lastfmActions = require('./actions');
@ -28,7 +28,7 @@ const LastfmMiddleware = (function () {
setTimeout(() => { store.dispatch(lastfmActions.getMe()); }, 100);
next(action);
break;
break;
case 'LASTFM_AUTHORIZATION_REVOKED':
if (store.getState().ui.allow_reporting) {

View File

@ -1,4 +1,3 @@
export default function reducer(lastfm = {}, action) {
switch (action.type) {
case 'LASTFM_CONNECT':

View File

@ -1,4 +1,3 @@
import storage from '../../util/storage';
const localstorageMiddleware = (function () {
@ -264,7 +263,7 @@ const localstorageMiddleware = (function () {
},
);
break;
/*
/*
case 'SUPPRESS_BROADCAST':
var ui = storage.get('ui');
if (ui.suppressed_broadcasts !== undefined) {

View File

@ -259,7 +259,6 @@ export function getUriSchemes() {
};
}
/**
* Advanced playback actions
* */
@ -371,7 +370,6 @@ export function enqueueURIsBatchDone() {
};
}
/**
* Playlist maniopulation
* */

View File

@ -1,8 +1,8 @@
import ReactGA from 'react-ga';
import Mopidy from 'mopidy';
import { sha256 } from 'js-sha256';
import { sampleSize, compact, chunk } from 'lodash';
import { consoleSandbox } from '@sentry/utils';
import { i18n, I18n } from '../../locale';
import {
generateGuid,
@ -31,7 +31,6 @@ import {
sortItems,
indexToArray,
} from '../../util/arrays';
import { consoleSandbox } from '@sentry/utils';
const mopidyActions = require('./actions.js');
const coreActions = require('../core/actions.js');
@ -46,8 +45,8 @@ const discogsActions = require('../discogs/actions.js');
/**
* Fetch the method of our Mopidy API that is being called, by string
*
* @param {String} call
* @param {Object} socket
* @param {String} call
* @param {Object} socket
*/
const getController = (call, socket) => {
const callParts = call.split('.');
@ -241,7 +240,9 @@ const MopidyMiddleware = (function () {
store.dispatch(uiActions.stopLoading(loaderId));
console.warn(
'Mopidy request aborted. Either Mopidy is not connected or the request method is invalid. Check the request and your server settings.',
{ call, value, socket, controller },
{
call, value, socket, controller,
},
);
}
};
@ -479,7 +480,7 @@ const MopidyMiddleware = (function () {
break;
case 'MOPIDY_REMOVE_SERVER': {
let servers = { ...store.getState().mopidy.servers };
const servers = { ...store.getState().mopidy.servers };
delete servers[action.id];
store.dispatch(mopidyActions.updateServers(servers));
break;
@ -490,8 +491,8 @@ const MopidyMiddleware = (function () {
* Disabled because it causes so many requests without any conscious user input.
* Will monitor to see if it has any adverse impact.
*/
/*
/*
// Focus has just been regained
if (action.window_focus === true) {
store.dispatch(mopidyActions.getCurrentTrack());
@ -531,9 +532,9 @@ const MopidyMiddleware = (function () {
);
break;
/**
/**
* General playback
**/
* */
case 'MOPIDY_PLAY_STATE':
store.dispatch(uiActions.setWindowTitle(null, action.play_state));
@ -871,7 +872,7 @@ const MopidyMiddleware = (function () {
}
let remaining = action.uris.length;
let at_position = action.at_position;
let { at_position } = action;
// Uris are to go immediately after the currently-playing track (which could be paused)
if (action.play_next) {
@ -1101,13 +1102,11 @@ const MopidyMiddleware = (function () {
);
break;
/**
* =============================================================== SEARCHING ============
* ======================================================================================
* */
case 'MOPIDY_GET_SEARCH_RESULTS': {
const {
uri_schemes = [],
@ -1210,8 +1209,7 @@ const MopidyMiddleware = (function () {
});
} else {
store.dispatch(coreActions.itemLoaded(playlist));
}
}
});
break;
@ -1607,7 +1605,7 @@ const MopidyMiddleware = (function () {
...uris,
],
}));
}
},
);
},
);
@ -1630,7 +1628,7 @@ const MopidyMiddleware = (function () {
});
} else {
store.dispatch(lastfmActions.getImages(uri));
};
}
});
if (itemsWithImages.length) {
@ -1694,7 +1692,7 @@ const MopidyMiddleware = (function () {
},
});
});
};
}
if (subdirectoryImagesToLoad.length) {
request(store, 'library.getImages', { uris: subdirectoryImagesToLoad })
@ -1772,7 +1770,7 @@ const MopidyMiddleware = (function () {
// See https://github.com/mopidy/mopidy-local-sqlite/issues/39
const response = raw_response.map((artist) => ({
...formatArtist(artist),
uri: artist.uri.replace('local:directory?albumartist=', '').replace('local:directory?artist=', '')
uri: artist.uri.replace('local:directory?albumartist=', '').replace('local:directory?artist=', ''),
}));
store.dispatch(coreActions.itemsLoaded(response));
@ -1788,8 +1786,7 @@ const MopidyMiddleware = (function () {
store.dispatch(uiActions.startProcess(action.type, { notification: false }));
request(store, 'playlists.asList')
.then((listResponse) => {
.then((listResponse) => {
// Remove any Spotify playlists. These will be handled by our Spotify API
const playlist_uris = arrayOf('uri', listResponse).filter(
(playlistUri) => uriSource(playlistUri) !== 'spotify',

View File

@ -1,4 +1,3 @@
export function setPort(port) {
return {
type: 'PUSHER_SET_PORT',
@ -201,10 +200,9 @@ export function addQueueMetadata(tlids = [], from_uri = null) {
};
}
/**
* Pinned URIs
**/
* */
export function getPinned() {
return {
@ -240,7 +238,6 @@ export function pinnedUpdated(pinned) {
};
}
/**
* Commands (buttons)
* */

View File

@ -1,4 +1,3 @@
import ReactGA from 'react-ga';
import { uriType, generateGuid } from '../../util/helpers';
import { trackEvent } from '../../components/Trackable';
@ -10,8 +9,7 @@ const lastfmActions = require('../lastfm/actions');
const geniusActions = require('../genius/actions');
const spotifyActions = require('../spotify/actions');
const PusherMiddleware = (function () {
const PusherMiddleware = (function () {
// container for the actual websocket
let socket = null;
@ -491,9 +489,9 @@ const PusherMiddleware = (function () {
next(action);
break;
/**
/**
* Pinned uris
**/
* */
case 'PUSHER_GET_PINNED':
request(store, 'get_pinned')
@ -651,7 +649,6 @@ const PusherMiddleware = (function () {
break;
}
/**
* Radio
* */

View File

@ -1,4 +1,3 @@
export default function reducer(pusher = {}, action) {
switch (action.type) {
case 'PUSHER_CONNECT':

View File

@ -1,4 +1,3 @@
export function set(data) {
return {
type: 'SNAPCAST_SET',

View File

@ -1,4 +1,3 @@
import ReactGA from 'react-ga';
import { sha256 } from 'js-sha256';
import {
@ -32,7 +31,7 @@ const SnapcastMiddleware = (function () {
// Some messages are arrays of messages
if (Array.isArray(message)) {
message.map(messageItem => handleMessage(ws, store, messageItem));
message.map((messageItem) => handleMessage(ws, store, messageItem));
return;
}
@ -154,8 +153,7 @@ const SnapcastMiddleware = (function () {
return (store) => (next) => (action) => {
const { snapcast } = store.getState();
switch (action.type) {
switch (action.type) {
case 'SNAPCAST_CONNECT':
if (socket) socket.close();
clearTimeout(reconnectTimer);
@ -307,7 +305,7 @@ const SnapcastMiddleware = (function () {
var groups_index = { ...snapcast.groups };
var clients_loaded = [];
const groups_loaded = action.groups.map(raw_group => {
const groups_loaded = action.groups.map((raw_group) => {
let group = formatGroup(raw_group);
if (groups_index[group.id]) {
@ -363,7 +361,7 @@ const SnapcastMiddleware = (function () {
request(store, 'Client.SetName', params)
.then(
response => {
(response) => {
store.dispatch(snapcastActions.clientLoaded(
{
id: action.id,
@ -386,7 +384,7 @@ const SnapcastMiddleware = (function () {
request(store, 'Client.SetVolume', params)
.then(
response => {
(response) => {
store.dispatch(snapcastActions.clientLoaded(
{
id: action.id,
@ -395,7 +393,7 @@ const SnapcastMiddleware = (function () {
},
));
},
error => {
(error) => {
store.dispatch(coreActions.handleException(
'Error',
error,
@ -417,7 +415,7 @@ const SnapcastMiddleware = (function () {
request(store, 'Client.SetVolume', params)
.then(
response => {
(response) => {
store.dispatch(snapcastActions.clientLoaded(
{
id: action.id,
@ -440,7 +438,7 @@ const SnapcastMiddleware = (function () {
error,
error.message,
));
}
},
);
break;
@ -453,7 +451,7 @@ const SnapcastMiddleware = (function () {
request(store, 'Client.SetLatency', params)
.then(
response => {
(response) => {
store.dispatch(snapcastActions.clientLoaded(
{
id: action.id,
@ -461,7 +459,7 @@ const SnapcastMiddleware = (function () {
},
));
},
error => {
(error) => {
store.dispatch(coreActions.handleException(
'Error',
error,
@ -526,24 +524,24 @@ const SnapcastMiddleware = (function () {
break;
case 'SNAPCAST_SET_GROUP_NAME':
var group = snapcast.groups[action.id];
var params = {
id: action.id,
name: action.name,
};
var group = snapcast.groups[action.id];
var params = {
id: action.id,
name: action.name,
};
request(store, 'Group.SetName', params)
.then(
response => {
store.dispatch(snapcastActions.groupLoaded(
{
id: action.id,
name: response.name,
},
));
},
);
break;
request(store, 'Group.SetName', params)
.then(
(response) => {
store.dispatch(snapcastActions.groupLoaded(
{
id: action.id,
name: response.name,
},
));
},
);
break;
case 'SNAPCAST_SET_GROUP_STREAM':
var group = store.getState().snapcast.groups[action.id];
@ -554,7 +552,7 @@ const SnapcastMiddleware = (function () {
request(store, 'Group.SetStream', params)
.then(
response => {
(response) => {
store.dispatch(snapcastActions.groupLoaded(
{
id: action.id,
@ -562,7 +560,7 @@ const SnapcastMiddleware = (function () {
},
));
},
error => {
(error) => {
store.dispatch(coreActions.handleException(
'Could not change stream',
error,
@ -581,7 +579,7 @@ const SnapcastMiddleware = (function () {
request(store, 'Group.SetMute', params)
.then(
response => {
(response) => {
store.dispatch(snapcastActions.groupLoaded(
{
id: action.id,
@ -589,7 +587,7 @@ const SnapcastMiddleware = (function () {
},
));
},
error => {
(error) => {
store.dispatch(coreActions.handleException(
'Could not toggle mute',
error,
@ -636,7 +634,7 @@ const SnapcastMiddleware = (function () {
store.dispatch(snapcastActions.groupLoaded({
id: action.id,
volume: action.percent,
}))
}));
break;
default:

View File

@ -1,4 +1,3 @@
export default function reducer(snapcast = {}, action) {
switch (action.type) {
case 'SNAPCAST_SET':
@ -8,7 +7,7 @@ export default function reducer(snapcast = {}, action) {
return { ...snapcast, connected: true, connecting: false };
case 'SNAPCAST_CONNECTING':
return { ...snapcast, connecting: true, connected: false };
return { ...snapcast, connecting: true, connected: false };
case 'SNAPCAST_DISCONNECTED':
return { ...snapcast, connected: false, connecting: false };
@ -30,7 +29,7 @@ export default function reducer(snapcast = {}, action) {
groups[group.id] = {
...(groups[group.id] ? groups[group.id] : {}),
...group,
}
};
}
return { ...snapcast, groups };

View File

@ -24,11 +24,11 @@ import {
import URILink from '../../components/URILink';
import { getItem } from '../../util/selectors';
const coreActions = require('../../services/core/actions');
const uiActions = require('../../services/ui/actions');
const mopidyActions = require('../../services/mopidy/actions');
const lastfmActions = require('../../services/lastfm/actions');
const geniusActions = require('../../services/genius/actions');
const coreActions = require('../core/actions');
const uiActions = require('../ui/actions');
const mopidyActions = require('../mopidy/actions');
const lastfmActions = require('../lastfm/actions');
const geniusActions = require('../genius/actions');
/**
* Send an ajax request to the Spotify API
@ -98,7 +98,7 @@ const request = ({
fetch(url, config)
.then(status)
.then(data => {
.then((data) => {
// TODO: Instead of allowing request to fail before renewing the token, once refreshed
// we should retry the original request(s)
if (data && data.error) {
@ -111,7 +111,7 @@ const request = ({
resolve(data);
})
.catch(error => {
.catch((error) => {
reject(error);
});
},
@ -273,7 +273,6 @@ export function connect() {
};
}
/**
* Handle authorization process
* */
@ -308,7 +307,6 @@ export function importAuthorization(authorization) {
};
}
/**
* Get current user
* */
@ -475,18 +473,18 @@ export function getCategory(uri, { forceRefetch } = {}) {
getState,
endpoint: plEndpoint,
}).then((response) => {
playlists = [...playlists, ...formatPlaylists(response.playlists.items)];
if (response.playlists.next) {
fetchPlaylists(response.playlists.next);
} else {
dispatch(coreActions.itemLoaded({
...category,
playlists_uris: arrayOf('uri', playlists),
}));
dispatch(coreActions.itemsLoaded(playlists));
dispatch(uiActions.stopLoading(loaderId));
}
});
playlists = [...playlists, ...formatPlaylists(response.playlists.items)];
if (response.playlists.next) {
fetchPlaylists(response.playlists.next);
} else {
dispatch(coreActions.itemLoaded({
...category,
playlists_uris: arrayOf('uri', playlists),
}));
dispatch(coreActions.itemsLoaded(playlists));
dispatch(uiActions.stopLoading(loaderId));
}
});
fetchPlaylists(plEndpoint);
},
(error) => {
@ -811,12 +809,22 @@ export function following(uri, method = 'GET') {
if (method === 'DELETE') {
dispatch(coreActions.removeFromLibrary(`spotify:library:${type}s`, uri));
dispatch(uiActions.createNotification({
content: <span>Removed <URILink type={type} uri={uri}>{asset ? asset.name : type}</URILink> from library</span>,
content: <span>
Removed
<URILink type={type} uri={uri}>{asset ? asset.name : type}</URILink>
{' '}
from library
</span>,
}));
} else if (method === 'PUT' || method === 'POST') {
dispatch(coreActions.addToLibrary(`spotify:library:${type}s`, asset));
dispatch(uiActions.createNotification({
content: <span>Added <URILink type={type} uri={uri}>{asset ? asset.name : type}</URILink> to library</span>,
content: <span>
Added
<URILink type={type} uri={uri}>{asset ? asset.name : type}</URILink>
{' '}
to library
</span>,
}));
}
},
@ -891,7 +899,6 @@ export function resolveRadioSeeds(radio) {
};
}
/**
* =============================================================== ARTIST(S) ============
* ======================================================================================
@ -922,11 +929,12 @@ export function getArtist(uri, { full, forceRefetch } = {}) {
);
// Do we want a full artist, with all supporting material?
if (full) {
if (full) {
// All albums (gets all pages, may take some time to iterate them all)
let albums = [];
const fetchAlbums = (endpoint) => request({ dispatch, getState, endpoint, uri })
const fetchAlbums = (endpoint) => request({
dispatch, getState, endpoint, uri,
})
.then((response) => {
albums = [...albums, ...formatAlbums(response.items)];
if (response.next) {
@ -945,7 +953,9 @@ export function getArtist(uri, { full, forceRefetch } = {}) {
let tracksEndpoint = `artists/${getFromUri('artistid', uri)}`;
tracksEndpoint += `/top-tracks?country=${getState().spotify.country}`;
if (forceRefetch) tracksEndpoint += `&refetch=${Date.now()}`;
request({ dispatch, getState, endpoint: tracksEndpoint, uri })
request({
dispatch, getState, endpoint: tracksEndpoint, uri,
})
.then(
(response) => {
dispatch(coreActions.itemLoaded({
@ -958,7 +968,9 @@ export function getArtist(uri, { full, forceRefetch } = {}) {
// Related artists
let relatedEndpoint = `artists/${getFromUri('artistid', uri)}/related-artists`;
if (forceRefetch) relatedEndpoint += `?refetch=${Date.now()}`;
request({ dispatch, getState, endpoint: relatedEndpoint, uri })
request({
dispatch, getState, endpoint: relatedEndpoint, uri,
})
.then(
(response) => {
dispatch(coreActions.itemLoaded({
@ -975,7 +987,7 @@ export function getArtist(uri, { full, forceRefetch } = {}) {
export function getArtistImages(artist) {
return (dispatch, getState) => {
request({ dispatch, getState, endpoint: `search?q=${artist.name}&type=artist` })
.then(response => {
.then((response) => {
if (response.artists.items.length > 0) {
dispatch(coreActions.itemLoaded({
uri: artist.uri,
@ -1012,7 +1024,6 @@ export function playArtistTopTracks(uri) {
};
}
/**
* =============================================================== USER(S) ==============
* ======================================================================================
@ -1038,7 +1049,9 @@ export function getUser(uri, { full, forceRefetch } = {}) {
if (full) {
let playlists = [];
const fetchPlaylists = (endpoint) => request({ dispatch, getState, endpoint, uri })
const fetchPlaylists = (endpoint) => request({
dispatch, getState, endpoint, uri,
})
.then((response) => {
playlists = [...playlists, ...formatPlaylists(response.items)];
if (response.next) {
@ -1054,11 +1067,10 @@ export function getUser(uri, { full, forceRefetch } = {}) {
fetchPlaylists(
`users/${userId}/playlists?limit=40${forceRefetch ? `&refetch=${Date.now()}` : ''}`,
);
};
}
};
}
/**
* =============================================================== ALBUM(S) =============
* ======================================================================================
@ -1103,7 +1115,8 @@ export function getAlbum(uri, { full, forceRefetch } = {}) {
tracks,
}));
}
});
},
);
if (response.tracks.next) {
fetchTracks(response.tracks.next);
@ -1120,7 +1133,6 @@ export function getAlbum(uri, { full, forceRefetch } = {}) {
};
}
/**
* =============================================================== PLAYLIST(S) ==========
* ======================================================================================
@ -1264,7 +1276,9 @@ export function getPlaylistTracks(uri, { forceRefetch, callbackAction } = {}) {
let tracks = [];
const fetchTracks = (endpoint) => request({ dispatch, getState, endpoint, uri })
const fetchTracks = (endpoint) => request({
dispatch, getState, endpoint, uri,
})
.then((response) => {
tracks = [...tracks, ...formatTracks(response.items)];
if (response.next) {
@ -1301,7 +1315,7 @@ export function getPlaylistTracks(uri, { forceRefetch, callbackAction } = {}) {
});
fetchTracks(initialEndpoint);
}
};
}
export function getPlaylist(uri, options = {}) {
@ -1319,7 +1333,9 @@ export function getPlaylist(uri, options = {}) {
endpoint += `?market=${getState().spotify.country}`;
if (forceRefetch) endpoint += `&refetch=${Date.now()}`;
request({ dispatch, getState, endpoint, uri })
request({
dispatch, getState, endpoint, uri,
})
.then(
(response) => {
let description = null;
@ -1342,7 +1358,7 @@ export function getPlaylist(uri, options = {}) {
if (full) {
dispatch(getPlaylistTracks(uri, options));
};
}
},
(error) => {
dispatch(coreActions.handleException(
@ -1558,7 +1574,6 @@ export function getRecommendations(uris = [], limit = 20, tunabilities = null) {
};
}
/**
* Get all the available genres
*
@ -1584,7 +1599,6 @@ export function getGenres() {
};
}
/**
* =============================================================== LIBRARY ==============
* ======================================================================================

View File

@ -178,7 +178,7 @@ const SpotifyMiddleware = (function () {
break;
case 'SPOTIFY_ME_LOADED': {
var me = { ...formatUser(action.me) };
const me = { ...formatUser(action.me) };
// We are Anonymous currently so use 'me' name as my Pusher username
if (store.getState().pusher.username == 'Anonymous') {

View File

@ -1,4 +1,3 @@
import { removeDuplicates, arrayOf } from '../../util/arrays';
import { formatTracks } from '../../util/format';
@ -74,7 +73,6 @@ export default function reducer(spotify = {}, action) {
case 'SPOTIFY_FEATURED_PLAYLISTS_LOADED':
return { ...spotify, featured_playlists: action.data };
case 'SPOTIFY_NEW_RELEASES_LOADED':
var new_releases = [];
if (spotify.new_releases) {
@ -153,14 +151,13 @@ export default function reducer(spotify = {}, action) {
genres: action.genres,
};
/**
* Categories
* */
case 'SPOTIFY_CATEGORIES_LOADED':
var categories = { ...spotify.categories };
for (var category of action.categories) {
for (const category of action.categories) {
categories[category.uri] = category;
}
return { ...spotify, categories };

View File

@ -198,7 +198,6 @@ export function installPrompt(event) {
};
}
/**
* Notifications
*
@ -255,7 +254,6 @@ export function removeNotification(key, manual = false) {
};
}
/**
* Loaders
* */

View File

@ -1,5 +1,5 @@
import ReactGA from 'react-ga';
import ReactGA from 'react-ga';
const uiActions = require('./actions.js');
const UIMiddleware = (function () {

View File

@ -97,7 +97,6 @@ export default function reducer(ui = {}, action) {
case 'CLOSE_MODAL':
return { ...ui, modal: false };
/**
* Notifications
* */
@ -118,7 +117,6 @@ export default function reducer(ui = {}, action) {
delete notifications[action.key];
return { ...ui, notifications };
/**
* Loading and processes
* */

View File

@ -36,7 +36,6 @@ const arrayOf = (property, items = []) => {
return array;
};
/**
* Merge duplicated items in an array
*
@ -62,7 +61,6 @@ const mergeDuplicates = function (list, key) {
return clean_list;
};
/**
* Remove duplicate items in a simple array
*
@ -80,7 +78,6 @@ const removeDuplicates = function (array) {
return unique;
};
/**
* Apply a partial text search on an array of objects
*
@ -107,7 +104,6 @@ const applyFilter = function (field, value, array, singular = false) {
return results;
};
/**
* Convert a list of indexes to a useable range
* We ignore stragglers, and only attend to the first 'bunch' of consecutive indexes

View File

@ -88,7 +88,6 @@ const digestMopidyImages = function (mopidy, images) {
return digested;
};
/**
* Format image URLs into a consistent size-based object
* We digest all our known image source formats into a universal small,medium,large,huge object
@ -194,7 +193,6 @@ const formatImages = function (data) {
return sizes;
};
/**
* Format a simple object
* This is a shell record containing only the bare essentials. Typically
@ -339,10 +337,10 @@ const decodeUri = (rawUri = '') => {
};
const encodeMopidyUri = (rawUri = '') => {
let uri = rawUri;
const uri = rawUri;
return uri;
}
};
/**
* Format our album objects into a universal format
@ -417,7 +415,6 @@ const formatAlbum = function (data) {
return album;
};
/**
* Format our artist objects into a universal format
*
@ -478,7 +475,6 @@ const formatArtist = function (data) {
return artist;
};
/**
* Format our playlist objects into a universal format
*
@ -566,7 +562,6 @@ const formatPlaylist = function (data) {
return playlist;
};
/**
* Format a user objects into a universal format
*
@ -622,7 +617,6 @@ const formatUser = function (data) {
return user;
};
/**
* Format tracks into our universal format
*
@ -834,7 +828,7 @@ const formatCategory = function (data) {
if (!category.uri && data.id) {
category.uri = `spotify:category:${data.id}`;
}
if (data.icons) {
category.images = formatImages(data.icons);
}
@ -871,10 +865,7 @@ const formatGroup = function (data) {
return group;
};
const collateLibrary = (uris, itemsIndex) => {
return compact(uris.map((uri) => itemsIndex[uri]));
};
const collateLibrary = (uris, itemsIndex) => compact(uris.map((uri) => itemsIndex[uri]));
/**
* Collate an object with external references into a fully self-contained object
@ -1014,9 +1005,7 @@ const collate = function (obj, indexes = {}) {
*
* @param {Array} array of objects to have sort_id added
*/
const injectSortId = (array) => {
return array.map((item, index) => ({ ...item, sort_id: index }));
};
const injectSortId = (array) => array.map((item, index) => ({ ...item, sort_id: index }));
export {
toJSON,

View File

@ -1,5 +1,5 @@
import { indexToArray, arrayOf } from "./arrays";
import { encodeUri } from "./format";
import { indexToArray, arrayOf } from './arrays';
import { encodeUri } from './format';
/**
* Returns a function, that, as long as it continues to be invoked, will not
@ -31,7 +31,6 @@ const debounce = function (fn, wait, immediate) {
};
};
const throttle = function (fn, delay) {
let lastCall = 0;
return function (...args) {
@ -44,9 +43,6 @@ const throttle = function (fn, delay) {
};
};
/**
* Set the app's favicon to a specific image.
*
@ -70,7 +66,6 @@ const setFavicon = function (filename) {
}
};
/**
* Digest a react-router's location.search string into an array of values
*
@ -87,7 +82,7 @@ const queryString = (key, string, compact = true) => {
// happens when redirecting from an OAuth failure.
if (subElements[0] === key) {
results = subElements[1].split(',').map(
item => decodeURIComponent(item.replace(/\+/g, '%20')),
(item) => decodeURIComponent(item.replace(/\+/g, '%20')),
);
}
return [...accumulator, ...results];
@ -98,8 +93,6 @@ const queryString = (key, string, compact = true) => {
return results;
};
const generateGuid = function (type = 'numeric', length = 12) {
// numeric
if (type == 'numeric') {
@ -131,7 +124,7 @@ const getCurrentPusherConnection = function (connections, connectionid) {
* Figure out a URI's source namespace
* @param uri = string
* */
let uriSource = function (uri) {
const uriSource = function (uri) {
if (!uri) return '';
const exploded = `${uri}`.split(':');
@ -303,9 +296,9 @@ const getFromUri = (element, uri) => {
case 'seeds':
if (exploded[1] == 'discover') {
return exploded[2];
} else if (exploded[1] === 'radio') {
} if (exploded[1] === 'radio') {
const seeds = exploded[2].split(',');
return seeds.map(seed => seed.replace(/_/gi, ':'));
return seeds.map((seed) => seed.replace(/_/gi, ':'));
}
break;
@ -360,19 +353,18 @@ const isNumeric = function (value) {
return !isNaN(parseFloat(value)) && isFinite(value);
};
/**
* Figure out if a value is an object
* @param value = mixed
* @return boolean
* */
let isObject = function (value) {
const isObject = function (value) {
return value instanceof Object && value.constructor === Object;
};
/**
* Convert an array of strings to an array of RegExp objects
*
*
* @param {Array} keys
*/
const toRegExp = function (keys) {
@ -421,12 +413,11 @@ const isLoading = function (load_queue = {}, keys = []) {
* */
const isHosted = function (hosts = ['jaedb.github.io']) {
const {
hostname
hostname,
} = window.location;
return hosts.includes(hostname);
};
/**
* Get indexed record(s) by URI from our asset index
*
@ -451,7 +442,6 @@ const getIndexedRecords = function (index, uris) {
return records;
};
/**
* Uppercase-ify the first character of a string
*
@ -467,70 +457,70 @@ const titleCase = function (string = '') {
*/
const iconFromKeyword = (name) => {
const iconWords = [{
icon: 'business',
words: ['office', 'work']
},
{
icon: 'king_bed',
words: ['bed']
},
{
icon: 'weekend',
words: ['lounge', 'tv', 'sitting room']
},
{
icon: 'directions_car',
words: ['garage', 'basement']
},
{
icon: 'local_laundry_service',
words: ['laundry']
},
{
icon: 'fitness_center',
words: ['gym']
},
{
icon: 'kitchen',
words: ['kitchen']
},
{
icon: 'deck',
words: ['deck', 'outside']
},
{
icon: 'restaurant_menu',
words: ['dining', 'dinner']
},
{
icon: 'laptop',
words: ['laptop']
},
{
icon: 'bug_report',
words: ['test', 'debug']
},
{
icon: 'child_care',
words: ['kids', 'baby']
},
{
icon: 'smartphone',
words: ['phone', 'mobile']
},
{
icon: 'web',
words: ['web', 'browser', 'iris']
},
icon: 'business',
words: ['office', 'work'],
},
{
icon: 'king_bed',
words: ['bed'],
},
{
icon: 'weekend',
words: ['lounge', 'tv', 'sitting room'],
},
{
icon: 'directions_car',
words: ['garage', 'basement'],
},
{
icon: 'local_laundry_service',
words: ['laundry'],
},
{
icon: 'fitness_center',
words: ['gym'],
},
{
icon: 'kitchen',
words: ['kitchen'],
},
{
icon: 'deck',
words: ['deck', 'outside'],
},
{
icon: 'restaurant_menu',
words: ['dining', 'dinner'],
},
{
icon: 'laptop',
words: ['laptop'],
},
{
icon: 'bug_report',
words: ['test', 'debug'],
},
{
icon: 'child_care',
words: ['kids', 'baby'],
},
{
icon: 'smartphone',
words: ['phone', 'mobile'],
},
{
icon: 'web',
words: ['web', 'browser', 'iris'],
},
];
for (let item of iconWords) {
for (let word of item.words) {
for (const item of iconWords) {
for (const word of item.words) {
if (name.match(new RegExp(`(${word})`, 'gi'))) {
return item.icon;
}
}
};
}
}
};
/**
* Scroll to the top of the page
@ -582,7 +572,6 @@ const scrollTo = function (target = null, smooth_scroll = false) {
setTimeout(performScroll, 1);
};
/**
* Upgrade one or many Spotify Playlist URIs
* This is their new, simplified syntax (September 2018) but they haven't updated it everywhere
@ -688,4 +677,4 @@ export default {
iconFromKeyword,
decodeMopidyUri,
encodeMopidyUri,
};
};

View File

@ -1,4 +1,3 @@
/**
* Storage handler
* All localStorage tasks are handled below. This means we can detect for localStorage issues in one place
@ -15,7 +14,7 @@ const storageFactory = (function () {
return result && storage;
} catch (exception) {
return false;
};
}
}());
/**
@ -81,7 +80,7 @@ const cache = {
}
},
set: (key, data) => {
let cache = get('cache', {});
const cache = get('cache', {});
cache[`"${key}"`] = data;
set('cache', cache);
return true;
@ -91,7 +90,6 @@ const cache = {
},
};
/**
* Check if an image URL is cached or not
* Useful for bypassing load animations for cached assets (eg parallax)

View File

@ -189,7 +189,7 @@ class Artist extends React.Component {
const {
albumsFilter: filter,
} = this.state;
let {
const {
tracks,
related_artists,
} = artist;
@ -405,7 +405,7 @@ class Artist extends React.Component {
<Thumbnail size="huge" canZoom fill images={image} />
</div>
);
}
},
);
return (

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -91,7 +90,7 @@ class Playlist extends React.Component {
setWindowTitle = (playlist = this.props.playlist) => {
const { uiActions: { setWindowTitle } } = this.props;
setWindowTitle(
playlist ? i18n('playlist.title_window', { name: playlist.name }) : i18n('playlist.title')
playlist ? i18n('playlist.title_window', { name: playlist.name }) : i18n('playlist.title'),
);
}

View File

@ -48,7 +48,7 @@ const Artwork = ({
</Thumbnail>
</div>
);
}
};
class Queue extends React.Component {
componentDidMount() {
@ -130,7 +130,7 @@ class Queue extends React.Component {
let addedFromItems = [];
// Radio nests it's seed URIs in an encoded URI format
switch (uri_type){
switch (uri_type) {
case 'radio':
addedFromItems = indexToArray(items, getFromUri('seeds', added_from_uri));
break;

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@ -66,7 +65,7 @@ class Settings extends React.Component {
set,
},
} = this.props;
const shortName = name.replace('mopidy_','');
const shortName = name.replace('mopidy_', '');
set({ [shortName]: value });
this.setState({ [name]: value });
}
@ -278,7 +277,7 @@ class Settings extends React.Component {
onChange={() => uiActions.set({ hotkeys_enabled: !ui.hotkeys_enabled })}
/>
<span className="label">
<I18n path="settings.interface.behavior.hotkeys" />
<I18n path="settings.interface.behavior.hotkeys" />
</span>
</label>
<label>

View File

@ -31,8 +31,7 @@ const LyricsSelector = ({
lyrics_path,
} = {},
getTrackLyrics,
}) => {
}) => {
if (lyrics_results === undefined || lyrics_results === null) return null;
if (lyrics_results.length <= 0) {
return (
@ -66,7 +65,7 @@ const LyricsSelector = ({
</div>
</div>
);
}
};
const LyricsContent = ({
authorized,
@ -87,7 +86,7 @@ const LyricsContent = ({
.
</p>
);
};
}
if (!lyrics) return null;
return (
@ -105,33 +104,31 @@ const LyricsContent = ({
</div>
</div>
);
}
};
const Lyrics = ({
loading,
authorized,
track,
getTrackLyrics,
}) => {
return (
<>
<h4>
<I18n path="track.lyrics" />
{loading && <Loader loading mini />}
</h4>
}) => (
<>
<h4>
<I18n path="track.lyrics" />
{loading && <Loader loading mini />}
</h4>
<LyricsSelector
getTrackLyrics={getTrackLyrics}
authorized={authorized}
track={track}
/>
<LyricsContent
track={track}
authorized={authorized}
/>
</>
);
}
<LyricsSelector
getTrackLyrics={getTrackLyrics}
authorized={authorized}
track={track}
/>
<LyricsContent
track={track}
authorized={authorized}
/>
</>
);
class Track extends React.Component {
componentDidMount() {
@ -223,7 +220,7 @@ class Track extends React.Component {
uiActions,
genius_authorized,
geniusActions: {
getTrackLyrics
getTrackLyrics,
},
loadingLyrics,
} = this.props;

View File

@ -242,7 +242,7 @@ class Discover extends React.Component {
let uri = 'iris:discover';
if (seeds) {
uri += ':';
for (var i = 0; i < seeds.length; i++) {
for (let i = 0; i < seeds.length; i++) {
if (i > 0) {
uri += ',';
}
@ -363,22 +363,22 @@ class Discover extends React.Component {
}
return (
<div className={`seed${seed.images ? ' has-thumbnail' : ''}`} key={seed.uri}>
{images && (
<URILink className="thumbnail-wrapper" type={type} uri={seed.uri}>
<Thumbnail images={images} circle={seed.type === 'artist'} size="small" />
</URILink>
)}
<div className="seed__details">
<div className="seed__label">
<span className="seed__label__text">{titleCase(type)}</span>
<Icon name="close" className="seed__label__remove" onClick={() => this.removeSeed(index)} />
</div>
<div className="seed__label__name">{seed.name}</div>
</div>
</div>
<div className={`seed${seed.images ? ' has-thumbnail' : ''}`} key={seed.uri}>
{images && (
<URILink className="thumbnail-wrapper" type={type} uri={seed.uri}>
<Thumbnail images={images} circle={seed.type === 'artist'} size="small" />
</URILink>
)}
<div className="seed__details">
<div className="seed__label">
<span className="seed__label__text">{titleCase(type)}</span>
<Icon name="close" className="seed__label__remove" onClick={() => this.removeSeed(index)} />
</div>
<div className="seed__label__name">{seed.name}</div>
</div>
</div>
);
})
})
}
</div>
);
@ -514,7 +514,7 @@ class Discover extends React.Component {
tunabilities,
seeds,
} = this.state;
const is_loading = isLoading(load_queue, ['spotify_recommendations']);
const addable_tunabilities = [];
for (const key in this.state.tunabilities) {

View File

@ -248,7 +248,7 @@ class LibraryArtists extends React.Component {
<FilterField
initialValue={this.state.filter}
handleChange={(value) => this.setState({ filter: value, limit: this.state.per_page })}
onSubmit={e => this.props.uiActions.hideContextMenu()}
onSubmit={(e) => this.props.uiActions.hideContextMenu()}
/>
<DropdownField
icon="swap_vert"
@ -291,7 +291,7 @@ class LibraryArtists extends React.Component {
<div className="view library-artists-view">
<Header options={options} uiActions={this.props.uiActions}>
<Icon name="recent_actors" type="material" />
<I18n path="library.artists.title" />
<I18n path="library.artists.title" />
</Header>
{this.renderView()}
</div>

Some files were not shown because too many files have changed in this diff Show More