mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
Update playqueueadd props
This commit is contained in:
parent
7dd56bfb9b
commit
02caf896ff
24 changed files with 53 additions and 44 deletions
|
|
@ -210,7 +210,7 @@ export const AlbumDetailContent = ({ tableRef }: AlbumDetailContentProps) => {
|
|||
const handlePlay = async (playType?: Play) => {
|
||||
handlePlayQueueAdd?.({
|
||||
byData: detailQuery?.data?.songs,
|
||||
play: playType || playButtonBehavior,
|
||||
playType: playType || playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -218,9 +218,16 @@ export const AlbumDetailContent = ({ tableRef }: AlbumDetailContentProps) => {
|
|||
|
||||
const handleRowDoubleClick = (e: RowDoubleClickedEvent<QueueSong>) => {
|
||||
if (!e.data) return;
|
||||
|
||||
const rowData: QueueSong[] = [];
|
||||
e.api.forEachNode((node) => {
|
||||
if (!node.data) return;
|
||||
rowData.push(node.data);
|
||||
});
|
||||
|
||||
handlePlayQueueAdd?.({
|
||||
byData: [e.data],
|
||||
play: playButtonBehavior,
|
||||
byData: rowData,
|
||||
playType: playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ export const AlbumListHeaderFilters = ({
|
|||
|
||||
const handlePlayQueueAdd = usePlayQueueAdd();
|
||||
|
||||
const handlePlay = async (play: Play) => {
|
||||
const handlePlay = async (playType: Play) => {
|
||||
if (!itemCount || itemCount === 0 || !server) return;
|
||||
|
||||
const query = {
|
||||
|
|
@ -327,7 +327,7 @@ export const AlbumListHeaderFilters = ({
|
|||
id: albumIds,
|
||||
type: LibraryItem.ALBUM,
|
||||
},
|
||||
play,
|
||||
playType,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ export const AlbumListHeader = ({
|
|||
const handlePlayQueueAdd = usePlayQueueAdd();
|
||||
const playButtonBehavior = usePlayButtonBehavior();
|
||||
|
||||
const handlePlay = async (play: Play) => {
|
||||
const handlePlay = async (playType: Play) => {
|
||||
if (!itemCount || itemCount === 0) return;
|
||||
|
||||
const query = {
|
||||
|
|
@ -198,7 +198,7 @@ export const AlbumListHeader = ({
|
|||
id: albumIds,
|
||||
type: LibraryItem.ALBUM,
|
||||
},
|
||||
play,
|
||||
playType,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ const AlbumDetailRoute = () => {
|
|||
id: [albumId],
|
||||
type: LibraryItem.ALBUM,
|
||||
},
|
||||
play: playButtonBehavior,
|
||||
playType: playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ export const AlbumArtistDetailContent = () => {
|
|||
id: [albumArtistId],
|
||||
type: LibraryItem.ALBUM_ARTIST,
|
||||
},
|
||||
play: playType || playButtonBehavior,
|
||||
playType: playType || playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -259,7 +259,7 @@ export const AlbumArtistDetailContent = () => {
|
|||
if (!e.data) return;
|
||||
handlePlayQueueAdd?.({
|
||||
byData: [e.data],
|
||||
play: playButtonBehavior,
|
||||
playType: playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export const AlbumArtistDetailTopSongsListContent = ({
|
|||
if (!e.data) return;
|
||||
handlePlayQueueAdd?.({
|
||||
byData: [e.data],
|
||||
play: playButtonBehavior,
|
||||
playType: playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ export const AlbumArtistDetailTopSongsListHeader = ({
|
|||
const handlePlayQueueAdd = usePlayQueueAdd();
|
||||
const playButtonBehavior = usePlayButtonBehavior();
|
||||
|
||||
const handlePlay = async (play: Play) => {
|
||||
const handlePlay = async (playType: Play) => {
|
||||
handlePlayQueueAdd?.({
|
||||
byData: data,
|
||||
play,
|
||||
playType,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const AlbumArtistDetailRoute = () => {
|
|||
id: [albumArtistId],
|
||||
type: LibraryItem.ALBUM_ARTIST,
|
||||
},
|
||||
play: playButtonBehavior,
|
||||
playType: playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -153,34 +153,34 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
|
|||
});
|
||||
|
||||
const handlePlay = useCallback(
|
||||
(play: Play) => {
|
||||
(playType: Play) => {
|
||||
switch (ctx.type) {
|
||||
case LibraryItem.ALBUM:
|
||||
handlePlayQueueAdd?.({
|
||||
byItemType: { id: ctx.data.map((item) => item.id), type: ctx.type },
|
||||
play,
|
||||
playType,
|
||||
});
|
||||
break;
|
||||
case LibraryItem.ARTIST:
|
||||
handlePlayQueueAdd?.({
|
||||
byItemType: { id: ctx.data.map((item) => item.id), type: ctx.type },
|
||||
play,
|
||||
playType,
|
||||
});
|
||||
break;
|
||||
case LibraryItem.ALBUM_ARTIST:
|
||||
handlePlayQueueAdd?.({
|
||||
byItemType: { id: ctx.data.map((item) => item.id), type: ctx.type },
|
||||
play,
|
||||
playType,
|
||||
});
|
||||
break;
|
||||
case LibraryItem.SONG:
|
||||
handlePlayQueueAdd?.({ byData: ctx.data, play });
|
||||
handlePlayQueueAdd?.({ byData: ctx.data, playType });
|
||||
break;
|
||||
case LibraryItem.PLAYLIST:
|
||||
for (const item of ctx.data) {
|
||||
handlePlayQueueAdd?.({
|
||||
byItemType: { id: [item.id], type: ctx.type },
|
||||
play,
|
||||
playType,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ export const PlaylistDetailContent = ({ tableRef }: PlaylistDetailContentProps)
|
|||
id: [playlistId],
|
||||
type: LibraryItem.PLAYLIST,
|
||||
},
|
||||
play: playType || playButtonBehavior,
|
||||
playType: playType || playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ export const PlaylistDetailContent = ({ tableRef }: PlaylistDetailContentProps)
|
|||
if (!e.data) return;
|
||||
handlePlayQueueAdd?.({
|
||||
byData: [e.data],
|
||||
play: playButtonBehavior,
|
||||
playType: playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ export const PlaylistDetailSongListContent = ({ tableRef }: PlaylistDetailConten
|
|||
if (!e.data) return;
|
||||
handlePlayQueueAdd?.({
|
||||
byData: [e.data],
|
||||
play: playButtonBehavior,
|
||||
playType: playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ export const PlaylistDetailSongListHeaderFilters = ({
|
|||
const handlePlay = async (playType: Play) => {
|
||||
handlePlayQueueAdd?.({
|
||||
byItemType: { id: [playlistId], type: LibraryItem.PLAYLIST },
|
||||
play: playType,
|
||||
playType,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export const PlaylistDetailSongListHeader = ({
|
|||
const handlePlay = async (playType: Play) => {
|
||||
handlePlayQueueAdd?.({
|
||||
byItemType: { id: [playlistId], type: LibraryItem.PLAYLIST },
|
||||
play: playType,
|
||||
playType,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ const PlaylistDetailRoute = () => {
|
|||
id: [playlistId],
|
||||
type: LibraryItem.PLAYLIST,
|
||||
},
|
||||
play: playButtonBehavior,
|
||||
playType: playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -89,14 +89,14 @@ export const LibraryCommandItem = ({
|
|||
}
|
||||
|
||||
const handlePlay = useCallback(
|
||||
(e: MouseEvent, id: string, play: Play) => {
|
||||
(e: MouseEvent, id: string, playType: Play) => {
|
||||
e.stopPropagation();
|
||||
handlePlayQueueAdd?.({
|
||||
byItemType: {
|
||||
id,
|
||||
type: itemType,
|
||||
},
|
||||
play,
|
||||
playType,
|
||||
});
|
||||
},
|
||||
[handlePlayQueueAdd, itemType],
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ export const SearchContent = ({ tableRef, getDatasource }: SearchContentProps) =
|
|||
case LibraryItem.SONG:
|
||||
handlePlayQueueAdd?.({
|
||||
byData: [e.data],
|
||||
play: playButtonBehavior,
|
||||
playType: playButtonBehavior,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,13 +119,13 @@ export const SidebarPlaylistList = ({ data }: SidebarPlaylistListProps) => {
|
|||
const [debounced] = useDebouncedValue(rect, 25);
|
||||
|
||||
const handlePlayPlaylist = useCallback(
|
||||
(id: string, play: Play) => {
|
||||
(id: string, playType: Play) => {
|
||||
handlePlayQueueAdd?.({
|
||||
byItemType: {
|
||||
id: [id],
|
||||
type: LibraryItem.PLAYLIST,
|
||||
},
|
||||
play,
|
||||
playType,
|
||||
});
|
||||
},
|
||||
[handlePlayQueueAdd],
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ export const SongListContent = ({ itemCount, tableRef }: SongListContentProps) =
|
|||
if (!e.data) return;
|
||||
handlePlayQueueAdd?.({
|
||||
byData: [e.data],
|
||||
play: playButtonBehavior,
|
||||
playType: playButtonBehavior,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ export const SongListHeaderFilters = ({
|
|||
handleFilterChange(filter);
|
||||
};
|
||||
|
||||
const handlePlay = async (play: Play) => {
|
||||
const handlePlay = async (playType: Play) => {
|
||||
if (!itemCount || itemCount === 0) return;
|
||||
const query: SongListQuery = { startIndex: 0, ...filter, ...customFilters };
|
||||
|
||||
|
|
@ -270,7 +270,7 @@ export const SongListHeaderFilters = ({
|
|||
id: query,
|
||||
type: LibraryItem.SONG,
|
||||
},
|
||||
play,
|
||||
playType,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ export const SongListHeader = ({
|
|||
|
||||
const playButtonBehavior = usePlayButtonBehavior();
|
||||
|
||||
const handlePlay = async (play: Play) => {
|
||||
const handlePlay = async (playType: Play) => {
|
||||
if (!itemCount || itemCount === 0) return;
|
||||
const query: SongListQuery = { startIndex: 0, ...filter, ...customFilters };
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ export const SongListHeader = ({
|
|||
id: query,
|
||||
type: LibraryItem.SONG,
|
||||
},
|
||||
play,
|
||||
playType,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue