Made less strict condition to show unique status of gift in gift box.

This commit is contained in:
23rd 2025-01-27 20:28:30 +03:00
parent 2adc811351
commit 2ca763cc77

View file

@ -474,27 +474,34 @@ void AddTableRow(
table->st().defaultValue, table->st().defaultValue,
st::defaultPopupMenu); st::defaultPopupMenu);
const auto upgrade = Ui::CreateChild<Ui::RoundButton>( const auto upgrade = startUpgrade
raw, ? Ui::CreateChild<Ui::RoundButton>(
tr::lng_gift_unique_status_upgrade(), raw,
table->st().smallButton); tr::lng_gift_unique_status_upgrade(),
upgrade->setTextTransform(Ui::RoundButton::TextTransform::NoTransform); table->st().smallButton)
upgrade->setClickedCallback(startUpgrade); : (Ui::RoundButton*)(nullptr);
if (upgrade) {
using namespace Ui;
upgrade->setTextTransform(RoundButton::TextTransform::NoTransform);
upgrade->setClickedCallback(startUpgrade);
}
rpl::combine( rpl::combine(
raw->widthValue(), raw->widthValue(),
upgrade->widthValue() upgrade ? upgrade->widthValue() : rpl::single(0)
) | rpl::start_with_next([=](int width, int toggleWidth) { ) | rpl::start_with_next([=](int width, int toggleWidth) {
const auto toggleSkip = toggleWidth const auto toggleSkip = toggleWidth
? (st::normalFont->spacew + toggleWidth) ? (st::normalFont->spacew + toggleWidth)
: 0; : 0;
label->resizeToNaturalWidth(width - toggleSkip); label->resizeToNaturalWidth(width - toggleSkip);
label->moveToLeft(0, 0, width); label->moveToLeft(0, 0, width);
upgrade->moveToLeft( if (upgrade) {
label->width() + st::normalFont->spacew, upgrade->moveToLeft(
(table->st().defaultValue.style.font->ascent label->width() + st::normalFont->spacew,
- table->st().smallButton.style.font->ascent), (table->st().defaultValue.style.font->ascent
width); - table->st().smallButton.style.font->ascent),
width);
}
}, label->lifetime()); }, label->lifetime());
label->heightValue() | rpl::start_with_next([=](int height) { label->heightValue() | rpl::start_with_next([=](int height) {
@ -1390,7 +1397,7 @@ void AddStarGiftTable(
? MakePeerTableValue(table, show, PeerId(entry.bareActorId)) ? MakePeerTableValue(table, show, PeerId(entry.bareActorId))
: MakeHiddenPeerTableValue(table)), : MakeHiddenPeerTableValue(table)),
st::giveawayGiftCodePeerMargin); st::giveawayGiftCodePeerMargin);
if (!entry.fromGiftsList) { if (entry.bareGiftListPeerId) {
AddTableRow( AddTableRow(
table, table,
tr::lng_credits_box_history_entry_peer(), tr::lng_credits_box_history_entry_peer(),
@ -1500,7 +1507,7 @@ void AddStarGiftTable(
std::move(amount), std::move(amount),
Ui::Text::WithEntities))); Ui::Text::WithEntities)));
} }
if (!unique && startUpgrade) { if (!unique && !entry.soldOutInfo) {
AddTableRow( AddTableRow(
table, table,
tr::lng_gift_unique_status(), tr::lng_gift_unique_status(),