Browse Source

update listType for list view

- make naming consistent for star/unstar
master
jeffvli 3 years ago
parent
commit
f16fdda0d5
  1. 14
      src/api/api.ts
  2. 2
      src/components/library/AlbumView.tsx
  3. 2
      src/components/player/NowPlayingMiniView.tsx
  4. 2
      src/components/player/NowPlayingView.tsx
  5. 2
      src/components/player/PlayerBar.tsx
  6. 2
      src/components/playlist/PlaylistView.tsx
  7. 2
      src/components/starred/StarredView.tsx

14
src/api/api.ts

@ -220,6 +220,7 @@ export const getAlbums = async (options: any, coverArtSize = 150) => {
albumId: entry.id,
image: getCoverArtUrl(entry, coverArtSize),
starred: entry.starred || undefined,
type: 'album',
index,
})),
};
@ -236,6 +237,7 @@ export const getAlbumsDirect = async (options: any, coverArtSize = 150) => {
albumId: entry.id,
image: getCoverArtUrl(entry, coverArtSize),
starred: entry.starred || undefined,
type: 'album',
index,
})
);
@ -267,6 +269,7 @@ export const getAllAlbums = (
albumId: entry.id,
image: getCoverArtUrl(entry, coverArtSize),
starred: entry.starred || undefined,
type: 'album',
index,
}));
}
@ -290,6 +293,7 @@ export const getAlbum = async (id: string, coverArtSize = 150) => {
return {
...data.album,
image: getCoverArtUrl(data.album, coverArtSize),
type: 'album',
song: (data.album.song || []).map((entry: any, index: any) => ({
...entry,
streamUrl: getStreamUrl(entry.id),
@ -328,7 +332,11 @@ export const getArtists = async () => {
);
artists.map((artist: any) =>
artistList.push({ ...artist, image: getCoverArtUrl(artist, 150) })
artistList.push({
...artist,
image: getCoverArtUrl(artist, 150),
type: 'artist',
})
);
return artistList;
@ -384,7 +392,7 @@ export const getScanStatus = async () => {
export const star = async (id: string, type: string) => {
const { data } = await api.get(`/star`, {
params: {
id: type === 'song' ? id : undefined,
id: type === 'music' ? id : undefined,
albumId: type === 'album' ? id : undefined,
artistId: type === 'artist' ? id : undefined,
},
@ -396,7 +404,7 @@ export const star = async (id: string, type: string) => {
export const unstar = async (id: string, type: string) => {
const { data } = await api.get(`/unstar`, {
params: {
id: type === 'song' ? id : undefined,
id: type === 'music' ? id : undefined,
albumId: type === 'album' ? id : undefined,
artistId: type === 'artist' ? id : undefined,
},

2
src/components/library/AlbumView.tsx

@ -213,7 +213,7 @@ const AlbumView = ({ ...rest }: any) => {
cacheType: 'album',
cacheIdProperty: 'albumId',
}}
listType="song"
listType="music"
isModal={rest.isModal}
/>
</GenericPage>

2
src/components/player/NowPlayingMiniView.tsx

@ -233,7 +233,7 @@ const NowPlayingMiniView = () => {
cacheType: 'album',
cacheIdProperty: 'albumId',
}}
listType="mini"
listType="music"
nowPlaying
miniView
dnd

2
src/components/player/NowPlayingView.tsx

@ -228,7 +228,7 @@ const NowPlayingView = () => {
cacheType: 'album',
cacheIdProperty: 'albumId',
}}
listType="song"
listType="music"
nowPlaying
dnd
/>

2
src/components/player/PlayerBar.tsx

@ -302,7 +302,7 @@ const PlayerBar = () => {
if (!playQueue[currentEntryList][playQueue.currentIndex].starred) {
await star(
playQueue[currentEntryList][playQueue.currentIndex].id,
'song'
'music'
);
dispatch(
setStar({

2
src/components/playlist/PlaylistView.tsx

@ -287,7 +287,7 @@ const PlaylistView = ({ ...rest }) => {
cacheType: 'album',
cacheIdProperty: 'albumId',
}}
listType="song"
listType="music"
dnd
isModal={rest.isModal}
/>

2
src/components/starred/StarredView.tsx

@ -140,7 +140,7 @@ const StarredView = () => {
cacheType: 'album',
cacheIdProperty: 'albumId',
}}
listType="song"
listType="music"
virtualized
/>
)}

Loading…
Cancel
Save