2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fixed reward label for point details widget in credits statistics.

This commit is contained in:
23rd
2025-01-24 15:35:20 +03:00
committed by John Preston
parent f90a4db569
commit c08266f81b
2 changed files with 13 additions and 4 deletions

View File

@@ -214,6 +214,8 @@ PointDetailsWidget::PointDetailsWidget(
const auto calculatedWidth = [&]{
auto maxNameTextWidth = 0;
const auto isCredits
= _chartData.currency == Data::StatisticalCurrency::Credits;
for (const auto &dataLine : _chartData.lines) {
const auto maxNameText = Ui::Text::String(
_textStyle,
@@ -222,10 +224,12 @@ PointDetailsWidget::PointDetailsWidget(
maxNameText.maxWidth(),
maxNameTextWidth);
if (hasUsdLine) {
const auto text = isCredits
? tr::lng_channel_earn_chart_overriden_detail_credits
: tr::lng_channel_earn_chart_overriden_detail_currency;
const auto currency = Ui::Text::String(
_textStyle,
tr::lng_channel_earn_chart_overriden_detail_currency(
tr::now));
text(tr::now));
const auto usd = Ui::Text::String(
_textStyle,
tr::lng_channel_earn_chart_overriden_detail_usd(
@@ -322,6 +326,8 @@ void PointDetailsWidget::setXIndex(int xIndex) {
{ float64(xIndex), float64(xIndex) }).parts
: std::vector<PiePartData::Part>();
const auto multiplier = float64(Data::kEarnMultiplier);
const auto isCredits
= _chartData.currency == Data::StatisticalCurrency::Credits;
for (auto i = 0; i < _chartData.lines.size(); i++) {
const auto &dataLine = _chartData.lines[i];
auto textLine = Line();
@@ -341,8 +347,10 @@ void PointDetailsWidget::setXIndex(int xIndex) {
copy.valueColor = QColor(dataLine.color);
copy.name.setText(
_textStyle,
tr::lng_channel_earn_chart_overriden_detail_currency(
tr::now));
(isCredits
? tr::lng_channel_earn_chart_overriden_detail_credits
: tr::lng_channel_earn_chart_overriden_detail_currency)(
tr::now));
copy.value.setText(
_textStyle,
Lang::FormatExactCountDecimal(