diff --git a/Telegram/Resources/icons/mini_replace.svg b/Telegram/Resources/icons/mini_replace.svg
new file mode 100644
index 0000000000..86d68953e6
--- /dev/null
+++ b/Telegram/Resources/icons/mini_replace.svg
@@ -0,0 +1,7 @@
+
+
\ No newline at end of file
diff --git a/Telegram/SourceFiles/boxes/star_gift_craft_box.cpp b/Telegram/SourceFiles/boxes/star_gift_craft_box.cpp
index 995761bd3a..0b9c5f5867 100644
--- a/Telegram/SourceFiles/boxes/star_gift_craft_box.cpp
+++ b/Telegram/SourceFiles/boxes/star_gift_craft_box.cpp
@@ -292,13 +292,12 @@ AbstractButton *MakeRemoveButton(
int size,
const GiftForCraft &gift,
Fn onClick,
- rpl::producer edgeColor) {
+ rpl::producer edgeColor,
+ const style::icon &icon) {
auto remove = object_ptr(parent);
- const auto &icon = st::stickerPanDeleteIconFg;
const auto add = (size - icon.width()) / 2;
remove->resize(icon.size() + QSize(add, add) * 2);
- remove->paintOn([=](QPainter &p) {
- const auto &icon = st::stickerPanDeleteIconFg;
+ remove->paintOn([=, &icon](QPainter &p) {
icon.paint(p, add, add, add * 2 + icon.width(), st::white->c);
});
remove->setAttribute(Qt::WA_TransparentForMouseEvents);
@@ -419,19 +418,32 @@ AbstractButton *MakeRemoveButton(
nullptr,
&Entry::button);
const auto canRemove = (count > 1);
+ const auto secondHasAddress = state->entries[1].gift
+ && !state->entries[1].gift.unique->giftAddress.isEmpty();
for (auto i = 0; i != 4; ++i) {
auto &entry = state->entries[i];
if (entry.button) {
- if (!canRemove) {
- delete base::take(entry.remove);
- } else if (!entry.remove) {
+ delete base::take(entry.remove);
+ if (canRemove) {
+ const auto needReplace = (i == 0) && secondHasAddress;
+ const auto callback = [=] {
+ if (needReplace) {
+ state->editRequests.fire_copy(0);
+ } else {
+ state->removeRequests.fire_copy(i);
+ }
+ };
+ const auto &icon = needReplace
+ ? st::craftReplaceIcon
+ : st::stickerPanDeleteIconFg;
entry.remove = MakeRemoveButton(
raw,
entry.button,
entry.percent->height(),
entry.gift,
- [=] { state->removeRequests.fire_copy(i); },
- state->edgeColor.value());
+ callback,
+ state->edgeColor.value(),
+ icon);
}
}
}
diff --git a/Telegram/SourceFiles/ui/effects/credits.style b/Telegram/SourceFiles/ui/effects/credits.style
index 597b8e1645..e6ae07cf41 100644
--- a/Telegram/SourceFiles/ui/effects/credits.style
+++ b/Telegram/SourceFiles/ui/effects/credits.style
@@ -624,6 +624,7 @@ craftPattern: IconEmoji {
padding: margins(0px, 0px, 0px, 0px);
}
craftAddIcon: icon {{ "settings/plus", windowFgActive }};
+craftReplaceIcon: icon {{ "mini_replace-12x12", windowFgActive }};
craftPreviewPadding: margins(24px, 8px, 40px, 8px);
craftBoxButtonPadding: margins(22px, 12px, 22px, 22px);
craftAttributesMargin: margins(22px, 12px, 22px, 16px);