CatStation/Content.Client/Info/DevInfoBanner.cs
SlamBamActionman 33f899f656
Add a Report Bugs button to the escape menu (#45807)
* Initial commit

* refactor: cleanup of related code

---------

Co-authored-by: Fildrance <fildrance@gmail.com>
2026-09-03 11:03:46 +00:00

34 lines
1.2 KiB
C#

using Content.Client.Credits;
using Content.Shared.CCVar;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Configuration;
namespace Content.Client.Info
{
public sealed class DevInfoBanner : BoxContainer
{
public DevInfoBanner() {
var buttons = new BoxContainer
{
Orientation = LayoutOrientation.Horizontal
};
AddChild(buttons);
var uriOpener = IoCManager.Resolve<IUriOpener>();
var cfg = IoCManager.Resolve<IConfigurationManager>();
var bugReport = cfg.GetCVar(CCVars.InfoLinksBugReport);
if (!string.IsNullOrWhiteSpace(bugReport))
{
var reportButton = new Button {Text = Loc.GetString("server-info-report-button")};
reportButton.OnPressed += _ => uriOpener.OpenUri(bugReport);
buttons.AddChild(reportButton);
}
var creditsButton = new Button {Text = Loc.GetString("server-info-credits-button")};
creditsButton.OnPressed += _ => new CreditsWindow().Open();
buttons.AddChild(creditsButton);
}
}
}