From d2d69a7a361bcbdc719dcdbefc7dba1bc9fdf8da Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 1 Nov 2023 02:04:24 +0300 Subject: [PATCH] Added premium star to top of giveaway box. --- .../info/boosts/create_giveaway_box.cpp | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp b/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp index abd739e9d3..bce9e702b2 100644 --- a/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp +++ b/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp @@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "settings/settings_premium.h" // Settings::ShowPremium #include "ui/boxes/choose_date_time.h" #include "ui/effects/premium_graphics.h" +#include "ui/effects/premium_top_bar.h" #include "ui/layers/generic_box.h" #include "ui/text/format_values.h" #include "ui/text/text_utilities.h" @@ -31,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/continuous_sliders.h" #include "ui/widgets/labels.h" #include "ui/wrap/slide_wrap.h" +#include "styles/style_info.h" #include "styles/style_layers.h" #include "styles/style_premium.h" #include "styles/style_settings.h" @@ -54,6 +56,35 @@ void CreateGiveawayBox( not_null box, not_null controller, not_null peer) { + { + const auto bar = box->verticalLayout()->add( + object_ptr( + box, + st::giveawayGiftCodeCover, + nullptr, + tr::lng_giveaway_new_title(), + tr::lng_giveaway_new_about(Ui::Text::RichLangValue), + true)); + bar->setMaximumHeight(st::giveawayGiftCodeTopHeight); + bar->setMinimumHeight(st::infoLayerTopBarHeight); + bar->resize(bar->width(), bar->maximumHeight()); + + Settings::AddSkip(box->verticalLayout()); + Settings::AddDivider(box->verticalLayout()); + Settings::AddSkip(box->verticalLayout()); + + const auto close = Ui::CreateChild( + box->verticalLayout().get(), + st::boxTitleClose); + close->setClickedCallback([=] { + box->closeBox(); + }); + box->widthValue( + ) | rpl::start_with_next([=](int) { + close->moveToRight(0, 0); + }, box->lifetime()); + } + using GiveawayType = Giveaway::GiveawayTypeRow::Type; using GiveawayGroup = Ui::RadioenumGroup; struct State final {