Premium Gift: Fix header info about sender (#5367)
This commit is contained in:
parent
7b2956cb3f
commit
4cd8da212c
@ -246,23 +246,6 @@ const PremiumMainModal: FC<OwnProps & StateProps> = ({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const stickerSetTitle = useMemo(() => {
|
|
||||||
if (!fromUserStatusSet || !fromUser) return undefined;
|
|
||||||
|
|
||||||
const template = lang('lng_premium_emoji_status_title').replace('{user}', getUserFullName(fromUser)!);
|
|
||||||
const [first, second] = template.split('{link}');
|
|
||||||
|
|
||||||
const emoji = fromUserStatusSet.thumbCustomEmojiId ? (
|
|
||||||
<CustomEmoji className={styles.stickerSetLinkIcon} documentId={fromUserStatusSet.thumbCustomEmojiId} />
|
|
||||||
) : undefined;
|
|
||||||
const link = (
|
|
||||||
<span className={styles.stickerSetLink} onClick={handleOpenStatusSet}>
|
|
||||||
{emoji}{renderText(fromUserStatusSet.title)}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
return [renderText(first), link, renderText(second)];
|
|
||||||
}, [fromUser, fromUserStatusSet, lang]);
|
|
||||||
|
|
||||||
const fullMonthlyAmount = useMemo(() => {
|
const fullMonthlyAmount = useMemo(() => {
|
||||||
const monthOption = promo?.options.find((option) => option.months === 1);
|
const monthOption = promo?.options.find((option) => option.months === 1);
|
||||||
if (!monthOption) {
|
if (!monthOption) {
|
||||||
@ -288,14 +271,35 @@ const PremiumMainModal: FC<OwnProps & StateProps> = ({
|
|||||||
|
|
||||||
function getHeaderText() {
|
function getHeaderText() {
|
||||||
if (isGift) {
|
if (isGift) {
|
||||||
return fromUser?.id === currentUserId
|
return renderText(
|
||||||
? lang('TelegramPremiumUserGiftedPremiumOutboundDialogTitle', [getUserFullName(toUser), monthsAmount])
|
fromUser?.id === currentUserId
|
||||||
: lang('TelegramPremiumUserGiftedPremiumDialogTitle', [getUserFullName(fromUser), monthsAmount]);
|
? lang('TelegramPremiumUserGiftedPremiumOutboundDialogTitle', [getUserFullName(toUser), monthsAmount])
|
||||||
|
: lang('TelegramPremiumUserGiftedPremiumDialogTitle', [getUserFullName(fromUser), monthsAmount]),
|
||||||
|
['simple_markdown', 'emoji'],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromUser
|
if (fromUserStatusSet && fromUser) {
|
||||||
? lang('TelegramPremiumUserDialogTitle', getUserFullName(fromUser))
|
const template = lang('lng_premium_emoji_status_title').replace('{user}', getUserFullName(fromUser)!);
|
||||||
: lang(isPremium ? 'TelegramPremiumSubscribedTitle' : 'TelegramPremium');
|
const [first, second] = template.split('{link}');
|
||||||
|
|
||||||
|
const emoji = fromUserStatusSet.thumbCustomEmojiId ? (
|
||||||
|
<CustomEmoji className={styles.stickerSetLinkIcon} documentId={fromUserStatusSet.thumbCustomEmojiId} />
|
||||||
|
) : undefined;
|
||||||
|
const link = (
|
||||||
|
<span className={styles.stickerSetLink} onClick={handleOpenStatusSet}>
|
||||||
|
{emoji}{renderText(fromUserStatusSet.title)}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
return [renderText(first), link, renderText(second)];
|
||||||
|
}
|
||||||
|
|
||||||
|
return renderText(
|
||||||
|
fromUser
|
||||||
|
? lang('TelegramPremiumUserDialogTitle', getUserFullName(fromUser))
|
||||||
|
: lang(isPremium ? 'TelegramPremiumSubscribedTitle' : 'TelegramPremium'),
|
||||||
|
['simple_markdown', 'emoji'],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHeaderDescription() {
|
function getHeaderDescription() {
|
||||||
@ -368,7 +372,9 @@ const PremiumMainModal: FC<OwnProps & StateProps> = ({
|
|||||||
>
|
>
|
||||||
<i className="icon icon-close" />
|
<i className="icon icon-close" />
|
||||||
</Button>
|
</Button>
|
||||||
{fromUserStatusEmoji ? (
|
{isGift ? (
|
||||||
|
<img className={styles.logo} src={PremiumLogo} alt="" draggable={false} />
|
||||||
|
) : fromUserStatusEmoji ? (
|
||||||
<CustomEmoji
|
<CustomEmoji
|
||||||
className={styles.statusEmoji}
|
className={styles.statusEmoji}
|
||||||
onClick={handleOpenStatusSet}
|
onClick={handleOpenStatusSet}
|
||||||
@ -376,11 +382,9 @@ const PremiumMainModal: FC<OwnProps & StateProps> = ({
|
|||||||
isBig
|
isBig
|
||||||
size={STATUS_EMOJI_SIZE}
|
size={STATUS_EMOJI_SIZE}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : undefined}
|
||||||
<img className={styles.logo} src={PremiumLogo} alt="" draggable={false} />
|
|
||||||
)}
|
|
||||||
<h2 className={buildClassName(styles.headerText, fromUserStatusSet && styles.stickerSetText)}>
|
<h2 className={buildClassName(styles.headerText, fromUserStatusSet && styles.stickerSetText)}>
|
||||||
{fromUserStatusSet ? stickerSetTitle : renderText(getHeaderText(), ['simple_markdown', 'emoji'])}
|
{getHeaderText()}
|
||||||
</h2>
|
</h2>
|
||||||
<div className={styles.description}>
|
<div className={styles.description}>
|
||||||
{renderText(getHeaderDescription(), ['simple_markdown', 'emoji'])}
|
{renderText(getHeaderDescription(), ['simple_markdown', 'emoji'])}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user