1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #6184 from thornbill/playlist-editor

Add playlist editing
This commit is contained in:
Bill Thornton 2024-10-13 16:50:49 -04:00 committed by GitHub
commit 9c405e9360
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 179 additions and 29 deletions

View file

@ -1,4 +1,4 @@
import React, { FC, useCallback, useMemo } from 'react';
import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { IconButton } from '@mui/material';
import MoreVertIcon from '@mui/icons-material/MoreVert';
import { useQueryClient } from '@tanstack/react-query';
@ -113,6 +113,7 @@ const MoreCommandsButton: FC<MoreCommandsButtonProps> = ({
itemId: selectedItemId || itemId || ''
});
const parentId = item?.SeasonId || item?.SeriesId || item?.ParentId;
const [ hasCommands, setHasCommands ] = useState(false);
const playlistItem = useMemo(() => {
let PlaylistItemId: string | null = null;
@ -198,10 +199,15 @@ const MoreCommandsButton: FC<MoreCommandsButtonProps> = ({
[defaultMenuOptions, item, itemId, items, parentId, queryClient, queryKey]
);
if (
item
&& itemContextMenu.getCommands(defaultMenuOptions).length
) {
useEffect(() => {
const getCommands = async () => {
const commands = await itemContextMenu.getCommands(defaultMenuOptions);
setHasCommands(commands.length > 0);
};
void getCommands();
}, [ defaultMenuOptions ]);
if (item && hasCommands) {
return (
<IconButton
className='button-flat btnMoreCommands'