Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/smart-components/App/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function App(props) {
isReactionEnabled={isReactionEnabled}
isMentionEnabled={isMentionEnabled}
onUserProfileMessage={(channel) => {
currentChannel(channel);
setCurrentChannel(channel);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

}}
isTypingIndicatorEnabledOnChannelList={isTypingIndicatorEnabledOnChannelList}
isMessageReceiptStatusEnabledOnChannelList={isMessageReceiptStatusEnabledOnChannelList}
Expand Down
25 changes: 9 additions & 16 deletions src/ui/UserProfile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import type { GroupChannel, GroupChannelCreateParams } from '@sendbird/chat/grou
import type { User } from '@sendbird/chat';

import { LocalizationContext } from '../../lib/LocalizationContext';
import withSendbirdContext from '../../lib/SendbirdSdkContext';
import { UserProfileContext } from '../../lib/UserProfileContext';
import { getSdk, getCreateGroupChannel } from '../../lib/selectors';
import { getCreateGroupChannel } from '../../lib/selectors';
import Avatar from '../Avatar/index';
import Label, { LabelColors, LabelTypography } from '../Label';
import Button, { ButtonTypes } from '../Button';
import useSendbirdStateContext from '../../hooks/useSendbirdStateContext';

interface Logger {
info?(message: string, channel: GroupChannel): void;
Expand All @@ -27,12 +27,14 @@ interface Props {
function UserProfile({
user,
currentUserId,
logger,
disableMessaging = false,
createChannel,
onSuccess,
}: Props): ReactElement {
const store = useSendbirdStateContext();
const createChannel = getCreateGroupChannel(store);
const logger = store?.config?.logger;
const { stringSet } = useContext(LocalizationContext);
const currentUserId_ = currentUserId || store?.config?.userId;
// @ts-ignore
const { onUserProfileMessage } = useContext(UserProfileContext);
return (
Expand All @@ -53,7 +55,7 @@ function UserProfile({
</Label>
</section>
{
(user?.userId !== currentUserId) && !disableMessaging && (
(user?.userId !== currentUserId_) && !disableMessaging && (
<section className="sendbird__user-profile-message">
<Button
type={ButtonTypes.SECONDARY}
Expand All @@ -62,7 +64,7 @@ function UserProfile({
const params: GroupChannelCreateParams = {
isDistinct: false,
invitedUserIds: [user?.userId],
operatorUserIds: [currentUserId],
operatorUserIds: [currentUserId_],
};
onSuccess();
createChannel(params)
Expand Down Expand Up @@ -100,13 +102,4 @@ function UserProfile({
);
}

const mapStoreToProps = (store) => ({
sdk: getSdk(store),
createChannel: getCreateGroupChannel(store),
logger: store.config.logger,
pubsub: store.config.pubSub,
});

const ConnectedUserProfile = withSendbirdContext(UserProfile, mapStoreToProps);

export default ConnectedUserProfile;
export default UserProfile;