Fixed padding for history entries in channel earn section.

This commit is contained in:
23rd 2024-08-18 13:02:39 +03:00
parent f650c679e0
commit 50f9f36c3d

View file

@ -1012,8 +1012,7 @@ void InnerWidget::fill() {
not_null<Ui::VerticalLayout*> listsContainer) { not_null<Ui::VerticalLayout*> listsContainer) {
const auto hasCurrencyTab const auto hasCurrencyTab
= !data.currencyEarn.firstHistorySlice.list.empty(); = !data.currencyEarn.firstHistorySlice.list.empty();
const auto hasCreditsTab = !data.creditsStatusSlice.list.empty() const auto hasCreditsTab = !data.creditsStatusSlice.list.empty();
&& data.premiumBotId;
const auto hasOneTab = (hasCurrencyTab || hasCreditsTab) const auto hasOneTab = (hasCurrencyTab || hasCreditsTab)
&& (hasCurrencyTab != hasCreditsTab); && (hasCurrencyTab != hasCreditsTab);
@ -1029,7 +1028,9 @@ void InnerWidget::fill() {
listsContainer, listsContainer,
st::defaultTabsSlider)), st::defaultTabsSlider)),
st::boxRowPadding); st::boxRowPadding);
slider->toggle(!hasOneTab, anim::type::instant); slider->toggle(
((hasCurrencyTab ? 1 : 0) + (hasCreditsTab ? 1 : 0) > 1),
anim::type::instant);
if (hasCurrencyTab) { if (hasCurrencyTab) {
slider->entity()->addSection(currencyTabText); slider->entity()->addSection(currencyTabText);
@ -1053,11 +1054,13 @@ void InnerWidget::fill() {
if (hasOneTab) { if (hasOneTab) {
if (hasCurrencyTab) { if (hasCurrencyTab) {
AddHeader(listsContainer, tr::lng_channel_earn_history_title); AddHeader(listsContainer, tr::lng_channel_earn_history_title);
AddSkip(listsContainer);
} else if (hasCreditsTab) { } else if (hasCreditsTab) {
AddHeader( AddHeader(
listsContainer, listsContainer,
tr::lng_channel_earn_credits_history); tr::lng_channel_earn_credits_history);
slider->entity()->setActiveSectionFast(1); slider->entity()->setActiveSectionFast(1);
AddSkip(listsContainer);
} }
} else { } else {
slider->entity()->setActiveSectionFast(*sectionIndex); slider->entity()->setActiveSectionFast(*sectionIndex);