Skip to content

Commit

Permalink
pro review
Browse files Browse the repository at this point in the history
  • Loading branch information
beck-thompson committed Jan 28, 2025
1 parent 7baaeec commit fcffbf8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 33 deletions.
10 changes: 5 additions & 5 deletions Content.Client/_DV/FeedbackPopup/FeedbackPopupWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<RichTextLabel HorizontalAlignment="Center" Name="TitleLabel" Margin="0 0 0 20"></RichTextLabel>
<BoxContainer Name="SectionContainer" Orientation="Vertical"></BoxContainer>
<BoxContainer Orientation="Vertical" Name="FeedbackReplyContainer" Visible="False">
<Label HorizontalAlignment="Center" Text="{Loc 'feedbackpopup-text-box-above'}"></Label>
<TextEdit Name="FeedbackReply" MaxHeight="200" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" MinHeight="100" />
<Label HorizontalAlignment="Center" Text="{Loc 'feedbackpopup-text-box-below'}"></Label>
<Button Name="SubmitButton" Text="{Loc 'feedbackpopup-submit-feedback-button'}"></Button>
<Label HorizontalAlignment="Center" Text="{Loc 'feedbackpopup-disclaimer'}" StyleClasses="LabelSmall"></Label>
<Label HorizontalAlignment="Center" Text="{Loc 'feedbackpopup-text-box-above'}"/>
<TextEdit Name="FeedbackReply" MaxHeight="200" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" MinHeight="100"/>
<Label HorizontalAlignment="Center" Text="{Loc 'feedbackpopup-text-box-below'}"/>
<controls:ConfirmButton Name="SubmitButton" ConfirmationText="{Loc 'feedbackpopup-submit-feedback-button-confirm'}" Text="{Loc 'feedbackpopup-submit-feedback-button'}" />
<Label HorizontalAlignment="Center" Text="{Loc 'feedbackpopup-disclaimer'}" StyleClasses="LabelSmall"/>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>
29 changes: 1 addition & 28 deletions Content.Client/_DV/FeedbackPopup/FeedbackPopupWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ namespace Content.Client._DV.FeedbackPopup;
public sealed partial class FeedbackPopupWindow : FancyWindow
{
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;

private readonly FeedbackPopupPrototype _feedbackpopup;

private TimeSpan? _resetSubmitButtonTime;

public event Action<(LocId, string)>? OnSubmitted;

public FeedbackPopupWindow(ProtoId<FeedbackPopupPrototype> popupProto)
Expand Down Expand Up @@ -60,35 +57,11 @@ private void CreateSection(string text)

private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs args)
{
// Don't do anything if they haven't written anything.
// If they haven't written anything, ignore it.
if (string.IsNullOrWhiteSpace(Rope.Collapse(FeedbackReply.TextRope)))
return;

// First time the button has been clicked
if (_resetSubmitButtonTime == null || _resetSubmitButtonTime < _gameTiming.RealTime)
{
SubmitButton.Text = Loc.GetString("feedbackpopup-submit-feedback-button-confirm");
SubmitButton.ModulateSelfOverride = Color.Red;
_resetSubmitButtonTime = _gameTiming.RealTime + TimeSpan.FromSeconds(2);
return;
}

// Button has been clicked inside the confirmation time.
OnSubmitted?.Invoke((_feedbackpopup.PopupName, Rope.Collapse(FeedbackReply.TextRope)));
}

protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);

if (_resetSubmitButtonTime < _gameTiming.RealTime)
ResetSubmitButton();
}

private void ResetSubmitButton()
{
SubmitButton.Text = Loc.GetString("feedbackpopup-submit-feedback-button");
SubmitButton.ModulateSelfOverride = null;
}
}

0 comments on commit fcffbf8

Please sign in to comment.