Context Menu: Refactoring (#5398)
This commit is contained in:
parent
a473c468c7
commit
d9b1923c83
@ -153,7 +153,7 @@ type StateProps = {
|
|||||||
isChannel?: boolean;
|
isChannel?: boolean;
|
||||||
canReplyInChat?: boolean;
|
canReplyInChat?: boolean;
|
||||||
isWithPaidReaction?: boolean;
|
isWithPaidReaction?: boolean;
|
||||||
contactUserFullName?: string;
|
userFullName?: string;
|
||||||
canGift?: boolean;
|
canGift?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ const ContextMenuContainer: FC<OwnProps & StateProps> = ({
|
|||||||
isWithPaidReaction,
|
isWithPaidReaction,
|
||||||
onClose,
|
onClose,
|
||||||
onCloseAnimationEnd,
|
onCloseAnimationEnd,
|
||||||
contactUserFullName,
|
userFullName,
|
||||||
canGift,
|
canGift,
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
@ -698,7 +698,7 @@ const ContextMenuContainer: FC<OwnProps & StateProps> = ({
|
|||||||
onTranslate={handleTranslate}
|
onTranslate={handleTranslate}
|
||||||
onShowOriginal={handleShowOriginal}
|
onShowOriginal={handleShowOriginal}
|
||||||
onSelectLanguage={handleSelectLanguage}
|
onSelectLanguage={handleSelectLanguage}
|
||||||
contactUserFullName={contactUserFullName}
|
userFullName={userFullName}
|
||||||
canGift={canGift}
|
canGift={canGift}
|
||||||
/>
|
/>
|
||||||
<PinMessageModal
|
<PinMessageModal
|
||||||
@ -729,9 +729,8 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
const chat = selectChat(global, message.chatId);
|
const chat = selectChat(global, message.chatId);
|
||||||
const isPrivate = chat && isUserId(chat.id);
|
const isPrivate = chat && isUserId(chat.id);
|
||||||
const chatFullInfo = !isPrivate ? selectChatFullInfo(global, message.chatId) : undefined;
|
const chatFullInfo = !isPrivate ? selectChatFullInfo(global, message.chatId) : undefined;
|
||||||
const contactUserFullName = chat && isUserId(chat.id)
|
const user = selectUser(global, message.chatId);
|
||||||
? getUserFullName(selectUser(global, getPrivateChatUserId(chat)!))
|
const userFullName = user && getUserFullName(user);
|
||||||
: undefined;
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
seenByExpiresAt, seenByMaxChatMembers, maxUniqueReactions, readDateExpiresAt,
|
seenByExpiresAt, seenByMaxChatMembers, maxUniqueReactions, readDateExpiresAt,
|
||||||
@ -883,7 +882,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
isWithPaidReaction: chatFullInfo?.isPaidReactionAvailable,
|
isWithPaidReaction: chatFullInfo?.isPaidReactionAvailable,
|
||||||
poll,
|
poll,
|
||||||
story,
|
story,
|
||||||
contactUserFullName,
|
userFullName,
|
||||||
canGift,
|
canGift,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@ -129,7 +129,7 @@ type OwnProps = {
|
|||||||
onSendPaidReaction?: NoneToVoidFunction;
|
onSendPaidReaction?: NoneToVoidFunction;
|
||||||
onShowPaidReactionModal?: NoneToVoidFunction;
|
onShowPaidReactionModal?: NoneToVoidFunction;
|
||||||
onReactionPickerOpen?: (position: IAnchorPosition) => void;
|
onReactionPickerOpen?: (position: IAnchorPosition) => void;
|
||||||
contactUserFullName?: string;
|
userFullName?: string;
|
||||||
canGift?: boolean;
|
canGift?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ const MessageContextMenu: FC<OwnProps> = ({
|
|||||||
onTranslate,
|
onTranslate,
|
||||||
onShowOriginal,
|
onShowOriginal,
|
||||||
onSelectLanguage,
|
onSelectLanguage,
|
||||||
contactUserFullName,
|
userFullName,
|
||||||
canGift,
|
canGift,
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
@ -238,10 +238,10 @@ const MessageContextMenu: FC<OwnProps> = ({
|
|||||||
const seenByDates = message.seenByDates;
|
const seenByDates = message.seenByDates;
|
||||||
const isPremiumGift = message.content.action?.type === 'giftPremium';
|
const isPremiumGift = message.content.action?.type === 'giftPremium';
|
||||||
const isGiftCode = message.content.action?.type === 'giftCode';
|
const isGiftCode = message.content.action?.type === 'giftCode';
|
||||||
const isStarsGift = message.content.action?.type === 'giftStars';
|
|
||||||
const isStarGift = message.content.action?.type === 'starGift';
|
const isStarGift = message.content.action?.type === 'starGift';
|
||||||
|
const isStarGiftUnique = message.content.action?.type === 'starGiftUnique';
|
||||||
const shouldShowGiftButton = isUserId(message.chatId)
|
const shouldShowGiftButton = isUserId(message.chatId)
|
||||||
&& canGift && (isPremiumGift || isGiftCode || isStarsGift || isStarGift);
|
&& canGift && (isPremiumGift || isGiftCode || isStarGift || isStarGiftUnique);
|
||||||
|
|
||||||
const [areItemsHidden, hideItems] = useFlag();
|
const [areItemsHidden, hideItems] = useFlag();
|
||||||
const [isReady, markIsReady, unmarkIsReady] = useFlag();
|
const [isReady, markIsReady, unmarkIsReady] = useFlag();
|
||||||
@ -403,7 +403,7 @@ const MessageContextMenu: FC<OwnProps> = ({
|
|||||||
&& (
|
&& (
|
||||||
<MenuItem icon="gift" onClick={handleGiftClick}>
|
<MenuItem icon="gift" onClick={handleGiftClick}>
|
||||||
{message?.isOutgoing ? lang('SendAnotherGift')
|
{message?.isOutgoing ? lang('SendAnotherGift')
|
||||||
: lang('Conversation.ContextMenuSendGiftTo', contactUserFullName)}
|
: lang('Conversation.ContextMenuSendGiftTo', userFullName)}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
{canSendNow && <MenuItem icon="send-outline" onClick={onSend}>{lang('MessageScheduleSend')}</MenuItem>}
|
{canSendNow && <MenuItem icon="send-outline" onClick={onSend}>{lang('MessageScheduleSend')}</MenuItem>}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user