mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-11 06:42:38 +02:00
add playlist image upload to edit playlist modal
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import { openContextModal } from '@mantine/modals';
|
||||
|
||||
import i18n from '/@/i18n/i18n';
|
||||
import { useAuthStore } from '/@/renderer/store';
|
||||
import { hasFeature } from '/@/shared/api/utils';
|
||||
import { Playlist } from '/@/shared/types/domain-types';
|
||||
import { ServerFeature } from '/@/shared/types/features-types';
|
||||
|
||||
export const openUpdatePlaylistModal = async (args: { playlist: Playlist }) => {
|
||||
const { playlist } = args;
|
||||
|
||||
const server = useAuthStore.getState().currentServer;
|
||||
const hasImageUpload = hasFeature(server, ServerFeature.PLAYLIST_IMAGE_UPLOAD);
|
||||
|
||||
openContextModal({
|
||||
innerProps: {
|
||||
body: {
|
||||
@@ -17,9 +23,15 @@ export const openUpdatePlaylistModal = async (args: { playlist: Playlist }) => {
|
||||
queryBuilderRules: playlist?.rules || undefined,
|
||||
sync: playlist?.sync || undefined,
|
||||
},
|
||||
playlistImage: {
|
||||
imageId: playlist.imageId,
|
||||
imageUrl: playlist.imageUrl,
|
||||
uploadedImage: playlist.uploadedImage,
|
||||
},
|
||||
query: { id: playlist?.id },
|
||||
},
|
||||
modalKey: 'updatePlaylist',
|
||||
size: hasImageUpload ? 'lg' : 'md',
|
||||
title: i18n.t('form.editPlaylist.title', { postProcess: 'titleCase' }) as string,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user