Slightly improved style of channel earn info section.

This commit is contained in:
23rd 2024-04-01 05:55:59 +03:00 committed by John Preston
parent bb438880e3
commit 2795af8c7f
2 changed files with 16 additions and 9 deletions

View file

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
using "ui/basic.style"; using "ui/basic.style";
using "boxes/boxes.style"; using "boxes/boxes.style";
using "statistics/statistics.style";
channelEarnLearnArrowMargins: margins(-2px, 5px, 0px, 0px); channelEarnLearnArrowMargins: margins(-2px, 5px, 0px, 0px);
@ -34,6 +35,10 @@ channelEarnSemiboldLabel: FlatLabel(channelEarnOverviewMajorLabel) {
style: TextStyle(semiboldTextStyle) { style: TextStyle(semiboldTextStyle) {
} }
} }
channelEarnHeaderLabel: FlatLabel(channelEarnOverviewMajorLabel) {
style: TextStyle(statisticsHeaderTitleTextStyle) {
}
}
channelEarnHistorySubLabel: FlatLabel(channelEarnOverviewSubMinorLabel) { channelEarnHistorySubLabel: FlatLabel(channelEarnOverviewSubMinorLabel) {
style: TextStyle(defaultTextStyle) { style: TextStyle(defaultTextStyle) {
font: font(12px); font: font(12px);

View file

@ -124,7 +124,7 @@ void AddHeader(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
content, content,
text(), text(),
st::channelEarnSemiboldLabel), st::channelEarnHeaderLabel),
st::boxRowPadding); st::boxRowPadding);
header->resizeToWidth(header->width()); header->resizeToWidth(header->width());
} }
@ -515,11 +515,13 @@ void InnerWidget::fill() {
widget->setChartData(chart, Type::StackBar); widget->setChartData(chart, Type::StackBar);
widget->setTitle(tr::lng_channel_earn_chart_revenue()); widget->setTitle(tr::lng_channel_earn_chart_revenue());
} }
}
if (data.topHoursGraph.chart || data.revenueGraph.chart) {
Ui::AddSkip(container);
Ui::AddSkip(container);
Ui::AddDivider(container);
Ui::AddSkip(container); Ui::AddSkip(container);
} }
Ui::AddSkip(container);
Ui::AddDivider(container);
Ui::AddSkip(container);
{ {
AddHeader(container, tr::lng_channel_earn_overview_title); AddHeader(container, tr::lng_channel_earn_overview_title);
Ui::AddSkip(container, st::channelEarnOverviewTitleSkip); Ui::AddSkip(container, st::channelEarnOverviewTitleSkip);
@ -540,7 +542,7 @@ void InnerWidget::fill() {
st::channelEarnOverviewMinorLabel); st::channelEarnOverviewMinorLabel);
const auto secondMinorLabel = Ui::CreateChild<Ui::FlatLabel>( const auto secondMinorLabel = Ui::CreateChild<Ui::FlatLabel>(
line, line,
ToUsd(value, multiplier), value ? ToUsd(value, multiplier) : QString(),
st::channelEarnOverviewSubMinorLabel); st::channelEarnOverviewSubMinorLabel);
rpl::combine( rpl::combine(
line->widthValue(), line->widthValue(),
@ -688,7 +690,7 @@ void InnerWidget::fill() {
: tr::lng_channel_earn_balance_about_temp); : tr::lng_channel_earn_balance_about_temp);
Ui::AddSkip(container); Ui::AddSkip(container);
} }
{ if (!data.firstHistorySlice.list.empty()) {
AddHeader(container, tr::lng_channel_earn_history_title); AddHeader(container, tr::lng_channel_earn_history_title);
Ui::AddSkip(container); Ui::AddSkip(container);
@ -995,10 +997,10 @@ void InnerWidget::fill() {
} }
}); });
} }
Ui::AddSkip(container);
Ui::AddDivider(container);
Ui::AddSkip(container);
} }
Ui::AddSkip(container);
Ui::AddDivider(container);
Ui::AddSkip(container);
if (channel) { if (channel) {
constexpr auto kMaxCPM = 50; // Debug. constexpr auto kMaxCPM = 50; // Debug.
const auto requiredLevel = Data::LevelLimits(session) const auto requiredLevel = Data::LevelLimits(session)