From 7f409e3fea4ad7a76ad26d761eaa4bce181dc49c Mon Sep 17 00:00:00 2001 From: Kyle Shanks Date: Tue, 2 May 2023 15:02:36 -0400 Subject: [PATCH] [C-2542] Update delete playlist confirmation drawer to conform to new designs (#3303) --- .../mobile/src/assets/images/iconTrash.svg | 4 + .../DeletePlaylistConfirmationDrawer.tsx | 111 +++++++++++++++--- 2 files changed, 98 insertions(+), 17 deletions(-) create mode 100644 apps/audius-client/packages/mobile/src/assets/images/iconTrash.svg diff --git a/apps/audius-client/packages/mobile/src/assets/images/iconTrash.svg b/apps/audius-client/packages/mobile/src/assets/images/iconTrash.svg new file mode 100644 index 00000000000..e65d979a27d --- /dev/null +++ b/apps/audius-client/packages/mobile/src/assets/images/iconTrash.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/audius-client/packages/mobile/src/components/delete-playlist-confirmation-drawer/DeletePlaylistConfirmationDrawer.tsx b/apps/audius-client/packages/mobile/src/components/delete-playlist-confirmation-drawer/DeletePlaylistConfirmationDrawer.tsx index e4300b70775..04916693a1b 100644 --- a/apps/audius-client/packages/mobile/src/components/delete-playlist-confirmation-drawer/DeletePlaylistConfirmationDrawer.tsx +++ b/apps/audius-client/packages/mobile/src/components/delete-playlist-confirmation-drawer/DeletePlaylistConfirmationDrawer.tsx @@ -1,39 +1,116 @@ -import { useCallback, useMemo } from 'react' +import { useCallback } from 'react' import { cacheCollectionsActions, - deletePlaylistConfirmationModalUISelectors + cacheCollectionsSelectors, + deletePlaylistConfirmationModalUISelectors, + fillString } from '@audius/common' +import { View } from 'react-native' import { useDispatch, useSelector } from 'react-redux' -import ActionDrawer from 'app/components/action-drawer' +import IconTrash from 'app/assets/images/iconTrash.svg' +import { Text, Button } from 'app/components/core' import { useNavigation } from 'app/hooks/useNavigation' +import { makeStyles } from 'app/styles' +import { useColor } from 'app/utils/theme' + +import { useDrawerState } from '../drawer' +import Drawer from '../drawer/Drawer' const { getPlaylistId } = deletePlaylistConfirmationModalUISelectors const { deletePlaylist } = cacheCollectionsActions +const { getCollection } = cacheCollectionsSelectors + +const messages = { + drawerTitle: 'Delete Playlist?', + drawerBody: 'Are you sure you want to delete your playlist%0?', + buttonConfirmText: 'Delete', + buttonCancelText: 'Cancel' +} + +const useStyles = makeStyles(({ palette, spacing }) => ({ + title: { + flexDirection: 'row', + justifyContent: 'center', + gap: spacing(2), + alignItems: 'center', + paddingVertical: spacing(6), + borderBottomColor: palette.neutralLight8, + borderBottomWidth: 1 + }, + titleText: { + textTransform: 'uppercase' + }, + container: { + marginHorizontal: spacing(4) + }, + body: { + margin: spacing(4), + lineHeight: spacing(6), + textAlign: 'center' + }, + buttonContainer: { + gap: spacing(2), + marginBottom: spacing(8) + } +})) export const DeletePlaylistConfirmationDrawer = () => { const playlistId = useSelector(getPlaylistId) + const playlist = useSelector((state) => + getCollection(state, { id: playlistId }) + ) + const neutral = useColor('neutral') const dispatch = useDispatch() const navigation = useNavigation() + const styles = useStyles() + const { isOpen, onClose } = useDrawerState('DeletePlaylistConfirmation') const handleDelete = useCallback(() => { if (playlistId) { dispatch(deletePlaylist(playlistId)) navigation.goBack() } - }, [dispatch, playlistId, navigation]) - - const rows = useMemo( - () => [ - { - text: 'Delete', - isDestructive: true, - callback: handleDelete - }, - { text: 'Cancel' } - ], - [handleDelete] - ) + onClose() + }, [dispatch, playlistId, navigation, onClose]) - return + return ( + + + + + + {messages.drawerTitle} + + + + {fillString( + messages.drawerBody, + playlist ? `, ${playlist.playlist_name}` : '' + )} + + +