Show quantity of issued unique gifts.

This commit is contained in:
John Preston 2025-01-31 13:38:04 +04:00
parent 1869071ef7
commit 1c8b165a64
2 changed files with 9 additions and 3 deletions

View file

@ -3326,6 +3326,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_gift_unique_backdrop" = "Backdrop";
"lng_gift_unique_symbol" = "Symbol";
"lng_gift_unique_rarity" = "Only {percent} of such collectibles have this attribute.";
"lng_gift_unique_availability_label" = "Quantity";
"lng_gift_unique_availability#one" = "{count} of {amount} issued";
"lng_gift_unique_availability#other" = "{count} of {amount} issued";
"lng_gift_unique_info" = "Gifted to {recipient} on {date}.";

View file

@ -1487,10 +1487,15 @@ void AddStarGiftTable(
auto amount = rpl::single(TextWithEntities{
Lang::FormatCountDecimal(entry.limitedCount)
});
const auto count = unique
? (entry.limitedCount - entry.limitedLeft)
: entry.limitedLeft;
AddTableRow(
table,
tr::lng_gift_availability(),
((!unique && !entry.limitedLeft)
(unique
? tr::lng_gift_unique_availability_label()
: tr::lng_gift_availability()),
((!unique && !count)
? tr::lng_gift_availability_none(
lt_amount,
std::move(amount),
@ -1499,7 +1504,7 @@ void AddStarGiftTable(
? tr::lng_gift_unique_availability
: tr::lng_gift_availability_left)(
lt_count_decimal,
rpl::single(entry.limitedLeft * 1.),
rpl::single(count * 1.),
lt_amount,
std::move(amount),
Ui::Text::WithEntities)));