mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 04:50:12 +02:00
a32fed3bcf
* upgrade dependencies * downgrade fast-average-color
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
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: {
|
|
comment: playlist?.description || undefined,
|
|
genres: playlist?.genres,
|
|
name: playlist?.name,
|
|
ownerId: playlist?.ownerId || undefined,
|
|
public: playlist?.public || false,
|
|
queryBuilderRules: playlist?.rules || undefined,
|
|
sync: playlist?.sync || undefined,
|
|
},
|
|
playlistImage: {
|
|
imageId: playlist.imageId,
|
|
imageUrl: playlist.imageUrl,
|
|
uploadedImage: playlist.uploadedImage,
|
|
},
|
|
query: { id: playlist?.id },
|
|
},
|
|
modal: 'updatePlaylist',
|
|
size: hasImageUpload ? 'lg' : 'md',
|
|
title: i18n.t('form.editPlaylist.title', { postProcess: 'titleCase' }) as string,
|
|
});
|
|
};
|