Skip to content

Commit fc2d973

Browse files
committed
Gift Modal: Hide first and last sale dates (#5788)
1 parent 9a2f47c commit fc2d973

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/components/modals/gift/info/GiftInfoModal.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,22 @@ const GiftInfoModal = ({
185185
);
186186
});
187187

188+
const saleDateInfo = useMemo(() => {
189+
if (!gift) return undefined;
190+
let text = '';
191+
if (gift.type === 'starGift') {
192+
if (gift.firstSaleDate) {
193+
text += `${lang('GiftInfoFirstSale')} ${formatDateTimeToString(gift.firstSaleDate * 1000, lang.code, true)}`;
194+
}
195+
if (gift.lastSaleDate) {
196+
text += '\n';
197+
text += `${lang('GiftInfoLastSale')} ${formatDateTimeToString(gift.lastSaleDate * 1000, lang.code, true)}`;
198+
}
199+
}
200+
201+
return text;
202+
}, [gift, lang]);
203+
188204
const modalData = useMemo(() => {
189205
if (!typeGift || !gift) {
190206
return undefined;
@@ -359,18 +375,18 @@ const GiftInfoModal = ({
359375
if (savedGift?.date) {
360376
tableData.push([
361377
lang('GiftInfoDate'),
362-
formatDateTimeToString(savedGift.date * 1000, lang.code, true),
378+
<span title={saleDateInfo}>{formatDateTimeToString(savedGift.date * 1000, lang.code, true)}</span>,
363379
]);
364380
}
365381

366-
if (gift.firstSaleDate) {
382+
if (gift.firstSaleDate && !savedGift) {
367383
tableData.push([
368384
lang('GiftInfoFirstSale'),
369385
formatDateTimeToString(gift.firstSaleDate * 1000, lang.code, true),
370386
]);
371387
}
372388

373-
if (gift.lastSaleDate) {
389+
if (gift.lastSaleDate && !savedGift) {
374390
tableData.push([
375391
lang('GiftInfoLastSale'),
376392
formatDateTimeToString(gift.lastSaleDate * 1000, lang.code, true),
@@ -602,7 +618,7 @@ const GiftInfoModal = ({
602618
canManage, hasConvertOption, isSender, oldLang, tonExplorerUrl,
603619
gift, giftAttributes, renderFooterButton, isTargetChat,
604620
SettingsMenuButton, isOpen, isGiftUnique, renderingModal,
605-
collectibleEmojiStatuses, currentUserEmojiStatus,
621+
collectibleEmojiStatuses, currentUserEmojiStatus, saleDateInfo,
606622
]);
607623

608624
return (

0 commit comments

Comments
 (0)