From 27a5ba4681fc4974304fa88e7ff739c7ffefa145 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 14 Nov 2024 04:02:07 +0300 Subject: [PATCH] Added top close button to ReceiptCreditsBox. --- Telegram/SourceFiles/boxes/send_credits_box.cpp | 10 +++------- .../SourceFiles/settings/settings_credits_graphics.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/boxes/send_credits_box.cpp b/Telegram/SourceFiles/boxes/send_credits_box.cpp index d00a95f1f..d0ddd819c 100644 --- a/Telegram/SourceFiles/boxes/send_credits_box.cpp +++ b/Telegram/SourceFiles/boxes/send_credits_box.cpp @@ -473,15 +473,11 @@ void SendCreditsBox( { const auto close = Ui::CreateChild( - box.get(), + content, st::boxTitleClose); - close->setClickedCallback([=] { - box->closeBox(); - }); - box->widthValue( - ) | rpl::start_with_next([=](int width) { + close->setClickedCallback([=] { box->closeBox(); }); + content->widthValue() | rpl::start_with_next([=](int) { close->moveToRight(0, 0); - close->raise(); }, close->lifetime()); } diff --git a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp index eb4567a82..299f0437b 100644 --- a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp +++ b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp @@ -1434,6 +1434,16 @@ void ReceiptCreditsBox( } }; + if ((toRenew || canConvert || couldConvert || nonConvertible) && peer) { + const auto close = Ui::CreateChild( + content, + st::boxTitleClose); + close->setClickedCallback([=] { box->closeBox(); }); + content->widthValue() | rpl::start_with_next([=](int) { + close->moveToRight(0, 0); + }, content->lifetime()); + } + const auto button = box->addButton(std::move(confirmText), [=] { if (state->confirmButtonBusy.current() || state->convertButtonBusy.current()) {