-
Notifications
You must be signed in to change notification settings - Fork 144
fix: Critical issues for mobile compatibility #546
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
HoonBaek
merged 29 commits into
develop/Mobile-compatibility
from
fix/UIKIT-3882/Fix-critical-issues-for-Mobile-compatibility
May 23, 2023
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
66a13eb
Change the props name 'breakpoint' and add an expected type
HoonBaek e75b0c0
Use browserSupportMimeType for recording to MediaRecorder
HoonBaek eecfaec
Allow ReactNode to the children props of MenuItems comp
HoonBaek 6ef2855
Accept nullable type of parentRef of EmojiListItem comp
HoonBaek 262494f
Add util func: getEmojiUrl, getting url from emojiContainer
HoonBaek 0d7be6f
Add a menu option to MobileContextMenu: Reply in Thread
HoonBaek 20e33a2
Prevent event of mobile menu in MessageContent comp
HoonBaek 0df5ee6
Add props to UserListItem: avatarSize, to set avatar size
HoonBaek 3ad6bff
Create a component: MobileEmojisBottmSheet
HoonBaek 0260337
Add MobileEmojisBottomSheet to the EmojiReactions comp
HoonBaek cd096b8
fix: useLongPress inside loop
sravan-s e10eb68
fix: stop propogation to useLongPress
sravan-s 6fd5bf3
Not prevent event when selecting menu from Thread comp
HoonBaek b6298aa
Fix lint errors
HoonBaek ba60f93
Gets channel through props in MobileEmojisBottomSheet, instead of con…
HoonBaek 29b85cd
Stop propagation in the ReactionItem
HoonBaek 300a75a
Prevent opening multiple emojis menu in Mobile reactions
HoonBaek 1624bf2
Rename MobileEmojisBottomSheet to ReactedMembersBottomSheet
HoonBaek 4a74183
Rename className text: emoji-list to reacted-members
HoonBaek 091b30a
Activate onClick EmojiReaction in the DesktopLayout
HoonBaek 488c4a8
Add isMobile condition for displaying ReacedMembersBottomSheet
HoonBaek 952c5b4
Create AddReactionBadgeItem and MobileEmojisBottomSheet
HoonBaek 0c3fcdb
Remove unused props
HoonBaek 449c702
Create SpaceFromTriggerType and apply it
HoonBaek 331c485
Prevent non-nullable type to parentRef of EmojiListItems comp
HoonBaek 81d35dd
Improve the readability of util func: getEmojiUrl
HoonBaek 9e54c0f
Not use memo ReactorList inside of the ReactedMembersBottomSheet comp
HoonBaek ee104d2
Not use memo browserSupportMeimeType
HoonBaek 73cc063
Rename setShowEmojisBottomSheet to setSelectedEmojiKey
HoonBaek 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
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
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
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
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
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,42 @@ | ||
| import React, { | ||
| KeyboardEvent, | ||
| MouseEvent, | ||
| TouchEvent, | ||
| } from 'react'; | ||
| import ReactionBadge from '../ReactionBadge'; | ||
| import Icon, { IconColors, IconTypes } from '../Icon'; | ||
| import useLongPress from '../../hooks/useLongPress'; | ||
|
|
||
| export interface AddReactionBadgeItemProps { | ||
| onClick: (e: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void; | ||
| } | ||
|
|
||
| export const AddReactionBadgeItem = ({ | ||
| onClick, | ||
| }: AddReactionBadgeItemProps): React.ReactElement => { | ||
| const onlyClick = useLongPress({ | ||
| onLongPress: () => { /* noop */ }, | ||
| onClick, | ||
| }, { | ||
| shouldPreventDefault: true, | ||
| shouldStopPropagation: true, | ||
| }); | ||
|
|
||
| return ( | ||
| <div | ||
| className="sendbird-emoji-reactions__add-reaction-badge" | ||
| {...onlyClick} | ||
| > | ||
| <ReactionBadge | ||
| isAdd | ||
| > | ||
| <Icon | ||
| type={IconTypes.EMOJI_MORE} | ||
| fillColor={IconColors.ON_BACKGROUND_3} | ||
| width="20px" | ||
| height="20px" | ||
| /> | ||
| </ReactionBadge> | ||
| </div> | ||
| ); | ||
| }; |
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,89 @@ | ||
| import React, { useContext } from 'react'; | ||
|
|
||
| import { FileMessage, Reaction, UserMessage } from '@sendbird/chat/message'; | ||
|
|
||
| import Tooltip from '../Tooltip'; | ||
| import TooltipWrapper from '../TooltipWrapper'; | ||
| import ReactionBadge from '../ReactionBadge'; | ||
| import ImageRenderer from '../ImageRenderer'; | ||
| import Icon, { IconTypes } from '../Icon'; | ||
| import { useMediaQueryContext } from '../../lib/MediaQueryContext'; | ||
| import useLongPress from '../../hooks/useLongPress'; | ||
| import { LocalizationContext } from '../../lib/LocalizationContext'; | ||
| import useSendbirdStateContext from '../../hooks/useSendbirdStateContext'; | ||
| import { getEmojiTooltipString, isReactedBy } from '../../utils'; | ||
| import { useMessageContext } from '../../modules/Message/context/MessageProvider'; | ||
| import { Emoji } from '@sendbird/chat'; | ||
|
|
||
| type Props = { | ||
| reaction: Reaction; | ||
| memberNicknamesMap: Map<string, string>; | ||
| setEmojiKey: React.Dispatch<React.SetStateAction<string>>; | ||
| toggleReaction?: (message: UserMessage | FileMessage, key: string, byMe: boolean) => void; | ||
| emojisMap: Map<string, Emoji>; | ||
| }; | ||
|
|
||
| export default function ReactionItem({ | ||
| reaction, | ||
| memberNicknamesMap, | ||
| setEmojiKey, | ||
| toggleReaction, | ||
| emojisMap, | ||
| }: Props) { | ||
| const store = useSendbirdStateContext(); | ||
| const { isMobile } = useMediaQueryContext(); | ||
| const messageStore = useMessageContext(); | ||
| const message = messageStore?.message as UserMessage; | ||
| const { stringSet } = useContext(LocalizationContext); | ||
|
|
||
| const userId = store.config.userId; | ||
| const reactedByMe = isReactedBy(userId, reaction); | ||
|
|
||
| const handleOnClick = () => { | ||
| setEmojiKey(''); | ||
| toggleReaction?.((message), reaction.key, reactedByMe); | ||
| }; | ||
| const longPress = useLongPress({ | ||
| onLongPress: () => { | ||
| setEmojiKey(reaction.key); | ||
| }, | ||
| onClick: handleOnClick, | ||
| }, { | ||
| shouldPreventDefault: true, | ||
| shouldStopPropagation: true, | ||
| }); | ||
|
|
||
| return ( | ||
| <TooltipWrapper | ||
| className="sendbird-emoji-reactions__reaction-badge" | ||
| hoverTooltip={(reaction.userIds.length > 0) ? ( | ||
| <Tooltip> | ||
| {getEmojiTooltipString(reaction, userId, memberNicknamesMap, stringSet)} | ||
| </Tooltip> | ||
| ) : <></>} | ||
| > | ||
| <div | ||
| {...( | ||
| isMobile | ||
| ? longPress | ||
| : { onClick: handleOnClick } | ||
| )} | ||
| > | ||
| <ReactionBadge | ||
| count={reaction.userIds.length} | ||
| selected={reactedByMe} | ||
| > | ||
| <ImageRenderer | ||
| circle | ||
| url={emojisMap.get(reaction?.key)?.url || ''} | ||
| width="20px" | ||
| height="20px" | ||
| defaultComponent={( | ||
| <Icon width="20px" height="20px" type={IconTypes.QUESTION} /> | ||
| )} | ||
| /> | ||
| </ReactionBadge> | ||
| </div> | ||
| </TooltipWrapper> | ||
| ); | ||
| } |
Oops, something went wrong.
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.