Add tooltips to artifact analyzer UI (#27393)

Add tooltips to indicate why "Extract" button is disabled.

Co-authored-by: Eoin Mcloughlin <helloworld@eoinrul.es>
(cherry picked from commit b8a8d6f8fc8e0c1d83998c07a3265108d49de615)
This commit is contained in:
eoineoineoin 2024-04-27 11:25:02 +01:00 committed by null
parent 4a7b91ccd8
commit 6b2fd62ee7
No known key found for this signature in database
GPG Key ID: 212F05528FD678BE
2 changed files with 33 additions and 3 deletions

View File

@ -78,17 +78,44 @@ public sealed partial class AnalysisConsoleMenu : FancyWindow
else
UpBiasButton.Pressed = true;
var disabled = !state.ServerConnected || !state.CanScan || state.PointAmount <= 0;
ExtractButton.Disabled = false;
if (!state.ServerConnected)
{
ExtractButton.Disabled = true;
ExtractButton.ToolTip = Loc.GetString("analysis-console-no-server-connected");
}
else if (!state.CanScan)
{
ExtractButton.Disabled = true;
ExtractButton.Disabled = disabled;
// CanScan can be false if either there's no analyzer connected or if there's
// no entity on the scanner. The `Information` text will always tell the user
// of the former case, but in the latter, it'll only show a message if a scan
// has never been performed, so add a tooltip to indicate that the artifact
// is gone.
if (state.AnalyzerConnected)
{
ExtractButton.ToolTip = Loc.GetString("analysis-console-no-artifact-placed");
}
else
{
ExtractButton.ToolTip = null;
}
}
else if (state.PointAmount <= 0)
{
ExtractButton.Disabled = true;
ExtractButton.ToolTip = Loc.GetString("analysis-console-no-points-to-extract");
}
if (disabled)
if (ExtractButton.Disabled)
{
ExtractButton.RemoveStyleClass("ButtonColorGreen");
}
else
{
ExtractButton.AddStyleClass("ButtonColorGreen");
ExtractButton.ToolTip = null;
}
}
private void UpdateArtifactIcon(EntityUid? uid)

View File

@ -30,6 +30,9 @@ analysis-console-progress-text = {$seconds ->
[one] T-{$seconds} second
*[other] T-{$seconds} seconds
}
analysis-console-no-server-connected = Cannot extract. No server connected.
analysis-console-no-artifact-placed = No artifact on scanner.
analysis-console-no-points-to-extract = No points to extract.
analyzer-artifact-component-upgrade-analysis = analysis duration