Admin notes (#7259)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
DrSmugleaf
2022-04-16 20:57:50 +02:00
committed by GitHub
parent 0041b9d933
commit 5227d1a023
38 changed files with 4009 additions and 23 deletions

View File

@@ -0,0 +1,42 @@
using Content.Client.Eui;
using Content.Shared.Administration.Notes;
using Content.Shared.Eui;
using JetBrains.Annotations;
using static Content.Shared.Administration.Notes.AdminNoteEuiMsg;
namespace Content.Client.Administration.UI.Notes;
[UsedImplicitly]
public sealed class AdminNotesEui : BaseEui
{
public AdminNotesEui()
{
NoteWindow = new AdminNotesWindow();
NoteControl = NoteWindow.Notes;
NoteControl.OnNoteChanged += (id, text) => SendMessage(new EditNoteRequest(id, text));
NoteControl.OnNewNoteEntered += text => SendMessage(new CreateNoteRequest(text));
NoteControl.OnNoteDeleted += id => SendMessage(new DeleteNoteRequest(id));
}
private AdminNotesWindow NoteWindow { get; }
private AdminNotesControl NoteControl { get; }
public override void HandleState(EuiStateBase state)
{
if (state is not AdminNotesEuiState s)
{
return;
}
NoteWindow.SetTitlePlayer(s.NotedPlayerName);
NoteControl.SetNotes(s.Notes);
NoteControl.SetPermissions(s.CanCreate, s.CanDelete, s.CanEdit);
}
public override void Opened()
{
NoteWindow.OpenCentered();
}
}