Subdirectories now route to artist/album/playlist if backend type provided
This commit is contained in:
@ -104,8 +104,9 @@ const GridItem = ({
|
||||
|
||||
// Build link
|
||||
let to = '';
|
||||
if (getLink) {
|
||||
to = getLink(item);
|
||||
const getLinkResult = getLink ? getLink(item) : undefined;
|
||||
if (getLinkResult) {
|
||||
to = getLinkResult;
|
||||
} else if (item.link) {
|
||||
to = item.link;
|
||||
} else {
|
||||
|
||||
@ -133,8 +133,9 @@ const ListItem = ({
|
||||
*/
|
||||
const onClick = (e) => {
|
||||
let to = '';
|
||||
if (getLink) {
|
||||
to = getLink(item);
|
||||
const getLinkResult = getLink ? getLink(item) : undefined;
|
||||
if (getLinkResult) {
|
||||
to = getLinkResult;
|
||||
} else if (item.link) {
|
||||
to = item.link;
|
||||
} else {
|
||||
|
||||
@ -1663,6 +1663,13 @@ const MopidyMiddleware = (function () {
|
||||
} else if (item.__model__ === 'Ref' && item.type === 'album') {
|
||||
subdirectories.push(formatAlbum({ ...item, loading: true }));
|
||||
subdirectoryImagesToLoad.push(item.uri);
|
||||
} else if (item.__model__ === 'Ref' && item.type === 'artist') {
|
||||
subdirectories.push(formatArtist({ ...item, loading: true }));
|
||||
subdirectoryImagesToLoad.push(item.uri);
|
||||
} else if (item.__model__ === 'Ref' && item.type === 'playlist') {
|
||||
console.debug('playlist', { item })
|
||||
subdirectories.push(formatPlaylist({ ...item, loading: true }));
|
||||
subdirectoryImagesToLoad.push(item.uri);
|
||||
} else {
|
||||
subdirectories.push(item);
|
||||
}
|
||||
|
||||
@ -57,6 +57,7 @@ class DiscoverCategories extends React.Component {
|
||||
className="grid--tiles"
|
||||
items={categories}
|
||||
getLink={(item) => `/discover/categories/${encodeUri(item.uri)}`}
|
||||
sourceIcon={false}
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@ -31,7 +31,6 @@ class LibraryBrowse extends React.Component {
|
||||
const {
|
||||
loading,
|
||||
directory,
|
||||
mopidyActions,
|
||||
} = this.props;
|
||||
|
||||
if (!directory) {
|
||||
|
||||
@ -37,7 +37,12 @@ const Breadcrumbs = ({ uri }) => {
|
||||
const Subdirectories = ({ items, view }) => {
|
||||
if (!items.length) return null;
|
||||
|
||||
const link = (item) => `/library/browse/${encodeURIComponent(item.name)}/${encodeUri(item.uri)}`;
|
||||
// Only define the link for directories; allows URILink to intelligently route based on type
|
||||
const link = (item) => (
|
||||
item.type === 'directory'
|
||||
? `/library/browse/${encodeURIComponent(item.name)}/${encodeUri(item.uri)}`
|
||||
: null
|
||||
);
|
||||
|
||||
if (view === 'list') {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user