-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
4d18c99
commit 3676ee6
Showing
10 changed files
with
177 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
apps/audius-client/packages/mobile/src/components/block-messages-drawer/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { BlockMessagesDrawer } from './BlockMessagesDrawer' |
1 change: 0 additions & 1 deletion
1
apps/audius-client/packages/mobile/src/components/block-messages/index.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
apps/audius-client/packages/mobile/src/components/delete-chat-drawer/DeleteChatDrawer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import { useCallback } from 'react' | ||
|
||
import { chatActions } from '@audius/common' | ||
import { View } from 'react-native' | ||
import { useDispatch, useSelector } from 'react-redux' | ||
|
||
import IconTrash from 'app/assets/images/iconTrash.svg' | ||
import { Text, Button } from 'app/components/core' | ||
import { NativeDrawer } from 'app/components/drawer' | ||
import type { AppState } from 'app/store' | ||
import { getData } from 'app/store/drawers/selectors' | ||
import { setVisibility } from 'app/store/drawers/slice' | ||
import { makeStyles, flexRowCentered } from 'app/styles' | ||
import { useColor } from 'app/utils/theme' | ||
|
||
const { deleteChat } = chatActions | ||
|
||
const DELETE_CHAT_MODAL_NAME = 'DeleteChat' | ||
|
||
const messages = { | ||
title: 'Delete Thread', | ||
description: | ||
'Are you sure you want to delete this thread? \n\nOther people in the conversation will still be able to see it. This can’t be undone.', | ||
deleteMessages: 'Are you sure you want to delete this chat?', | ||
deleteButton: 'Delete Thread', | ||
cancel: 'Cancel' | ||
} | ||
|
||
const useStyles = makeStyles(({ spacing, typography, palette }) => ({ | ||
drawer: { | ||
marginVertical: spacing(3), | ||
padding: spacing(3.5), | ||
gap: spacing(4) | ||
}, | ||
titleContainer: { | ||
...flexRowCentered(), | ||
gap: spacing(3.5), | ||
marginBottom: spacing(2), | ||
alignSelf: 'center' | ||
}, | ||
title: { | ||
fontSize: typography.fontSize.xl, | ||
fontFamily: typography.fontByWeight.heavy, | ||
color: palette.neutralLight2, | ||
textTransform: 'uppercase', | ||
lineHeight: typography.fontSize.xl * 1.3 | ||
}, | ||
confirm: { | ||
fontSize: typography.fontSize.large, | ||
lineHeight: typography.fontSize.large * 1.3, | ||
color: palette.neutral | ||
}, | ||
button: { | ||
padding: spacing(4), | ||
height: spacing(12) | ||
}, | ||
blockButton: { | ||
borderColor: palette.accentRed | ||
}, | ||
blockText: { | ||
fontSize: typography.fontSize.large | ||
} | ||
})) | ||
|
||
export const DeleteChatDrawer = () => { | ||
const styles = useStyles() | ||
const neutralLight2 = useColor('neutralLight2') | ||
const dispatch = useDispatch() | ||
const { chatId } = useSelector((state: AppState) => | ||
getData<'DeleteChat'>(state) | ||
) | ||
|
||
const closeDrawer = useCallback(() => { | ||
dispatch( | ||
setVisibility({ | ||
drawer: 'DeleteChat', | ||
visible: false | ||
}) | ||
) | ||
}, [dispatch]) | ||
|
||
const handleConfirmPress = useCallback(() => { | ||
if (chatId) { | ||
dispatch(deleteChat({ chatId })) | ||
} | ||
closeDrawer() | ||
}, [chatId, closeDrawer, dispatch]) | ||
|
||
return ( | ||
<NativeDrawer drawerName={DELETE_CHAT_MODAL_NAME}> | ||
<View style={styles.drawer}> | ||
<View style={styles.titleContainer}> | ||
<IconTrash fill={neutralLight2} /> | ||
<Text style={styles.title}>{messages.title}</Text> | ||
</View> | ||
<Text style={styles.confirm}>{messages.description}</Text> | ||
<Button | ||
title={messages.deleteButton} | ||
onPress={handleConfirmPress} | ||
variant={'destructive'} | ||
styles={{ | ||
root: styles.button, | ||
text: styles.blockText | ||
}} | ||
fullWidth | ||
/> | ||
<Button | ||
title={messages.cancel} | ||
onPress={closeDrawer} | ||
variant={'common'} | ||
styles={{ | ||
root: styles.button, | ||
text: styles.blockText | ||
}} | ||
fullWidth | ||
/> | ||
</View> | ||
</NativeDrawer> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
apps/audius-client/packages/mobile/src/components/delete-chat-drawer/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './DeleteChatDrawer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters