Emoji Status: Open sticker set when clicked in channels (#4141)
This commit is contained in:
parent
7ab7609804
commit
abf718c3f8
@ -59,6 +59,7 @@ type OwnProps = {
|
|||||||
withStory?: boolean;
|
withStory?: boolean;
|
||||||
storyViewerOrigin?: StoryViewerOrigin;
|
storyViewerOrigin?: StoryViewerOrigin;
|
||||||
onClick?: VoidFunction;
|
onClick?: VoidFunction;
|
||||||
|
onEmojiStatusClick?: NoneToVoidFunction;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StateProps =
|
type StateProps =
|
||||||
@ -97,6 +98,7 @@ const GroupChatInfo: FC<OwnProps & StateProps> = ({
|
|||||||
noEmojiStatus,
|
noEmojiStatus,
|
||||||
emojiStatusSize,
|
emojiStatusSize,
|
||||||
onClick,
|
onClick,
|
||||||
|
onEmojiStatusClick,
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
loadFullChat,
|
loadFullChat,
|
||||||
@ -217,7 +219,14 @@ const GroupChatInfo: FC<OwnProps & StateProps> = ({
|
|||||||
<div className="info">
|
<div className="info">
|
||||||
{topic
|
{topic
|
||||||
? <h3 dir="auto" className="fullName">{renderText(topic.title)}</h3>
|
? <h3 dir="auto" className="fullName">{renderText(topic.title)}</h3>
|
||||||
: <FullNameTitle peer={chat} emojiStatusSize={emojiStatusSize} withEmojiStatus={!noEmojiStatus} />}
|
: (
|
||||||
|
<FullNameTitle
|
||||||
|
peer={chat}
|
||||||
|
emojiStatusSize={emojiStatusSize}
|
||||||
|
withEmojiStatus={!noEmojiStatus}
|
||||||
|
onEmojiStatusClick={onEmojiStatusClick}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{!noStatusOrTyping && renderStatusOrTyping()}
|
{!noStatusOrTyping && renderStatusOrTyping()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import React, { memo, useEffect, useState } from '../../lib/teact/teact';
|
|||||||
import { getActions, withGlobal } from '../../global';
|
import { getActions, withGlobal } from '../../global';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ApiChat, ApiPhoto, ApiTopic, ApiUser, ApiUserStatus,
|
ApiChat, ApiPhoto, ApiSticker, ApiTopic, ApiUser, ApiUserStatus,
|
||||||
} from '../../api/types';
|
} from '../../api/types';
|
||||||
import type { GlobalState } from '../../global/types';
|
import type { GlobalState } from '../../global/types';
|
||||||
import { MediaViewerOrigin } from '../../types';
|
import { MediaViewerOrigin } from '../../types';
|
||||||
@ -62,6 +62,7 @@ type StateProps =
|
|||||||
userProfilePhoto?: ApiPhoto;
|
userProfilePhoto?: ApiPhoto;
|
||||||
userFallbackPhoto?: ApiPhoto;
|
userFallbackPhoto?: ApiPhoto;
|
||||||
chatProfilePhoto?: ApiPhoto;
|
chatProfilePhoto?: ApiPhoto;
|
||||||
|
emojiStatusSticker?: ApiSticker;
|
||||||
}
|
}
|
||||||
& Pick<GlobalState, 'connectionState'>;
|
& Pick<GlobalState, 'connectionState'>;
|
||||||
|
|
||||||
@ -84,11 +85,13 @@ const ProfileInfo: FC<OwnProps & StateProps> = ({
|
|||||||
userProfilePhoto,
|
userProfilePhoto,
|
||||||
userFallbackPhoto,
|
userFallbackPhoto,
|
||||||
chatProfilePhoto,
|
chatProfilePhoto,
|
||||||
|
emojiStatusSticker,
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
loadFullUser,
|
loadFullUser,
|
||||||
openMediaViewer,
|
openMediaViewer,
|
||||||
openPremiumModal,
|
openPremiumModal,
|
||||||
|
openStickerSet,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
@ -146,7 +149,12 @@ const ProfileInfo: FC<OwnProps & StateProps> = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleStatusClick = useLastCallback(() => {
|
const handleStatusClick = useLastCallback(() => {
|
||||||
if (!userId) return;
|
if (!userId) {
|
||||||
|
openStickerSet({
|
||||||
|
stickerSetInfo: emojiStatusSticker!.stickerSetInfo,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
openPremiumModal({ fromUserId: userId });
|
openPremiumModal({ fromUserId: userId });
|
||||||
});
|
});
|
||||||
@ -367,6 +375,9 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
const userFullInfo = isPrivate ? selectUserFullInfo(global, userId) : undefined;
|
const userFullInfo = isPrivate ? selectUserFullInfo(global, userId) : undefined;
|
||||||
const chatFullInfo = !isPrivate ? selectChatFullInfo(global, userId) : undefined;
|
const chatFullInfo = !isPrivate ? selectChatFullInfo(global, userId) : undefined;
|
||||||
|
|
||||||
|
const emojiStatus = (user || chat)?.emojiStatus;
|
||||||
|
const emojiStatusSticker = emojiStatus ? global.customEmojis.byId[emojiStatus.documentId] : undefined;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
connectionState,
|
connectionState,
|
||||||
user,
|
user,
|
||||||
@ -379,6 +390,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
isSavedMessages,
|
isSavedMessages,
|
||||||
mediaId,
|
mediaId,
|
||||||
avatarOwnerId,
|
avatarOwnerId,
|
||||||
|
emojiStatusSticker,
|
||||||
...(topic && {
|
...(topic && {
|
||||||
topic,
|
topic,
|
||||||
messagesCount: selectThreadMessagesCount(global, userId, currentTopicId!),
|
messagesCount: selectThreadMessagesCount(global, userId, currentTopicId!),
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import React, {
|
|||||||
import { getActions, withGlobal } from '../../global';
|
import { getActions, withGlobal } from '../../global';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ApiChat, ApiMessage, ApiPeer, ApiTypingStatus,
|
ApiChat, ApiMessage, ApiPeer, ApiSticker, ApiTypingStatus,
|
||||||
} from '../../api/types';
|
} from '../../api/types';
|
||||||
import type { GlobalState, MessageListType } from '../../global/types';
|
import type { GlobalState, MessageListType } from '../../global/types';
|
||||||
import type { Signal } from '../../util/signals';
|
import type { Signal } from '../../util/signals';
|
||||||
@ -113,6 +113,7 @@ type StateProps = {
|
|||||||
isSyncing?: boolean;
|
isSyncing?: boolean;
|
||||||
isSynced?: boolean;
|
isSynced?: boolean;
|
||||||
isFetchingDifference?: boolean;
|
isFetchingDifference?: boolean;
|
||||||
|
emojiStatusSticker?: ApiSticker;
|
||||||
};
|
};
|
||||||
|
|
||||||
const MiddleHeader: FC<OwnProps & StateProps> = ({
|
const MiddleHeader: FC<OwnProps & StateProps> = ({
|
||||||
@ -143,6 +144,7 @@ const MiddleHeader: FC<OwnProps & StateProps> = ({
|
|||||||
isFetchingDifference,
|
isFetchingDifference,
|
||||||
getCurrentPinnedIndexes,
|
getCurrentPinnedIndexes,
|
||||||
getLoadingPinnedId,
|
getLoadingPinnedId,
|
||||||
|
emojiStatusSticker,
|
||||||
onFocusPinnedMessage,
|
onFocusPinnedMessage,
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
@ -156,6 +158,7 @@ const MiddleHeader: FC<OwnProps & StateProps> = ({
|
|||||||
exitMessageSelectMode,
|
exitMessageSelectMode,
|
||||||
openPremiumModal,
|
openPremiumModal,
|
||||||
openThread,
|
openThread,
|
||||||
|
openStickerSet,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
|
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
@ -226,10 +229,16 @@ const MiddleHeader: FC<OwnProps & StateProps> = ({
|
|||||||
}, BACK_BUTTON_INACTIVE_TIME);
|
}, BACK_BUTTON_INACTIVE_TIME);
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleStatusClick = useLastCallback(() => {
|
const handleUserStatusClick = useLastCallback(() => {
|
||||||
openPremiumModal({ fromUserId: chatId });
|
openPremiumModal({ fromUserId: chatId });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handleChannelStatusClick = useLastCallback(() => {
|
||||||
|
openStickerSet({
|
||||||
|
stickerSetInfo: emojiStatusSticker!.stickerSetInfo,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const handleBackClick = useLastCallback((e: React.MouseEvent<HTMLElement, MouseEvent>) => {
|
const handleBackClick = useLastCallback((e: React.MouseEvent<HTMLElement, MouseEvent>) => {
|
||||||
if (!isBackButtonActive.current) return;
|
if (!isBackButtonActive.current) return;
|
||||||
|
|
||||||
@ -390,7 +399,7 @@ const MiddleHeader: FC<OwnProps & StateProps> = ({
|
|||||||
storyViewerOrigin={StoryViewerOrigin.MiddleHeaderAvatar}
|
storyViewerOrigin={StoryViewerOrigin.MiddleHeaderAvatar}
|
||||||
emojiStatusSize={EMOJI_STATUS_SIZE}
|
emojiStatusSize={EMOJI_STATUS_SIZE}
|
||||||
noRtl
|
noRtl
|
||||||
onEmojiStatusClick={handleStatusClick}
|
onEmojiStatusClick={handleUserStatusClick}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<GroupChatInfo
|
<GroupChatInfo
|
||||||
@ -406,6 +415,7 @@ const MiddleHeader: FC<OwnProps & StateProps> = ({
|
|||||||
withStory
|
withStory
|
||||||
storyViewerOrigin={StoryViewerOrigin.MiddleHeaderAvatar}
|
storyViewerOrigin={StoryViewerOrigin.MiddleHeaderAvatar}
|
||||||
emojiStatusSize={EMOJI_STATUS_SIZE}
|
emojiStatusSize={EMOJI_STATUS_SIZE}
|
||||||
|
onEmojiStatusClick={handleChannelStatusClick}
|
||||||
noRtl
|
noRtl
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -539,6 +549,9 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
const shouldSendJoinRequest = Boolean(chat?.isNotJoined && chat.isJoinRequest);
|
const shouldSendJoinRequest = Boolean(chat?.isNotJoined && chat.isJoinRequest);
|
||||||
const typingStatus = selectThreadParam(global, chatId, threadId, 'typingStatus');
|
const typingStatus = selectThreadParam(global, chatId, threadId, 'typingStatus');
|
||||||
|
|
||||||
|
const emojiStatus = chat?.emojiStatus;
|
||||||
|
const emojiStatusSticker = emojiStatus && global.customEmojis.byId[emojiStatus.documentId];
|
||||||
|
|
||||||
const state: StateProps = {
|
const state: StateProps = {
|
||||||
typingStatus,
|
typingStatus,
|
||||||
isLeftColumnShown,
|
isLeftColumnShown,
|
||||||
@ -554,6 +567,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
isSyncing: global.isSyncing,
|
isSyncing: global.isSyncing,
|
||||||
isSynced: global.isSynced,
|
isSynced: global.isSynced,
|
||||||
isFetchingDifference: global.isFetchingDifference,
|
isFetchingDifference: global.isFetchingDifference,
|
||||||
|
emojiStatusSticker,
|
||||||
hasButtonInHeader: canStartBot || canRestartBot || canSubscribe || shouldSendJoinRequest,
|
hasButtonInHeader: canStartBot || canRestartBot || canSubscribe || shouldSendJoinRequest,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user