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

2
src/components/library/AlbumView.tsx

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

2
src/components/player/NowPlayingMiniView.tsx

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

2
src/components/player/NowPlayingView.tsx

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

2
src/components/player/PlayerBar.tsx

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

2
src/components/playlist/PlaylistView.tsx

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

2
src/components/starred/StarredView.tsx

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

Loading…
Cancel
Save