Exposing components for translation mapping; Queue and AAlbum views now moved to translation file
This commit is contained in:
@ -86601,9 +86601,12 @@ exports.default = (0, _react.memo)(function (props) {
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.dater = exports.Dater = undefined;
|
||||
|
||||
var _react = __webpack_require__(/*! react */ "./node_modules/react/index.js");
|
||||
|
||||
var _locale = __webpack_require__(/*! ../locale */ "./src/js/locale/index.js");
|
||||
|
||||
/**
|
||||
* Format time duration
|
||||
*
|
||||
@ -86656,21 +86659,21 @@ var durationSentence = function durationSentence() {
|
||||
var totalMinutes = Math.floor(milliseconds / (1000 * 60));
|
||||
var totalHours = Math.floor(milliseconds / (1000 * 60 * 60));
|
||||
|
||||
if (totalHours > 1) return totalHours + '+ hrs';
|
||||
if (totalMinutes > 1) return totalMinutes + ' mins';
|
||||
if (totalSeconds) return totalSeconds + ' sec';
|
||||
return '0 mins';
|
||||
if (totalHours > 1) return totalHours + '+ ' + (0, _locale.content)('time.hours.short');
|
||||
if (totalMinutes > 1) return totalMinutes + ' ' + (0, _locale.content)('time.minutes.short');
|
||||
if (totalSeconds) return totalSeconds + ' ' + (0, _locale.content)('time.seconds.short');
|
||||
return '0 ' + (0, _locale.content)('time.minutes.short');
|
||||
};
|
||||
|
||||
exports.default = (0, _react.memo)(function (props) {
|
||||
if (props.data === undefined) {
|
||||
var dater = function dater(type, data) {
|
||||
if (data === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (props.type) {
|
||||
switch (type) {
|
||||
case 'total-time':
|
||||
var duration = 0;
|
||||
var tracks = props.data;
|
||||
var tracks = data;
|
||||
for (var i = 0; i < tracks.length; i++) {
|
||||
if (tracks[i].duration) {
|
||||
duration += parseInt(tracks[i].duration);
|
||||
@ -86679,21 +86682,21 @@ exports.default = (0, _react.memo)(function (props) {
|
||||
return durationSentence(duration);
|
||||
|
||||
case 'length':
|
||||
return durationTime(props.data);
|
||||
return durationTime(data);
|
||||
|
||||
case 'date':
|
||||
|
||||
// A four-character date indicates just a year (rather than a full date)
|
||||
if (props.data.length == 4) {
|
||||
return props.data;
|
||||
if (data.length == 4) {
|
||||
return data;
|
||||
|
||||
// Digest as a date string
|
||||
}
|
||||
var date = new Date(props.data);
|
||||
var date = new Date(data);
|
||||
return date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear();
|
||||
|
||||
case 'ago':
|
||||
var date = new Date(props.data);
|
||||
var date = new Date(data);
|
||||
var diff = new Date() - date;
|
||||
var seconds = Math.floor(diff / 1000);
|
||||
var minutes = Math.floor(diff / (1000 * 60));
|
||||
@ -86703,22 +86706,32 @@ exports.default = (0, _react.memo)(function (props) {
|
||||
var years = Math.floor(diff / (1000 * 60 * 60 * 24 * 7 * 52));
|
||||
|
||||
if (seconds < 60) {
|
||||
return seconds + ' second' + (seconds > 1 ? 's' : '');
|
||||
return seconds + ' ' + (0, _locale.content)('time.seconds.' + (seconds > 1 ? 'singular' : 'plural'));
|
||||
}if (minutes < 60) {
|
||||
return minutes + ' minute' + (minutes > 1 ? 's' : '');
|
||||
return minutes + ' ' + (0, _locale.content)('time.minutes.' + (minutes > 1 ? 'singular' : 'plural'));
|
||||
}if (hours < 24) {
|
||||
return hours + ' hour' + (hours > 1 ? 's' : '');
|
||||
return hours + ' ' + (0, _locale.content)('time.hours.' + (hours > 1 ? 'singular' : 'plural'));
|
||||
}if (days < 7) {
|
||||
return days + ' day' + (days > 1 ? 's' : '');
|
||||
return days + ' ' + (0, _locale.content)('time.days.' + (days > 1 ? 'singular' : 'plural'));
|
||||
}if (weeks < 54) {
|
||||
return weeks + ' week' + (weeks > 1 ? 's' : '');
|
||||
return weeks + ' ' + (0, _locale.content)('time.weeks.' + (weeks > 1 ? 'singular' : 'plural'));
|
||||
}
|
||||
return years + ' year' + (years > 1 ? 's' : '');
|
||||
return years + ' ' + (0, _locale.content)('time.years.' + (years > 1 ? 'singular' : 'plural'));
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
var Dater = (0, _react.memo)(function (_ref) {
|
||||
var type = _ref.type,
|
||||
data = _ref.data;
|
||||
return dater(type, data);
|
||||
});
|
||||
|
||||
exports.Dater = Dater;
|
||||
exports.dater = dater;
|
||||
exports.default = Dater;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/js/components/DebugInfo.js":
|
||||
@ -92193,6 +92206,7 @@ exports.default = (0, _react.memo)(function (props) {
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.nice_number = exports.NiceNumber = undefined;
|
||||
|
||||
var _react = __webpack_require__(/*! react */ "./node_modules/react/index.js");
|
||||
|
||||
@ -92200,8 +92214,8 @@ var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = (0, _react.memo)(function (props) {
|
||||
var formatted = parseInt(props.value);
|
||||
var nice_number = function nice_number(value) {
|
||||
var formatted = parseInt(value);
|
||||
|
||||
// > 1 million
|
||||
if (formatted > 1000000) {
|
||||
@ -92219,8 +92233,17 @@ exports.default = (0, _react.memo)(function (props) {
|
||||
}
|
||||
|
||||
return formatted;
|
||||
};
|
||||
|
||||
var NiceNumber = (0, _react.memo)(function (_ref) {
|
||||
var value = _ref.value;
|
||||
return nice_number(value);
|
||||
});
|
||||
|
||||
exports.NiceNumber = NiceNumber;
|
||||
exports.nice_number = nice_number;
|
||||
exports.default = NiceNumber;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/js/components/Notifications.js":
|
||||
@ -97430,10 +97453,10 @@ exports.de = de;
|
||||
/*!*******************************!*\
|
||||
!*** ./src/js/locale/en.yaml ***!
|
||||
\*******************************/
|
||||
/*! exports provided: sidebar, now_playing, search, settings, default */
|
||||
/*! exports provided: errors, specs, actions, time, sidebar, now_playing, album, search, settings, default */
|
||||
/***/ (function(module) {
|
||||
|
||||
module.exports = JSON.parse("{\"sidebar\":{\"now_playing\":\"Now playing\",\"search\":\"Search\",\"discover\":\"Discover\",\"genre\":\"Genre / Mood\",\"featured_playlists\":\"Featured playlists\",\"new_releases\":\"New releases\",\"my_music\":\"My music\",\"playlists\":\"Playlists\",\"artists\":\"Artists\",\"albums\":\"Albums\",\"tracks\":\"Tracks\",\"browse\":\"Browse\",\"settings\":\"Settings\",\"not_connected\":\"%{name} not connected\"},\"now_playing\":{\"title\":\"Now playing\",\"context_actions\":{\"radio\":\"Radio\",\"history\":\"History\",\"add_uri\":\"Add URI\"},\"current_track\":{\"playing_from\":\"Playling from\",\"shuffle\":\"Shuffle\",\"clear\":\"Clear\"}},\"search\":{\"title\":\"Search: %{term}\",\"context_actions\":{\"sort\":\"Sort\",\"source\":\"Sources (%{count})\"},\"placeholder\":\"Search\",\"artists\":{\"title\":\"Artists\",\"more\":\"All artists (%{count})\"},\"albums\":{\"title\":\"Albums\",\"more\":\"All albums (%{count})\"},\"playlists\":{\"title\":\"Playlists\",\"more\":\"All playlists (%{count})\"},\"tracks\":{\"title\":\"Tracks\"}},\"settings\":{\"title\":\"Settings\"}}");
|
||||
module.exports = JSON.parse("{\"errors\":{\"uri_not_found\":\"Could not find anything with URI %{uri}\"},\"specs\":{\"tracks\":\"%{count} tracks\",\"followers\":\"%{count} followers\",\"listeners\":\"%{count} listeners\",\"plays\":\"%{count} plays\"},\"actions\":{\"play\":\"Play\",\"pause\":\"Pause\",\"stop\":\"Stop\",\"add_to_library\":\"Add to library\",\"remove_from_library\":\"Remove from library\"},\"time\":{\"seconds\":{\"short\":\"secs\",\"singular\":\"second\",\"plural\":\"seconds\"},\"minutes\":{\"short\":\"mins\",\"singular\":\"minute\",\"plural\":\"minutes\"},\"hours\":{\"short\":\"hrs\",\"singular\":\"hour\",\"plural\":\"hours\"},\"days\":{\"short\":\"days\",\"singular\":\"day\",\"plural\":\"days\"},\"weeks\":{\"short\":\"wks\",\"singular\":\"week\",\"plural\":\"weeks\"},\"years\":{\"short\":\"yrs\",\"singular\":\"year\",\"plural\":\"years\"}},\"sidebar\":{\"now_playing\":\"Now playing\",\"search\":\"Search\",\"discover\":\"Discover\",\"genre\":\"Genre / Mood\",\"featured_playlists\":\"Featured playlists\",\"new_releases\":\"New releases\",\"my_music\":\"My music\",\"playlists\":\"Playlists\",\"artists\":\"Artists\",\"albums\":\"Albums\",\"tracks\":\"Tracks\",\"browse\":\"Browse\",\"settings\":\"Settings\",\"not_connected\":\"%{name} not connected\"},\"now_playing\":{\"title\":\"Now playing\",\"context_actions\":{\"radio\":\"Radio\",\"history\":\"History\",\"add_uri\":\"Add URI\"},\"current_track\":{\"playing_from\":\"Playing from\",\"shuffle\":\"Shuffle\",\"clear\":\"Clear\",\"radio\":\"Radio\"}},\"album\":{\"title\":\"Album\",\"title_window\":\"%{name} by %{artist} (album)\",\"wiki\":{\"title\":\"About\",\"published\":\"Published: %{date}\"}},\"search\":{\"title\":\"Search: %{term}\",\"context_actions\":{\"sort\":\"Sort\",\"source\":\"Sources (%{count})\"},\"placeholder\":\"Search\",\"artists\":{\"title\":\"Artists\",\"more\":\"All artists (%{count})\"},\"albums\":{\"title\":\"Albums\",\"more\":\"All albums (%{count})\"},\"playlists\":{\"title\":\"Playlists\",\"more\":\"All playlists (%{count})\"},\"tracks\":{\"title\":\"Tracks\"}},\"settings\":{\"title\":\"Settings\"}}");
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -97477,7 +97500,6 @@ var content = function content(path) {
|
||||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var transform = arguments[2];
|
||||
|
||||
console.log(window.language);
|
||||
var dictionary = _dictionaries2.default[window.language || 'en'] || _dictionaries2.default.en;
|
||||
|
||||
var value = (0, _get2.default)(dictionary, path, '');
|
||||
@ -112589,10 +112611,6 @@ var _ErrorMessage = __webpack_require__(/*! ../components/ErrorMessage */ "./src
|
||||
|
||||
var _ErrorMessage2 = _interopRequireDefault(_ErrorMessage);
|
||||
|
||||
var _Header = __webpack_require__(/*! ../components/Header */ "./src/js/components/Header.js");
|
||||
|
||||
var _Header2 = _interopRequireDefault(_Header);
|
||||
|
||||
var _TrackList = __webpack_require__(/*! ../components/TrackList */ "./src/js/components/TrackList.js");
|
||||
|
||||
var _TrackList2 = _interopRequireDefault(_TrackList);
|
||||
@ -112601,10 +112619,6 @@ var _Thumbnail = __webpack_require__(/*! ../components/Thumbnail */ "./src/js/co
|
||||
|
||||
var _Thumbnail2 = _interopRequireDefault(_Thumbnail);
|
||||
|
||||
var _Parallax = __webpack_require__(/*! ../components/Parallax */ "./src/js/components/Parallax.js");
|
||||
|
||||
var _Parallax2 = _interopRequireDefault(_Parallax);
|
||||
|
||||
var _LinksSentence = __webpack_require__(/*! ../components/LinksSentence */ "./src/js/components/LinksSentence.js");
|
||||
|
||||
var _LinksSentence2 = _interopRequireDefault(_LinksSentence);
|
||||
@ -112637,6 +112651,8 @@ var _Icon = __webpack_require__(/*! ../components/Icon */ "./src/js/components/I
|
||||
|
||||
var _Icon2 = _interopRequireDefault(_Icon);
|
||||
|
||||
var _locale = __webpack_require__(/*! ../locale */ "./src/js/locale/index.js");
|
||||
|
||||
var _actions = __webpack_require__(/*! ../services/core/actions */ "./src/js/services/core/actions.js");
|
||||
|
||||
var coreActions = _interopRequireWildcard(_actions);
|
||||
@ -112740,31 +112756,30 @@ var Album = exports.Album = function (_React$Component) {
|
||||
if (!prevAlbum && album) _this.setWindowTitle(album);
|
||||
}, _this.setWindowTitle = function () {
|
||||
var album = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.album;
|
||||
var setWindowTitle = _this.props.uiActions.setWindowTitle;
|
||||
var _this$props4 = _this.props,
|
||||
setWindowTitle = _this$props4.uiActions.setWindowTitle,
|
||||
artists = _this$props4.artists;
|
||||
|
||||
|
||||
if (album) {
|
||||
var artists = '';
|
||||
var artistNames = [];
|
||||
if (album.artists_uris && artists) {
|
||||
for (var i = 0; i < album.artists_uris.length; i++) {
|
||||
var uri = album.artists_uris[i];
|
||||
if (artists.hasOwnProperty(uri)) {
|
||||
if (artists != '') {
|
||||
artists += ', ';
|
||||
}
|
||||
artists += artists[uri].name;
|
||||
artistNames.push(artists[uri].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
setWindowTitle(album.name + ' by ' + artists + ' (album)');
|
||||
setWindowTitle((0, _locale.content)('album.title_window', { name: album.name, artist: artistNames.join() }));
|
||||
} else {
|
||||
setWindowTitle('Album');
|
||||
setWindowTitle((0, _locale.content)('album.title'));
|
||||
}
|
||||
}, _this.handleContextMenu = function (e) {
|
||||
var _this$props4 = _this.props,
|
||||
album = _this$props4.album,
|
||||
uri = _this$props4.uri,
|
||||
showContextMenu = _this$props4.uiActions.showContextMenu;
|
||||
var _this$props5 = _this.props,
|
||||
album = _this$props5.album,
|
||||
uri = _this$props5.uri,
|
||||
showContextMenu = _this$props5.uiActions.showContextMenu;
|
||||
|
||||
|
||||
showContextMenu({
|
||||
@ -112774,13 +112789,13 @@ var Album = exports.Album = function (_React$Component) {
|
||||
uris: [uri]
|
||||
});
|
||||
}, _this.loadMore = function () {
|
||||
var _this$props5 = _this.props,
|
||||
getMore = _this$props5.spotifyActions.getMore,
|
||||
_this$props5$album = _this$props5.album;
|
||||
_this$props5$album = _this$props5$album === undefined ? {} : _this$props5$album;
|
||||
var uri = _this$props5$album.uri,
|
||||
name = _this$props5$album.name,
|
||||
tracks_more = _this$props5$album.tracks_more;
|
||||
var _this$props6 = _this.props,
|
||||
getMore = _this$props6.spotifyActions.getMore,
|
||||
_this$props6$album = _this$props6.album;
|
||||
_this$props6$album = _this$props6$album === undefined ? {} : _this$props6$album;
|
||||
var uri = _this$props6$album.uri,
|
||||
name = _this$props6$album.name,
|
||||
tracks_more = _this$props6$album.tracks_more;
|
||||
|
||||
|
||||
getMore(tracks_more, {
|
||||
@ -112794,9 +112809,9 @@ var Album = exports.Album = function (_React$Component) {
|
||||
}
|
||||
});
|
||||
}, _this.play = function () {
|
||||
var _this$props6 = _this.props,
|
||||
uri = _this$props6.uri,
|
||||
playURIs = _this$props6.mopidyActions.playURIs;
|
||||
var _this$props7 = _this.props,
|
||||
uri = _this$props7.uri,
|
||||
playURIs = _this$props7.mopidyActions.playURIs;
|
||||
|
||||
playURIs([uri], uri);
|
||||
}, _this.inLibrary = function () {
|
||||
@ -112805,12 +112820,12 @@ var Album = exports.Album = function (_React$Component) {
|
||||
var library = (0, _helpers.uriSource)(uri) + '_library_albums';
|
||||
return _this.props[library] && _this.props[library].indexOf(_this.props.uri) > -1;
|
||||
}, _this.render = function () {
|
||||
var _this$props7 = _this.props,
|
||||
uri = _this$props7.uri,
|
||||
albumProp = _this$props7.album,
|
||||
tracks = _this$props7.tracks,
|
||||
artists = _this$props7.artists,
|
||||
load_queue = _this$props7.load_queue;
|
||||
var _this$props8 = _this.props,
|
||||
uri = _this$props8.uri,
|
||||
albumProp = _this$props8.album,
|
||||
tracks = _this$props8.tracks,
|
||||
artists = _this$props8.artists,
|
||||
load_queue = _this$props8.load_queue;
|
||||
|
||||
|
||||
if (!albumProp) {
|
||||
@ -112823,7 +112838,7 @@ var Album = exports.Album = function (_React$Component) {
|
||||
_react2.default.createElement(
|
||||
'p',
|
||||
null,
|
||||
'Could not find album with URI "' + encodeURIComponent(uri) + '"'
|
||||
(0, _locale.content)('errors.uri_not_found', { uri: encodeURIComponent(uri) })
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -112873,9 +112888,7 @@ var Album = exports.Album = function (_React$Component) {
|
||||
album.tracks ? _react2.default.createElement(
|
||||
'li',
|
||||
null,
|
||||
album.tracks_total || album.tracks.length,
|
||||
' ',
|
||||
'tracks'
|
||||
(0, _locale.content)('specs.tracks', { count: album.tracks_total || album.tracks.length })
|
||||
) : null,
|
||||
!_this.props.slim_mode && album.tracks ? _react2.default.createElement(
|
||||
'li',
|
||||
@ -112885,16 +112898,12 @@ var Album = exports.Album = function (_React$Component) {
|
||||
!_this.props.slim_mode && album.play_count ? _react2.default.createElement(
|
||||
'li',
|
||||
null,
|
||||
_react2.default.createElement(_NiceNumber2.default, { value: album.play_count }),
|
||||
' ',
|
||||
'plays'
|
||||
(0, _locale.content)('specs.plays', { count: (0, _NiceNumber.nice_number)(album.play_count) })
|
||||
) : null,
|
||||
!_this.props.slim_mode && album.listeners ? _react2.default.createElement(
|
||||
'li',
|
||||
null,
|
||||
_react2.default.createElement(_NiceNumber2.default, { value: album.listeners }),
|
||||
' ',
|
||||
'listeners'
|
||||
(0, _locale.content)('specs.plays', { count: (0, _NiceNumber.nice_number)(album.listeners) })
|
||||
) : null
|
||||
)
|
||||
),
|
||||
@ -112903,16 +112912,16 @@ var Album = exports.Album = function (_React$Component) {
|
||||
{ className: 'actions' },
|
||||
_react2.default.createElement(
|
||||
'button',
|
||||
{ className: 'button button--primary', onClick: function onClick(e) {
|
||||
{ type: 'button', className: 'button button--primary', onClick: function onClick(e) {
|
||||
return _this.play();
|
||||
} },
|
||||
'Play'
|
||||
(0, _locale.content)('actions.play')
|
||||
),
|
||||
(0, _helpers.uriSource)(_this.props.uri) == 'spotify' ? _react2.default.createElement(_FollowButton2.default, {
|
||||
className: 'secondary',
|
||||
uri: _this.props.uri,
|
||||
addText: 'Add to library',
|
||||
removeText: 'Remove from library',
|
||||
addText: (0, _locale.content)('actions.add_to_library'),
|
||||
removeText: (0, _locale.content)('actions.remove_from_library'),
|
||||
is_following: _this.inLibrary()
|
||||
}) : null,
|
||||
_react2.default.createElement(_ContextMenuTrigger2.default, { onTrigger: function onTrigger(e) {
|
||||
@ -112941,7 +112950,7 @@ var Album = exports.Album = function (_React$Component) {
|
||||
_react2.default.createElement(
|
||||
'h4',
|
||||
{ className: 'wiki__title' },
|
||||
'About'
|
||||
(0, _locale.content)('album.wiki.title')
|
||||
),
|
||||
_react2.default.createElement(
|
||||
'div',
|
||||
@ -112955,9 +112964,7 @@ var Album = exports.Album = function (_React$Component) {
|
||||
_react2.default.createElement(
|
||||
'div',
|
||||
{ className: 'mid_grey-text' },
|
||||
'Published:',
|
||||
' ',
|
||||
album.wiki_publish_date
|
||||
(0, _locale.content)('album.wiki.published', { date: album.wiki_publish_date })
|
||||
)
|
||||
)
|
||||
) : null
|
||||
@ -115240,7 +115247,7 @@ var Queue = function (_React$Component) {
|
||||
uri_type === 'radio' && _react2.default.createElement(
|
||||
'span',
|
||||
{ className: 'flag flag--blue' },
|
||||
'Radio'
|
||||
(0, _locale.content)('now_playing.current_track.radio')
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -115273,19 +115280,19 @@ var Queue = function (_React$Component) {
|
||||
_Link2.default,
|
||||
{ className: 'button button--no-hover', to: '/queue/radio' },
|
||||
_react2.default.createElement(_Icon2.default, { name: 'radio' }),
|
||||
'Radio'
|
||||
(0, _locale.content)('now_playing.context_actions.radio')
|
||||
),
|
||||
_react2.default.createElement(
|
||||
_Link2.default,
|
||||
{ className: 'button button--no-hover', to: '/queue/history' },
|
||||
_react2.default.createElement(_Icon2.default, { name: 'history' }),
|
||||
'History'
|
||||
(0, _locale.content)('now_playing.context_actions.history')
|
||||
),
|
||||
_react2.default.createElement(
|
||||
_Link2.default,
|
||||
{ className: 'button button--no-hover', to: '/queue/add-uri' },
|
||||
_react2.default.createElement(_Icon2.default, { name: 'playlist_add' }),
|
||||
'Add URI'
|
||||
(0, _locale.content)('now_playing.context_actions.add_uri')
|
||||
)
|
||||
);
|
||||
|
||||
@ -115350,7 +115357,7 @@ var Queue = function (_React$Component) {
|
||||
'a',
|
||||
{ onClick: this.props.mopidyActions.shuffleTracklist },
|
||||
_react2.default.createElement(_Icon2.default, { name: 'shuffle' }),
|
||||
'Shuffle'
|
||||
(0, _locale.content)('now_playing.current_track.shuffle')
|
||||
)
|
||||
),
|
||||
queue_tracks.length > 0 && _react2.default.createElement(
|
||||
@ -115360,7 +115367,7 @@ var Queue = function (_React$Component) {
|
||||
'a',
|
||||
{ onClick: this.props.mopidyActions.clearTracklist },
|
||||
_react2.default.createElement(_Icon2.default, { name: 'delete_sweep' }),
|
||||
'Clear'
|
||||
(0, _locale.content)('now_playing.current_track.clear')
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -100,7 +100,7 @@
|
||||
|
||||
// Release details
|
||||
// These are automatically injected to built HTML
|
||||
var build = "1593916791";
|
||||
var build = "1594021564";
|
||||
var version = "3.50.0";
|
||||
|
||||
// Construct the script tag
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
|
||||
import { memo } from 'react';
|
||||
import { content } from '../locale';
|
||||
|
||||
/**
|
||||
* Format time duration
|
||||
@ -50,21 +51,21 @@ const durationSentence = (milliseconds = null) => {
|
||||
const totalMinutes = Math.floor(milliseconds / (1000 * 60));
|
||||
const totalHours = Math.floor(milliseconds / (1000 * 60 * 60));
|
||||
|
||||
if (totalHours > 1) return `${totalHours}+ hrs`;
|
||||
if (totalMinutes > 1) return `${totalMinutes} mins`;
|
||||
if (totalSeconds) return `${totalSeconds} sec`;
|
||||
return '0 mins';
|
||||
if (totalHours > 1) return `${totalHours}+ ${content('time.hours.short')}`;
|
||||
if (totalMinutes > 1) return `${totalMinutes} ${content('time.minutes.short')}`;
|
||||
if (totalSeconds) return `${totalSeconds} ${content('time.seconds.short')}`;
|
||||
return `0 ${content('time.minutes.short')}`;
|
||||
};
|
||||
|
||||
export default memo((props) => {
|
||||
if (props.data === undefined) {
|
||||
const dater = (type, data) => {
|
||||
if (data === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (props.type) {
|
||||
switch (type) {
|
||||
case 'total-time':
|
||||
var duration = 0;
|
||||
var tracks = props.data;
|
||||
var tracks = data;
|
||||
for (let i = 0; i < tracks.length; i++) {
|
||||
if (tracks[i].duration) {
|
||||
duration += parseInt(tracks[i].duration);
|
||||
@ -73,22 +74,22 @@ export default memo((props) => {
|
||||
return durationSentence(duration);
|
||||
|
||||
case 'length':
|
||||
return durationTime(props.data);
|
||||
return durationTime(data);
|
||||
|
||||
case 'date':
|
||||
|
||||
// A four-character date indicates just a year (rather than a full date)
|
||||
if (props.data.length == 4) {
|
||||
return props.data;
|
||||
if (data.length == 4) {
|
||||
return data;
|
||||
|
||||
// Digest as a date string
|
||||
}
|
||||
var date = new Date(props.data);
|
||||
var date = new Date(data);
|
||||
return `${date.getDate()}/${date.getMonth() + 1}/${date.getFullYear()}`;
|
||||
|
||||
|
||||
case 'ago':
|
||||
var date = new Date(props.data);
|
||||
var date = new Date(data);
|
||||
var diff = new Date() - date;
|
||||
var seconds = Math.floor(diff / 1000);
|
||||
var minutes = Math.floor(diff / (1000 * 60));
|
||||
@ -98,18 +99,27 @@ export default memo((props) => {
|
||||
var years = Math.floor(diff / (1000 * 60 * 60 * 24 * 7 * 52));
|
||||
|
||||
if (seconds < 60) {
|
||||
return `${seconds} second${seconds > 1 ? 's' : ''}`;
|
||||
return `${seconds} ${content(`time.seconds.${seconds > 1 ? 'singular' : 'plural'}`)}`;
|
||||
} if (minutes < 60) {
|
||||
return `${minutes} minute${minutes > 1 ? 's' : ''}`;
|
||||
return `${minutes} ${content(`time.minutes.${minutes > 1 ? 'singular' : 'plural'}`)}`;
|
||||
} if (hours < 24) {
|
||||
return `${hours} hour${hours > 1 ? 's' : ''}`;
|
||||
return `${hours} ${content(`time.hours.${hours > 1 ? 'singular' : 'plural'}`)}`;
|
||||
} if (days < 7) {
|
||||
return `${days} day${days > 1 ? 's' : ''}`;
|
||||
return `${days} ${content(`time.days.${days > 1 ? 'singular' : 'plural'}`)}`;
|
||||
} if (weeks < 54) {
|
||||
return `${weeks} week${weeks > 1 ? 's' : ''}`;
|
||||
return `${weeks} ${content(`time.weeks.${weeks > 1 ? 'singular' : 'plural'}`)}`;
|
||||
}
|
||||
return `${years} year${years > 1 ? 's' : ''}`;
|
||||
return `${years} ${content(`time.years.${years > 1 ? 'singular' : 'plural'}`)}`;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const Dater = memo(({ type, data }) => dater(type, data));
|
||||
|
||||
export {
|
||||
Dater,
|
||||
dater,
|
||||
};
|
||||
|
||||
export default Dater;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
|
||||
import React, { memo } from 'react';
|
||||
|
||||
export default memo((props) => {
|
||||
let formatted = parseInt(props.value);
|
||||
const nice_number = (value) => {
|
||||
let formatted = parseInt(value);
|
||||
|
||||
// > 1 million
|
||||
if (formatted > 1000000) {
|
||||
@ -20,4 +20,13 @@ export default memo((props) => {
|
||||
}
|
||||
|
||||
return formatted;
|
||||
});
|
||||
};
|
||||
|
||||
const NiceNumber = memo(({ value }) => nice_number(value));
|
||||
|
||||
export {
|
||||
NiceNumber,
|
||||
nice_number,
|
||||
};
|
||||
|
||||
export default NiceNumber;
|
||||
|
||||
@ -1,3 +1,41 @@
|
||||
errors:
|
||||
uri_not_found: Could not find anything with URI %{uri}
|
||||
specs:
|
||||
tracks: %{count} tracks
|
||||
followers: %{count} followers
|
||||
listeners: %{count} listeners
|
||||
plays: %{count} plays
|
||||
actions:
|
||||
play: Play
|
||||
pause: Pause
|
||||
stop: Stop
|
||||
add_to_library: Add to library
|
||||
remove_from_library: Remove from library
|
||||
time:
|
||||
seconds:
|
||||
short: secs
|
||||
singular: second
|
||||
plural: seconds
|
||||
minutes:
|
||||
short: mins
|
||||
singular: minute
|
||||
plural: minutes
|
||||
hours:
|
||||
short: hrs
|
||||
singular: hour
|
||||
plural: hours
|
||||
days:
|
||||
short: days
|
||||
singular: day
|
||||
plural: days
|
||||
weeks:
|
||||
short: wks
|
||||
singular: week
|
||||
plural: weeks
|
||||
years:
|
||||
short: yrs
|
||||
singular: year
|
||||
plural: years
|
||||
sidebar:
|
||||
now_playing: Now playing
|
||||
search: Search
|
||||
@ -20,9 +58,16 @@ now_playing:
|
||||
history: History
|
||||
add_uri: Add URI
|
||||
current_track:
|
||||
playing_from: Playling from
|
||||
playing_from: Playing from
|
||||
shuffle: Shuffle
|
||||
clear: Clear
|
||||
radio: Radio
|
||||
album:
|
||||
title: Album
|
||||
title_window: %{name} by %{artist} (album)
|
||||
wiki:
|
||||
title: About
|
||||
published: 'Published: %{date}'
|
||||
search:
|
||||
title: 'Search: %{term}'
|
||||
context_actions:
|
||||
|
||||
@ -8,7 +8,6 @@ const PARAMS_REG_EXP = '%{(.*?)}';
|
||||
const paramsRegExp = new RegExp(PARAMS_REG_EXP, 'g');
|
||||
|
||||
const content = (path, params = {}, transform) => {
|
||||
console.log(window.language);
|
||||
const dictionary = dictionaries[window.language || 'en'] || dictionaries.en;
|
||||
|
||||
let value = get((dictionary), path, '');
|
||||
|
||||
@ -3,18 +3,17 @@ import { connect } from 'react-redux';
|
||||
import { bindActionCreators } from 'redux';
|
||||
|
||||
import ErrorMessage from '../components/ErrorMessage';
|
||||
import Header from '../components/Header';
|
||||
import TrackList from '../components/TrackList';
|
||||
import Thumbnail from '../components/Thumbnail';
|
||||
import Parallax from '../components/Parallax';
|
||||
import LinksSentence from '../components/LinksSentence';
|
||||
import Loader from '../components/Loader';
|
||||
import FollowButton from '../components/Fields/FollowButton';
|
||||
import NiceNumber from '../components/NiceNumber';
|
||||
import NiceNumber, { nice_number } from '../components/NiceNumber';
|
||||
import Dater from '../components/Dater';
|
||||
import LazyLoadListener from '../components/LazyLoadListener';
|
||||
import ContextMenuTrigger from '../components/ContextMenuTrigger';
|
||||
import Icon from '../components/Icon';
|
||||
import { content } from '../locale';
|
||||
import * as coreActions from '../services/core/actions';
|
||||
import * as uiActions from '../services/ui/actions';
|
||||
import * as mopidyActions from '../services/mopidy/actions';
|
||||
@ -100,24 +99,21 @@ export class Album extends React.Component {
|
||||
}
|
||||
|
||||
setWindowTitle = (album = this.props.album) => {
|
||||
const { uiActions: { setWindowTitle } } = this.props;
|
||||
const { uiActions: { setWindowTitle }, artists } = this.props;
|
||||
|
||||
if (album) {
|
||||
let artists = '';
|
||||
let artistNames = [];
|
||||
if (album.artists_uris && artists) {
|
||||
for (let i = 0; i < album.artists_uris.length; i++) {
|
||||
const uri = album.artists_uris[i];
|
||||
if (artists.hasOwnProperty(uri)) {
|
||||
if (artists != '') {
|
||||
artists += ', ';
|
||||
}
|
||||
artists += artists[uri].name;
|
||||
artistNames.push(artists[uri].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
setWindowTitle(`${album.name} by ${artists} (album)`);
|
||||
setWindowTitle(content('album.title_window', { name: album.name, artist: artistNames.join() }));
|
||||
} else {
|
||||
setWindowTitle('Album');
|
||||
setWindowTitle(content('album.title'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +187,7 @@ export class Album extends React.Component {
|
||||
return (
|
||||
<ErrorMessage type="not-found" title="Not found">
|
||||
<p>
|
||||
{`Could not find album with URI "${encodeURIComponent(uri)}"`}
|
||||
{content('errors.uri_not_found', { uri: encodeURIComponent(uri) })}
|
||||
</p>
|
||||
</ErrorMessage>
|
||||
);
|
||||
@ -236,9 +232,10 @@ export class Album extends React.Component {
|
||||
) : null}
|
||||
{album.tracks ? (
|
||||
<li>
|
||||
{album.tracks_total || album.tracks.length}
|
||||
{' '}
|
||||
tracks
|
||||
{content(
|
||||
'specs.tracks',
|
||||
{ count: album.tracks_total || album.tracks.length },
|
||||
)}
|
||||
</li>
|
||||
) : null}
|
||||
{!this.props.slim_mode && album.tracks ? (
|
||||
@ -248,31 +245,33 @@ tracks
|
||||
) : null}
|
||||
{!this.props.slim_mode && album.play_count ? (
|
||||
<li>
|
||||
<NiceNumber value={album.play_count} />
|
||||
{' '}
|
||||
plays
|
||||
{content(
|
||||
'specs.plays',
|
||||
{ count: nice_number(album.play_count) },
|
||||
)}
|
||||
</li>
|
||||
) : null}
|
||||
{!this.props.slim_mode && album.listeners ? (
|
||||
<li>
|
||||
<NiceNumber value={album.listeners} />
|
||||
{' '}
|
||||
listeners
|
||||
{content(
|
||||
'specs.plays',
|
||||
{ count: nice_number(album.listeners) },
|
||||
)}
|
||||
</li>
|
||||
) : null}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div className="actions">
|
||||
<button className="button button--primary" onClick={(e) => this.play()}>
|
||||
Play
|
||||
<button type="button" className="button button--primary" onClick={(e) => this.play()}>
|
||||
{content('actions.play')}
|
||||
</button>
|
||||
{uriSource(this.props.uri) == 'spotify' ? (
|
||||
<FollowButton
|
||||
className="secondary"
|
||||
uri={this.props.uri}
|
||||
addText="Add to library"
|
||||
removeText="Remove from library"
|
||||
addText={content('actions.add_to_library')}
|
||||
removeText={content('actions.remove_from_library')}
|
||||
is_following={this.inLibrary()}
|
||||
/>
|
||||
) : null}
|
||||
@ -294,14 +293,15 @@ listeners
|
||||
|
||||
{album.wiki ? (
|
||||
<section className="wiki">
|
||||
<h4 className="wiki__title">About</h4>
|
||||
<h4 className="wiki__title">{content('album.wiki.title')}</h4>
|
||||
<div className="wiki__text">
|
||||
<p>{album.wiki}</p>
|
||||
<br />
|
||||
<div className="mid_grey-text">
|
||||
Published:
|
||||
{' '}
|
||||
{album.wiki_publish_date}
|
||||
{content(
|
||||
'album.wiki.published',
|
||||
{ date: album.wiki_publish_date },
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@ -201,7 +201,11 @@ class Queue extends React.Component {
|
||||
<div className="current-track__added-from__text">
|
||||
{'Playing from '}
|
||||
<LinksSentence items={items} />
|
||||
{uri_type === 'radio' && <span className="flag flag--blue">Radio</span>}
|
||||
{uri_type === 'radio' && (
|
||||
<span className="flag flag--blue">
|
||||
{content('now_playing.current_track.radio')}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@ -225,16 +229,16 @@ class Queue extends React.Component {
|
||||
{this.props.spotify_enabled && (
|
||||
<Link className="button button--no-hover" to="/queue/radio">
|
||||
<Icon name="radio" />
|
||||
Radio
|
||||
{content('now_playing.context_actions.radio')}
|
||||
</Link>
|
||||
)}
|
||||
<Link className="button button--no-hover" to="/queue/history">
|
||||
<Icon name="history" />
|
||||
History
|
||||
{content('now_playing.context_actions.history')}
|
||||
</Link>
|
||||
<Link className="button button--no-hover" to="/queue/add-uri">
|
||||
<Icon name="playlist_add" />
|
||||
Add URI
|
||||
{content('now_playing.context_actions.add_uri')}
|
||||
</Link>
|
||||
</span>
|
||||
);
|
||||
@ -279,7 +283,7 @@ class Queue extends React.Component {
|
||||
<li>
|
||||
<a onClick={this.props.mopidyActions.shuffleTracklist}>
|
||||
<Icon name="shuffle" />
|
||||
Shuffle
|
||||
{content('now_playing.current_track.shuffle')}
|
||||
</a>
|
||||
</li>
|
||||
)}
|
||||
@ -287,7 +291,7 @@ class Queue extends React.Component {
|
||||
<li>
|
||||
<a onClick={this.props.mopidyActions.clearTracklist}>
|
||||
<Icon name="delete_sweep" />
|
||||
Clear
|
||||
{content('now_playing.current_track.clear')}
|
||||
</a>
|
||||
</li>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user