mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-14 19:29:53 +01:00
* Commit * add the form post * dv * fixes * Change wording * Address review * wording change * Added some stuff * New format * bruh * thanks perry! * yes * More fixes! * typo * Add a command to show the list, improve the UI slightly, split up command names * Fix UI controller * Add better comment * Get rid of weird recursive thing * Cleanup * Work on moving feedback popups out of simulation * Move round end screen subscription to feedback ui controller * Finish moving feedback popups out of simulation * Fix _ as parameter * Clean up FeedbackPopupUIController * Clean up commands * Fix prototype yaml * Fix openfeedbackpopup command description * Update Resources/Locale/en-US/feedbackpopup/feedbackpopup.ftl Co-authored-by: Simon <63975668+Simyon264@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Simon <63975668+Simyon264@users.noreply.github.com> * Address reviews * Address reviews * Fix FeedbackPopupPrototype.cs using empty string instead of string.empty * Address some more of the reviews, style nano is still trolling sadly * Fix feedback popup styling * Fix PopupPrototype ID field not having a setter * Address reviews * Add label when no feedback entries are present Change link button to not show when no link is set --------- Co-authored-by: beck-thompson <beck314159@hotmail.com> Co-authored-by: SlamBamActionman <slambamactionman@gmail.com> Co-authored-by: Simon <63975668+Simyon264@users.noreply.github.com>
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using Content.Shared.FeedbackSystem;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.FeedbackPopup;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class FeedbackEntry : Control
|
|
{
|
|
private readonly IUriOpener _uri;
|
|
|
|
private readonly FeedbackPopupPrototype? _prototype;
|
|
|
|
public FeedbackEntry(ProtoId<FeedbackPopupPrototype> popupProto, IPrototypeManager proto, IUriOpener uri)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
_uri = uri;
|
|
|
|
_prototype = proto.Index(popupProto);
|
|
|
|
// Title
|
|
TitleLabel.Text = _prototype.Title;
|
|
DescriptionLabel.Text = _prototype.Description;
|
|
TypeLabel.Text = _prototype.ResponseType;
|
|
|
|
LinkButton.Visible = !string.IsNullOrEmpty(_prototype.ResponseLink);
|
|
|
|
// link button
|
|
if (!string.IsNullOrEmpty(_prototype.ResponseLink))
|
|
{
|
|
LinkButton.OnPressed += OnButtonPressed;
|
|
}
|
|
}
|
|
|
|
private void OnButtonPressed(BaseButton.ButtonEventArgs args)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(_prototype?.ResponseLink))
|
|
_uri.OpenUri(_prototype.ResponseLink);
|
|
}
|
|
|
|
protected override void Resized()
|
|
{
|
|
base.Resized();
|
|
// magic
|
|
TitleLabel.SetWidth = Width - TitleLabel.Margin.SumHorizontal;
|
|
TitleLabel.InvalidateArrange();
|
|
DescriptionLabel.SetWidth = Width - DescriptionLabel.Margin.SumHorizontal;
|
|
DescriptionLabel.InvalidateArrange();
|
|
}
|
|
}
|
|
|