-
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
07e36d5
commit 1c33185
Showing
18 changed files
with
405 additions
and
32 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
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
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
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
26 changes: 26 additions & 0 deletions
26
...-client/packages/web/src/pages/chat-page/components/BlockUserConfirmationModal.module.css
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,26 @@ | ||
.root { | ||
max-width: 488px; | ||
} | ||
|
||
.icon path { | ||
fill: var(--neutral-light-2); | ||
} | ||
|
||
.button { | ||
flex: 1; | ||
} | ||
|
||
.content > div { | ||
line-height: 150%; | ||
font-weight: var(--font-medium); | ||
font-size: var(--font-l); | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--unit-4); | ||
} | ||
|
||
.footer { | ||
display: flex; | ||
gap: var(--unit-4); | ||
padding: 0 var(--unit-6) var(--unit-6) var(--unit-6); | ||
} |
84 changes: 84 additions & 0 deletions
84
.../audius-client/packages/web/src/pages/chat-page/components/BlockUserConfirmationModal.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,84 @@ | ||
import { useCallback } from 'react' | ||
|
||
import { User, chatActions } from '@audius/common' | ||
import { | ||
Button, | ||
ButtonType, | ||
IconBlockMessages, | ||
IconInfo, | ||
Modal, | ||
ModalContent, | ||
ModalFooter, | ||
ModalHeader, | ||
ModalTitle | ||
} from '@audius/stems' | ||
import { useDispatch } from 'react-redux' | ||
|
||
import { HelpCallout } from 'components/help-callout/HelpCallout' | ||
import { UserNameAndBadges } from 'components/user-name-and-badges/UserNameAndBadges' | ||
|
||
import styles from './BlockUserConfirmationModal.module.css' | ||
|
||
const { blockUser } = chatActions | ||
|
||
const messages = { | ||
title: 'Are you sure?', | ||
confirm: 'Block User', | ||
cancel: 'Cancel', | ||
content: (user: User) => ( | ||
<> | ||
Are you sure you want to block <UserNameAndBadges user={user} /> from | ||
sending messages to your inbox? | ||
</> | ||
), | ||
callout: | ||
'This will not affect their ability to view your profile or interact with your content.' | ||
} | ||
|
||
type BlockUserConfirmationModalProps = { | ||
isVisible: boolean | ||
onClose: () => void | ||
user: User | ||
} | ||
|
||
export const BlockUserConfirmationModal = ({ | ||
isVisible, | ||
onClose, | ||
user | ||
}: BlockUserConfirmationModalProps) => { | ||
const dispatch = useDispatch() | ||
const handleConfirmClicked = useCallback(() => { | ||
dispatch(blockUser({ userId: user.user_id })) | ||
onClose() | ||
}, [dispatch, onClose, user]) | ||
|
||
return ( | ||
<Modal bodyClassName={styles.root} isOpen={isVisible} onClose={onClose}> | ||
<ModalHeader> | ||
<ModalTitle | ||
title={messages.title} | ||
icon={<IconBlockMessages />} | ||
iconClassName={styles.icon} | ||
/> | ||
</ModalHeader> | ||
<ModalContent className={styles.content}> | ||
<div>{messages.content(user)}</div> | ||
<HelpCallout icon={<IconInfo />} content={messages.callout} /> | ||
</ModalContent> | ||
<ModalFooter className={styles.footer}> | ||
<Button | ||
className={styles.button} | ||
type={ButtonType.PRIMARY} | ||
text={messages.cancel} | ||
onClick={onClose} | ||
/> | ||
<Button | ||
className={styles.button} | ||
type={ButtonType.DESTRUCTIVE} | ||
text={messages.confirm} | ||
onClick={handleConfirmClicked} | ||
/> | ||
</ModalFooter> | ||
</Modal> | ||
) | ||
} |
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
Oops, something went wrong.