Added icon and name of topic to deletion confirmation box.

This commit is contained in:
23rd 2024-08-18 21:20:01 +03:00
parent 71f83b5993
commit c03fcf9a23

View file

@ -45,6 +45,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/menu/menu_add_action_callback_factory.h"
#include "ui/layers/generic_box.h"
#include "ui/delayed_activation.h"
#include "ui/vertical_list.h"
#include "main/main_session.h"
#include "main/main_session_settings.h"
#include "menu/menu_mute.h"
@ -68,6 +69,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/info_memento.h"
#include "info/channel_statistics/boosts/info_boosts_widget.h"
#include "info/channel_statistics/earn/info_channel_earn_widget.h"
#include "info/profile/info_profile_cover.h"
#include "info/profile/info_profile_values.h"
#include "info/statistics/info_statistics_widget.h"
#include "info/stories/info_stories_widget.h"
@ -1563,11 +1565,28 @@ void PeerMenuDeleteTopicWithConfirmation(
PeerMenuDeleteTopic(navigation, strong);
}
};
navigation->parentController()->show(Ui::MakeConfirmBox({
.text = tr::lng_forum_topic_delete_sure(tr::now),
.confirmed = callback,
.confirmText = tr::lng_box_delete(),
.confirmStyle = &st::attentionBoxButton,
const auto controller = navigation->parentController();
controller->show(Box([=](not_null<Ui::GenericBox*> box) {
Ui::AddSkip(box->verticalLayout());
Ui::IconWithTitle(
box->verticalLayout(),
Ui::CreateChild<Info::Profile::TopicIconButton>(
box,
controller,
topic),
Ui::CreateChild<Ui::FlatLabel>(
box,
topic->title(),
box->getDelegate()->style().title));
Ui::AddSkip(box->verticalLayout());
Ui::AddSkip(box->verticalLayout());
Ui::ConfirmBox(box, {
.text = tr::lng_forum_topic_delete_sure(tr::now),
.confirmed = callback,
.confirmText = tr::lng_box_delete(),
.confirmStyle = &st::attentionBoxButton,
.labelPadding = st::boxRowPadding,
});
}));
}