-
Notifications
You must be signed in to change notification settings - Fork 13.1k
[NEW] Reaction view #18272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[NEW] Reaction view #18272
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
d179552
Add reaction modal
MartinSchoeler 2c95b23
import
MartinSchoeler d3b45fe
Merge branch 'develop' into reaction-view
tassoevan 448f4d3
Update app/ui-utils/client/lib/MessageAction.js
MartinSchoeler a04cd25
Update app/ui-utils/client/lib/MessageAction.js
MartinSchoeler 49a6290
Update app/ui-utils/client/lib/reactionListContent.js
MartinSchoeler 4ff7fc1
Update app/ui-utils/client/lib/reactionListContent.js
MartinSchoeler 4dbef83
fix some reviews
MartinSchoeler b0f2f26
fix more reviews
MartinSchoeler 6bf2f86
remove wrapper and use the component directly
MartinSchoeler 98d9b38
fix lint
MartinSchoeler ea97d07
Update reactionListContent.js
MartinSchoeler 40e5c29
Merge branch 'develop' into reaction-view
tassoevan 4922d96
Update app/ui-utils/client/lib/reactionListContent.js
ggazzo c1b1f08
Update app/ui-utils/client/lib/MessageAction.js
ggazzo fcf78a6
WIP
ggazzo 390324a
Merge branch 'develop' into reaction-view
tassoevan 9ea34cf
Merge branch 'develop' into reaction-view
gabriellsh 3b12d45
Merge branch 'develop' into reaction-view
MartinSchoeler 71f2db0
review
MartinSchoeler 07432b8
fix review and overflows
MartinSchoeler 52dff1b
lint
MartinSchoeler 28af04c
remove line
MartinSchoeler 6a7fb13
fix margin
MartinSchoeler 79c8d49
lint
MartinSchoeler 1de295a
Merge branch 'develop' into reaction-view
gabriellsh 96c13e0
Use real name setting, open user card
gabriellsh 90c0bbd
Fix missing names after new emoji
gabriellsh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,68 @@ | ||
| import React from 'react'; | ||
| import { Box, Tag, Modal, ButtonGroup, Button, Scrollable } from '@rocket.chat/fuselage'; | ||
| import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; | ||
|
|
||
| import { useTranslation } from '../../../../client/contexts/TranslationContext'; | ||
| import { useSetting } from '../../../../client/contexts/SettingsContext'; | ||
| import { useSession } from '../../../../client/contexts/SessionContext'; | ||
| import Emoji from '../../../../client/components/basic/Emoji'; | ||
| import { openUserCard } from '../../../ui/client/lib/UserCard'; | ||
| import { openProfileTabOrOpenDM } from '../../../ui/client/views/app/room'; | ||
|
|
||
| export function Reactions({ reactions, roomInstance, onClose }) { | ||
| const useRealName = useSetting('UI_Use_Real_Name'); | ||
|
|
||
| return <Scrollable> | ||
| <Box> | ||
| {Object.entries(reactions).map(([reaction, { names = [], usernames }]) => <Box key={reaction}> | ||
| <Box display='flex' flexWrap='wrap' overflowX='hidden' mb='x8'> | ||
| <Emoji emojiHandle={reaction} /> | ||
| <Box paddingBlock='x4' mis='x4'> | ||
| {usernames.map((username, i) => <Username | ||
| key={username} | ||
| displayName={useRealName ? names[i] || username : username} | ||
| username={username} | ||
| roomInstance={roomInstance} | ||
| onClose={onClose} | ||
| />)} | ||
| </Box> | ||
| </Box> | ||
| </Box>)} | ||
| </Box> | ||
| </Scrollable>; | ||
| } | ||
|
|
||
| export function Username({ username, displayName, roomInstance, onClose }) { | ||
| const openedRoom = useSession('openedRoom'); | ||
| const handleUserCard = useMutableCallback((e) => openUserCard({ | ||
| username, | ||
| rid: openedRoom, | ||
| target: e.currentTarget, | ||
| open: (e) => { | ||
| e.preventDefault(); | ||
| onClose(); | ||
| openProfileTabOrOpenDM(e, roomInstance, username); | ||
| }, | ||
| })); | ||
|
|
||
| return <Tag onClick={handleUserCard} marginInlineEnd='x4' key={displayName}>{displayName}</Tag>; | ||
| } | ||
|
|
||
| export default function ReactionListContent({ reactions, roomInstance, onClose }) { | ||
| const t = useTranslation(); | ||
|
|
||
| return <> | ||
gabriellsh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <Modal.Header> | ||
| <Modal.Title>{t('Users_reacted')}</Modal.Title> | ||
| <Modal.Close onClick={onClose}/> | ||
| </Modal.Header> | ||
| <Modal.Content fontScale='p1'> | ||
| <Reactions reactions={reactions} roomInstance={roomInstance} onClose={onClose}/> | ||
| </Modal.Content> | ||
| <Modal.Footer> | ||
| <ButtonGroup align='end'> | ||
| <Button primary onClick={onClose}>{t('Ok')}</Button> | ||
| </ButtonGroup> | ||
| </Modal.Footer> | ||
| </>; | ||
| } | ||
This file contains hidden or 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 hidden or 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,10 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { renderEmoji } from '../../../app/emoji/client/index'; | ||
|
|
||
| function Emoji({ emojiHandle }) { | ||
| const markup = { __html: `${ renderEmoji(emojiHandle) }` }; | ||
| return <div dangerouslySetInnerHTML={ markup }></div>; | ||
| } | ||
|
|
||
| export default Emoji; |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.