Remove balance for admins changing prices.

This commit is contained in:
John Preston 2025-06-27 21:09:16 +04:00
parent b66c61573f
commit fbfdef8f9a

View file

@ -125,17 +125,23 @@ void ChooseSuggestPriceBox(
const auto container = box->verticalLayout(); const auto container = box->verticalLayout();
box->setStyle(st::suggestPriceBox); box->setStyle(st::suggestPriceBox);
box->setNoContentMargin(true);
Ui::AddSkip(container, st::boxTitleHeight * 1.1); auto title = (args.mode == SuggestMode::New)
box->addRow(object_ptr<Ui::CenterWrap<>>( ? tr::lng_suggest_options_title()
box, : tr::lng_suggest_options_change();
object_ptr<Ui::FlatLabel>( if (admin) {
box->setTitle(std::move(title));
} else {
box->setNoContentMargin(true);
Ui::AddSkip(container, st::boxTitleHeight * 1.1);
box->addRow(object_ptr<Ui::CenterWrap<>>(
box, box,
((args.mode == SuggestMode::New) object_ptr<Ui::FlatLabel>(
? tr::lng_suggest_options_title() box,
: tr::lng_suggest_options_change()), std::move(title),
st::settingsPremiumUserTitle))); st::settingsPremiumUserTitle)));
}
state->buttons.push_back({ state->buttons.push_back({
.text = Ui::Text::String( .text = Ui::Text::String(
@ -164,10 +170,15 @@ void ChooseSuggestPriceBox(
button.geometry = QRect(QPoint(x, y), r.size()); button.geometry = QRect(QPoint(x, y), r.size());
x += r.width() + st::giftBoxTabSkip; x += r.width() + st::giftBoxTabSkip;
} }
const auto buttonsSkip = admin ? 0 : st::normalFont->height;
const auto buttons = box->addRow( const auto buttons = box->addRow(
object_ptr<Ui::RpWidget>(box), object_ptr<Ui::RpWidget>(box),
(st::boxRowPadding (st::boxRowPadding
- QMargins(padding.left() / 2, -st::normalFont->height, padding.right() / 2, 0))); - QMargins(
padding.left() / 2,
-buttonsSkip,
padding.right() / 2,
0)));
const auto height = y const auto height = y
+ state->buttons.back().geometry.height() + state->buttons.back().geometry.height()
+ st::giftBoxTabsMargin.bottom(); + st::giftBoxTabsMargin.bottom();
@ -531,8 +542,11 @@ void ChooseSuggestPriceBox(
button->resizeToWidth(buttonWidth); button->resizeToWidth(buttonWidth);
}, button->lifetime()); }, button->lifetime());
if (admin) {
{ box->addTopButton(st::boxTitleClose, [=] {
box->closeBox();
});
} else {
const auto close = Ui::CreateChild<Ui::IconButton>( const auto close = Ui::CreateChild<Ui::IconButton>(
container, container,
st::boxTitleClose); st::boxTitleClose);
@ -540,9 +554,7 @@ void ChooseSuggestPriceBox(
container->widthValue() | rpl::start_with_next([=](int) { container->widthValue() | rpl::start_with_next([=](int) {
close->moveToRight(0, 0); close->moveToRight(0, 0);
}, close->lifetime()); }, close->lifetime());
}
{
session->credits().load(true); session->credits().load(true);
session->credits().tonLoad(true); session->credits().tonLoad(true);
const auto balance = Settings::AddBalanceWidget( const auto balance = Settings::AddBalanceWidget(