mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
![]() |
import type { BaseItemDto } from '@jellyfin/sdk/lib/generated-client';
|
||
|
import React, { FC, useCallback } from 'react';
|
||
|
import { IconButton } from '@mui/material';
|
||
|
import QueueIcon from '@mui/icons-material/Queue';
|
||
|
|
||
|
import { playbackManager } from 'components/playback/playbackmanager';
|
||
|
import globalize from 'scripts/globalize';
|
||
|
|
||
|
interface QueueButtonProps {
|
||
|
item: BaseItemDto | undefined
|
||
|
items: BaseItemDto[];
|
||
|
hasFilters: boolean;
|
||
|
}
|
||
|
|
||
|
const QueueButton: FC<QueueButtonProps> = ({ item, items, hasFilters }) => {
|
||
|
const queue = useCallback(() => {
|
||
|
if (item && !hasFilters) {
|
||
|
playbackManager.queue({
|
||
|
items: [item]
|
||
|
});
|
||
|
} else {
|
||
|
playbackManager.queue({
|
||
|
items: items
|
||
|
});
|
||
|
}
|
||
|
}, [hasFilters, item, items]);
|
||
|
|
||
|
return (
|
||
|
<IconButton
|
||
|
title={globalize.translate('AddToPlayQueue')}
|
||
|
className='paper-icon-button-light btnQueue autoSize'
|
||
|
onClick={queue}
|
||
|
>
|
||
|
<QueueIcon />
|
||
|
</IconButton>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default QueueButton;
|