From ee33d139cdcbd3c8885c30458ce18e3ed4131447 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 7 Nov 2023 03:01:12 +0300 Subject: [PATCH] Improved style of tabs in boosts info. --- Telegram/Resources/langs/lang.strings | 4 ++-- .../info/boosts/info_boosts_inner_widget.cpp | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index f3d56b3d0e..979b9c783e 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -4325,8 +4325,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_boosts_existing" = "Existing boosts"; "lng_boosts_premium_audience" = "Premium subscribers"; "lng_boosts_next_level" = "Boosts to level up"; -"lng_boosts_list_title#one" = "{count} booster"; -"lng_boosts_list_title#other" = "{count} boosters"; +"lng_boosts_list_title#one" = "{count} Boost"; +"lng_boosts_list_title#other" = "{count} Boosts"; "lng_boosts_list_subtext" = "Your channel is currently boosted by these users."; "lng_boosts_show_more_boosts#one" = "Show {count} More Boosts"; "lng_boosts_show_more_boosts#other" = "Show {count} More Boosts"; diff --git a/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp b/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp index d956a47f1f..4a85789e66 100644 --- a/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp +++ b/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp @@ -352,11 +352,26 @@ void InnerWidget::fill() { inner, object_ptr( inner, - st::defaultTabsSlider))); + st::defaultTabsSlider)), + st::boxRowPadding); slider->toggle(!hasOneTab, anim::type::instant); + slider->entity()->addSection(boostsTabText); slider->entity()->addSection(giftsTabText); + { + const auto &st = st::defaultTabsSlider; + const auto sliderWidth = st.labelStyle.font->width(boostsTabText) + + st.labelStyle.font->width(giftsTabText) + + rect::m::sum::h(st::boxRowPadding); + fakeShowed->events() | rpl::take(1) | rpl::map_to(-1) | rpl::then( + slider->entity()->widthValue() + ) | rpl::distinct_until_changed( + ) | rpl::start_with_next([=](int) { + slider->entity()->resizeToWidth(sliderWidth); + }, slider->lifetime()); + } + const auto boostsWrap = inner->add( object_ptr>( inner,