Add icons to suggestion buttons.

This commit is contained in:
John Preston 2025-06-27 13:23:14 +04:00
parent 344d47e7dd
commit 141fb875f9
5 changed files with 46 additions and 4 deletions

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icon / Filled / paid_approve</title>
<g id="Icon-/-Filled-/-paid_approve" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M12,4.5 C16.14,4.5 19.5,7.86 19.5,12 C19.5,16.14 16.14,19.5 12,19.5 C7.86,19.5 4.5,16.14 4.5,12 C4.5,7.86 7.86,4.5 12,4.5 Z M15.7577636,9.89127556 C15.4992394,9.62810439 15.0763217,9.62433727 14.8131506,9.88286145 L10.7479688,13.8761719 L9.18684944,12.3424898 C8.92367827,12.0839656 8.50076063,12.0877327 8.24223645,12.3509039 C7.98371227,12.6140751 7.98747939,13.0369927 8.25065056,13.2955169 L10.204967,15.2153247 C10.5064723,15.5115061 10.9896874,15.5115061 11.2911927,15.2153247 L15.7493494,10.8358886 C16.0125206,10.5773644 16.0162877,10.1544467 15.7577636,9.89127556 Z" id="Shape" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 999 B

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icon / Filled / paid_decline</title>
<g id="Icon-/-Filled-/-paid_decline" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M12,4.5 C16.1421356,4.5 19.5,7.85786438 19.5,12 C19.5,16.1421356 16.1421356,19.5 12,19.5 C7.85786438,19.5 4.5,16.1421356 4.5,12 C4.5,7.85786438 7.85786438,4.5 12,4.5 Z M9.73375908,8.63964245 C9.43162712,8.33751049 8.94177442,8.33751049 8.63964245,8.63964245 L8.59853606,8.68404063 C8.33819559,8.98800138 8.35189772,9.44601435 8.63964245,9.73375908 L10.9059783,12 L8.63964245,14.2662409 C8.33751049,14.5683729 8.33751049,15.0582256 8.63964245,15.3603575 L8.68404063,15.4014639 C8.98800138,15.6618044 9.44601435,15.6481023 9.73375908,15.3603575 L12,13.0936701 L14.2662409,15.3603575 C14.5683729,15.6624895 15.0582256,15.6624895 15.3603575,15.3603575 L15.4014639,15.3159594 C15.6618044,15.0119986 15.6481023,14.5539856 15.3603575,14.2662409 L13.0936701,12 L15.3603575,9.73375908 C15.6624895,9.43162712 15.6624895,8.94177442 15.3603575,8.63964245 L15.3159594,8.59853606 C15.0119986,8.33819559 14.5539856,8.35189772 14.2662409,8.63964245 L12,10.9059783 L9.73375908,8.63964245 Z" id="Shape" fill="#FFFFFF"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icon / Filled / paid_edit</title>
<g id="Icon-/-Filled-/-paid_edit" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M13.5029106,7.64699152 C13.6056531,7.5472623 13.7697888,7.549705 13.869518,7.65244745 L16.2610253,10.1162122 C16.3593492,10.2175069 16.3585592,10.3788499 16.259248,10.4791768 L7.97687653,18.8462593 C7.87948817,18.9446437 7.74680196,19 7.6083679,19 L5.51851849,19 C5.23214864,19 5,18.7678513 5,18.4814815 L5,16.3683223 C5,16.2308422 5.05459809,16.0989896 5.15178971,16.0017551 L13.5029106,7.64699152 Z M16.0299869,5.19856593 C16.3408365,4.91998643 16.8161619,4.93645109 17.1069903,5.23587194 L18.7801411,6.95845528 C19.073802,7.26079221 19.0732123,7.74202152 18.7788114,8.04363789 L17.6449122,9.20518682 C17.5421105,9.3048549 17.3779763,9.30231456 17.2783082,9.19951281 L14.8031149,6.64621027 C14.707554,6.53957983 14.7165277,6.3756714 14.8231582,6.28011055 L16.0299869,5.19856593 Z" id="Shape" fill="#FFFFFF"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -759,17 +759,26 @@ ReplyKeyboard::ReplyKeyboard(
for (auto j = 0; j != rowSize; ++j) {
auto button = Button();
using Type = HistoryMessageMarkupButton::Type;
const auto isBuy = (row[j].type == Type::Buy);
static const auto RegExp = QRegularExpression("\\b"
+ Ui::kCreditsCurrency
+ "\\b");
const auto text = isBuy
const auto type = row[j].type;
const auto text = (type == Type::Buy)
? base::duplicate(row[j].text).replace(
RegExp,
QChar(0x2B50))
: row[j].text;
const auto withEmoji = [&](const style::IconEmoji &icon) {
return Ui::Text::IconEmoji(&icon).append(text);
};
const auto textWithEntities = [&] {
if (!isBuy) {
if (type == Type::SuggestAccept) {
return withEmoji(st::chatSuggestAcceptIcon);
} else if (type == Type::SuggestDecline) {
return withEmoji(st::chatSuggestDeclineIcon);
} else if (type == Type::SuggestChange) {
return withEmoji(st::chatSuggestChangeIcon);
} else if (type != Type::Buy) {
return TextWithEntities();
}
auto result = TextWithEntities();
@ -785,7 +794,7 @@ ReplyKeyboard::ReplyKeyboard(
? TextWithEntities()
: result;
}();
button.type = row.at(j).type;
button.type = type;
button.link = std::make_shared<ReplyMarkupClickHandler>(
owner,
i,

View file

@ -1060,6 +1060,18 @@ chatSuggestInfoLastMargin: margins(16px, 4px, 16px, 16px);
chatSuggestTableMiddleMargin: margins(8px, 4px, 8px, 4px);
chatSuggestTableLastMargin: margins(8px, 4px, 8px, 16px);
chatSuggestInfoFullMargin: margins(16px, 16px, 16px, 16px);
chatSuggestAcceptIcon: IconEmoji {
icon: icon{{ "chat/paid_approve", windowFg }};
padding: margins(0px, -2px, 0px, 0px);
}
chatSuggestDeclineIcon: IconEmoji {
icon: icon{{ "chat/paid_decline", windowFg }};
padding: margins(0px, -2px, 0px, 0px);
}
chatSuggestChangeIcon: IconEmoji {
icon: icon{{ "chat/paid_edit", windowFg }};
padding: margins(0px, -2px, 0px, 0px);
}
premiumRequiredWidth: 186px;
premiumRequiredIcon: icon{{ "chat/large_lockedchat", msgServiceFg }};