mirror of
https://github.com/jeffvli/feishin.git
synced 2024-11-20 06:27:09 +01:00
Set row play button to switch to song on queue lists
This commit is contained in:
parent
a00385e78f
commit
a8b3944c66
@ -52,12 +52,17 @@ const ListConverControlsContainer = styled.div`
|
||||
export const ListCoverControls = ({
|
||||
itemData,
|
||||
itemType,
|
||||
context,
|
||||
uniqueId,
|
||||
}: {
|
||||
context: Record<string, any>;
|
||||
itemData: any;
|
||||
itemType: LibraryItem;
|
||||
uniqueId?: string;
|
||||
}) => {
|
||||
const playButtonBehavior = usePlayButtonBehavior();
|
||||
const handlePlayQueueAdd = usePlayQueueAdd();
|
||||
const isQueue = Boolean(context?.isQueue);
|
||||
|
||||
const handlePlay = async (e: MouseEvent<HTMLButtonElement>, playType?: Play) => {
|
||||
e.preventDefault();
|
||||
@ -72,10 +77,18 @@ export const ListCoverControls = ({
|
||||
});
|
||||
};
|
||||
|
||||
const handlePlayFromQueue = () => {
|
||||
context.handleDoubleClick({
|
||||
data: {
|
||||
uniqueId,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<ListConverControlsContainer className="card-controls">
|
||||
<PlayButton onClick={handlePlay}>
|
||||
<PlayButton onClick={isQueue ? handlePlayFromQueue : handlePlay}>
|
||||
<RiPlayFill size={20} />
|
||||
</PlayButton>
|
||||
</ListConverControlsContainer>
|
||||
|
@ -59,7 +59,13 @@ const StyledImage = styled(SimpleImg)`
|
||||
}
|
||||
`;
|
||||
|
||||
export const CombinedTitleCell = ({ value, rowIndex, node, context }: ICellRendererParams) => {
|
||||
export const CombinedTitleCell = ({
|
||||
value,
|
||||
rowIndex,
|
||||
node,
|
||||
context,
|
||||
data,
|
||||
}: ICellRendererParams) => {
|
||||
const artists = useMemo(() => {
|
||||
if (!value) return null;
|
||||
return value.artists?.length ? value.artists : value.albumArtists;
|
||||
@ -114,8 +120,10 @@ export const CombinedTitleCell = ({ value, rowIndex, node, context }: ICellRende
|
||||
</Center>
|
||||
)}
|
||||
<ListCoverControls
|
||||
context={context}
|
||||
itemData={value}
|
||||
itemType={context.itemType}
|
||||
uniqueId={data?.uniqueId}
|
||||
/>
|
||||
</ImageWrapper>
|
||||
<MetadataWrapper>
|
||||
|
@ -256,7 +256,9 @@ export const PlayQueue = forwardRef(({ type }: QueueProps, ref: Ref<any>) => {
|
||||
columnDefs={columnDefs}
|
||||
context={{
|
||||
currentSong,
|
||||
handleDoubleClick,
|
||||
isFocused,
|
||||
isQueue: true,
|
||||
itemType: LibraryItem.SONG,
|
||||
onCellContextMenu,
|
||||
status,
|
||||
|
Loading…
Reference in New Issue
Block a user