CatStation/Content.Client/Administration/UI/EventLog/AdminEventLogWindow.xaml.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

58 lines
1.6 KiB
C#

using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BaseButton;
namespace Content.Client.Administration.UI.EventLog;
[GenerateTypedNameReferences]
public sealed partial class AdminEventLogWindow : FancyWindow
{
[Dependency] private ILocalizationManager _localization = default!;
public AdminEventLogWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
RoundSpinBox.IsValid = i => i > 0 && i <= CurrentRound;
RoundSpinBox.ValueChanged += RoundSpinBoxChanged;
RoundSpinBox.InitDefaultButtons();
EventTextEdit.Placeholder = new Rope.Leaf(_localization.GetString("admin-event-description-placeholder"));
ResetRoundButton.OnPressed += ResetRoundPressed;
}
private int CurrentRound { get; set; }
public void SetCurrentRound(int round)
{
CurrentRound = round;
ResetRoundButton.Text = Loc.GetString("admin-event-round-reset-with-id", ("id", round));
UpdateResetButton();
}
public void SetRoundSpinBox(int round)
{
RoundSpinBox.Value = round;
UpdateResetButton();
}
private void RoundSpinBoxChanged(ValueChangedEventArgs args)
{
UpdateResetButton();
}
private void ResetRoundPressed(ButtonEventArgs args)
{
RoundSpinBox.Value = CurrentRound;
}
private void UpdateResetButton()
{
ResetRoundButton.Disabled = RoundSpinBox.Value == CurrentRound;
}
}