add playlist image upload to edit playlist modal

This commit is contained in:
jeffvli
2026-04-02 17:41:25 -07:00
parent 92cea5dfda
commit fbf82c1ef0
2 changed files with 286 additions and 72 deletions
@@ -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,
});
};