49b0ba3071
Co-authored-by: dmitrylyzo <56478732+dmitrylyzo@users.noreply.github.com>
30 lines
791 B
TypeScript
30 lines
791 B
TypeScript
import React, { FC, useCallback } from 'react';
|
|
import { IconButton } from '@mui/material';
|
|
import ShuffleIcon from '@mui/icons-material/Shuffle';
|
|
|
|
import { playbackManager } from 'components/playback/playbackmanager';
|
|
import globalize from 'lib/globalize';
|
|
import type { ItemDto } from 'types/base/models/item-dto';
|
|
|
|
interface ShuffleButtonProps {
|
|
item: ItemDto;
|
|
}
|
|
|
|
const ShuffleButton: FC<ShuffleButtonProps> = ({ item }) => {
|
|
const shuffle = useCallback(() => {
|
|
playbackManager.shuffle(item);
|
|
}, [item]);
|
|
|
|
return (
|
|
<IconButton
|
|
title={globalize.translate('Shuffle')}
|
|
className='button-flat btnShuffle'
|
|
onClick={shuffle}
|
|
>
|
|
<ShuffleIcon />
|
|
</IconButton>
|
|
);
|
|
};
|
|
|
|
export default ShuffleButton;
|