CatStation/Content.Client/Administration/UI/EventLog/AdminEventLogEui.cs
Samuka e020c43454
Event log tool (#44655)
* button to new ui

* text box and button

* change size

* get the current round

* turn into a command

* fix round id not updating

* button to send log send message to server

* send message to discord

* use another cvar

* general fixes

* update event webhook

* use a place holder

* fix placeholder

* update button name

Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>

* move to a separate folder

* turn into a fancy window

* add margin

* center text in the button

* move reset button to the left

* update the window

* move send button to the left

* update color

* remove indentation

* set sawmill inside PostInject

* remove random newline

* move PostInject to start of the class

* use darkViolet

* summary

* remove whitespace

* comment

---------

Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
2026-07-14 23:45:40 +00:00

63 lines
1.6 KiB
C#

using Content.Client.Eui;
using Content.Shared.Administration.AdminEventLog;
using Content.Shared.Eui;
using JetBrains.Annotations;
using Robust.Client.Player;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BaseButton;
namespace Content.Client.Administration.UI.EventLog;
[UsedImplicitly]
public sealed partial class AdminEventLogEui : BaseEui
{
[Dependency] private IPlayerManager _playerManager = default!;
private AdminEventLogWindow EventLogWindow { get; }
public AdminEventLogEui()
{
EventLogWindow = new AdminEventLogWindow();
EventLogWindow.SendEventLog.OnPressed += OnSendEventLogPressed;
}
public override void Opened()
{
base.Opened();
EventLogWindow.OpenCentered();
}
public override void Closed()
{
base.Closed();
EventLogWindow.Close();
}
public override void HandleState(EuiStateBase state)
{
var s = (AdminEventLogEuiState)state;
EventLogWindow.SetCurrentRound(s.RoundId);
EventLogWindow.SetRoundSpinBox(s.RoundId);
}
private void OnSendEventLogPressed(ButtonEventArgs args)
{
var eventText = Rope.Collapse(EventLogWindow.EventTextEdit.TextRope).TrimStart();
if (string.IsNullOrEmpty(eventText))
return;
var message = new AdminEventLogEuiMsg(
EventLogWindow.RoundSpinBox.Value,
_playerManager.LocalSession!.Name,
eventText);
SendMessage(message);
// close window to avoid admin accidentally spamming event logs
EventLogWindow.Close();
}
}