Add separate "Change Price" context menu button.

This commit is contained in:
John Preston 2025-04-23 13:50:32 +04:00
parent 04a7f14c0e
commit 8b5a00ca27
2 changed files with 10 additions and 7 deletions

View file

@ -3583,6 +3583,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_gift_transfer_wear" = "Wear";
"lng_gift_transfer_take_off" = "Take Off";
"lng_gift_transfer_sell" = "Sell";
"lng_gift_transfer_update" = "Change Price";
"lng_gift_transfer_unlist" = "Unlist";
"lng_gift_sell_unlist_title" = "Unlist {name}";
"lng_gift_sell_unlist_sure" = "Are you sure you want to unlist your gift?";

View file

@ -1060,6 +1060,15 @@ void FillUniqueGiftMenu(
}
if (CanResellGift(&show->session(), e)) {
const auto resalePrice = unique->starsForResale;
const auto editPrice = (resalePrice > 0
? tr::lng_gift_transfer_update
: tr::lng_gift_transfer_sell)(tr::now);
menu->addAction(editPrice, [=] {
const auto style = st.giftWearBox
? *st.giftWearBox
: GiftWearBoxStyleOverride();
ShowUniqueGiftSellBox(show, unique, savedId, style);
}, st.resell ? st.resell : &st::menuIconTagSell);
if (resalePrice > 0) {
menu->addAction(tr::lng_gift_transfer_unlist(tr::now), [=] {
const auto name = UniqueGiftName(*unique);
@ -1076,13 +1085,6 @@ void FillUniqueGiftMenu(
rpl::single(name)),
}));
}, st.unlist ? st.unlist : &st::menuIconTagRemove);
} else {
menu->addAction(tr::lng_gift_transfer_sell(tr::now), [=] {
const auto style = st.giftWearBox
? *st.giftWearBox
: GiftWearBoxStyleOverride();
ShowUniqueGiftSellBox(show, unique, savedId, style);
}, st.resell ? st.resell : &st::menuIconTagSell);
}
}
}