mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-09 12:09:57 +02:00
restrict playlist actions by permission
This commit is contained in:
@@ -13,10 +13,11 @@ import { toast } from '/@/shared/components/toast/toast';
|
||||
import { Playlist } from '/@/shared/types/domain-types';
|
||||
|
||||
interface DeletePlaylistActionProps {
|
||||
disabled?: boolean;
|
||||
items: Playlist[];
|
||||
}
|
||||
|
||||
export const DeletePlaylistAction = ({ items }: DeletePlaylistActionProps) => {
|
||||
export const DeletePlaylistAction = ({ disabled, items }: DeletePlaylistActionProps) => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const serverId = useCurrentServerId();
|
||||
@@ -65,7 +66,7 @@ export const DeletePlaylistAction = ({ items }: DeletePlaylistActionProps) => {
|
||||
if (items.length === 0) return null;
|
||||
|
||||
return (
|
||||
<ContextMenu.Item leftIcon="remove" onSelect={openDeletePlaylistModal}>
|
||||
<ContextMenu.Item disabled={disabled} leftIcon="remove" onSelect={openDeletePlaylistModal}>
|
||||
{t('action.deletePlaylist', { postProcess: 'sentenceCase' })}
|
||||
</ContextMenu.Item>
|
||||
);
|
||||
|
||||
@@ -11,10 +11,11 @@ import { toast } from '/@/shared/components/toast/toast';
|
||||
import { Playlist } from '/@/shared/types/domain-types';
|
||||
|
||||
interface EditPlaylistActionProps {
|
||||
disabled?: boolean;
|
||||
items: Playlist[];
|
||||
}
|
||||
|
||||
export const EditPlaylistAction = ({ items }: EditPlaylistActionProps) => {
|
||||
export const EditPlaylistAction = ({ disabled, items }: EditPlaylistActionProps) => {
|
||||
const { t } = useTranslation();
|
||||
const server = useCurrentServer();
|
||||
|
||||
@@ -52,7 +53,7 @@ export const EditPlaylistAction = ({ items }: EditPlaylistActionProps) => {
|
||||
if (items.length === 0 || items.length > 1) return null;
|
||||
|
||||
return (
|
||||
<ContextMenu.Item leftIcon="edit" onSelect={handleEditPlaylist}>
|
||||
<ContextMenu.Item disabled={disabled} leftIcon="edit" onSelect={handleEditPlaylist}>
|
||||
{t('action.editPlaylist', { postProcess: 'sentenceCase' })}
|
||||
</ContextMenu.Item>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user