]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add tooltips to artifact analyzer UI (#27393)
authoreoineoineoin <github@eoinrul.es>
Sat, 27 Apr 2024 10:25:02 +0000 (11:25 +0100)
committerGitHub <noreply@github.com>
Sat, 27 Apr 2024 10:25:02 +0000 (20:25 +1000)
Add tooltips to indicate why "Extract" button is disabled.

Co-authored-by: Eoin Mcloughlin <helloworld@eoinrul.es>
Content.Client/Xenoarchaeology/Ui/AnalysisConsoleMenu.xaml.cs
Resources/Locale/en-US/xenoarchaeology/artifact-analyzer.ftl

index 59cf34944c890060f1b68daca120c08f06ed1783..2890bb3dbf7fc58fd518fec2917ce0df5340ad68 100644 (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 = disabled;
+        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;
+
+            // 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)
index 672d80ed31d86e1e7844dba5f3dc034161581536..35dd42167f63cd483c4d5934a447b99e054bb30a 100644 (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