From a4b0bef12c030b7c3b02b696c582da3d44f86daa Mon Sep 17 00:00:00 2001 From: Milon Date: Sat, 17 Aug 2024 18:05:17 +0200 Subject: [PATCH] add confirmation to the delete button in objects tab (#30946) ui shitcode --- .../UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml.cs b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml.cs index 29774bb587..ee5d3701f5 100644 --- a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTabEntry.xaml.cs @@ -1,4 +1,4 @@ -using Content.Client.Administration.Managers; +using Content.Client.Administration.Managers; using Robust.Client.AutoGenerated; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; @@ -13,6 +13,7 @@ public sealed partial class ObjectsTabEntry : PanelContainer public Action? OnTeleport; public Action? OnDelete; + private readonly Dictionary _confirmations = new(); public ObjectsTabEntry(IClientAdminManager manager, string name, NetEntity nent, StyleBox styleBox) { @@ -27,6 +28,13 @@ public sealed partial class ObjectsTabEntry : PanelContainer DeleteButton.Disabled = !manager.CanCommand("delete"); TeleportButton.OnPressed += _ => OnTeleport?.Invoke(nent); - DeleteButton.OnPressed += _ => OnDelete?.Invoke(nent); + DeleteButton.OnPressed += _ => + { + if (!AdminUIHelpers.TryConfirm(DeleteButton, _confirmations)) + { + return; + } + OnDelete?.Invoke(nent); + }; } }