From 9e8bad00840d3c948fe531817c8f539b468f3431 Mon Sep 17 00:00:00 2001 From: undergroundwires Date: Mon, 14 Oct 2024 13:03:44 +0200 Subject: [PATCH] Fix browser instructions appearing on desktop Previously, the app showed browser download/run instructions on the desktop version, which was irrelevant for desktop users. This change improves the user experience by displaying these instructions only in browser environments. This change streamlines the script saving process for desktop users while maintaining the necessary guidance for browser users. The commit: - Prevents the instruction modal from appearing on desktop - Renames components for clarity (e.g., 'RunInstructions' to 'BrowserRunInstructions') - Adds a check to ensure browser environment before showing instructions --- .../BrowserRunInstructions.vue} | 9 +++++++++ .../Help/InfoTooltipInline.vue | 0 .../Help/InfoTooltipWrapper.vue | 0 .../Steps/CopyableCommand.vue | 0 .../Steps/InstructionStep.vue | 0 .../Steps/InstructionSteps.vue | 0 .../Steps/PlatformInstructionSteps.vue | 0 .../Steps/Platforms/LinuxInstructions.vue | 0 .../Steps/Platforms/MacOsInstructions.vue | 0 .../Steps/Platforms/WindowsInstructions.vue | 0 .../Code/CodeButtons/Save/CodeSaveButton.vue | 13 +++++++++---- .../RunInstructions/Steps/CopyableCommand.spec.ts | 2 +- .../Steps/PlatformInstructionSteps.spec.ts | 8 ++++---- 13 files changed, 23 insertions(+), 9 deletions(-) rename src/presentation/components/Code/CodeButtons/Save/{RunInstructions/RunInstructions.vue => BrowserRunInstructions/BrowserRunInstructions.vue} (88%) rename src/presentation/components/Code/CodeButtons/Save/{RunInstructions => BrowserRunInstructions}/Help/InfoTooltipInline.vue (100%) rename src/presentation/components/Code/CodeButtons/Save/{RunInstructions => BrowserRunInstructions}/Help/InfoTooltipWrapper.vue (100%) rename src/presentation/components/Code/CodeButtons/Save/{RunInstructions => BrowserRunInstructions}/Steps/CopyableCommand.vue (100%) rename src/presentation/components/Code/CodeButtons/Save/{RunInstructions => BrowserRunInstructions}/Steps/InstructionStep.vue (100%) rename src/presentation/components/Code/CodeButtons/Save/{RunInstructions => BrowserRunInstructions}/Steps/InstructionSteps.vue (100%) rename src/presentation/components/Code/CodeButtons/Save/{RunInstructions => BrowserRunInstructions}/Steps/PlatformInstructionSteps.vue (100%) rename src/presentation/components/Code/CodeButtons/Save/{RunInstructions => BrowserRunInstructions}/Steps/Platforms/LinuxInstructions.vue (100%) rename src/presentation/components/Code/CodeButtons/Save/{RunInstructions => BrowserRunInstructions}/Steps/Platforms/MacOsInstructions.vue (100%) rename src/presentation/components/Code/CodeButtons/Save/{RunInstructions => BrowserRunInstructions}/Steps/Platforms/WindowsInstructions.vue (100%) diff --git a/src/presentation/components/Code/CodeButtons/Save/RunInstructions/RunInstructions.vue b/src/presentation/components/Code/CodeButtons/Save/BrowserRunInstructions/BrowserRunInstructions.vue similarity index 88% rename from src/presentation/components/Code/CodeButtons/Save/RunInstructions/RunInstructions.vue rename to src/presentation/components/Code/CodeButtons/Save/BrowserRunInstructions/BrowserRunInstructions.vue index 8ab15a672..b6d025a18 100644 --- a/src/presentation/components/Code/CodeButtons/Save/RunInstructions/RunInstructions.vue +++ b/src/presentation/components/Code/CodeButtons/Save/BrowserRunInstructions/BrowserRunInstructions.vue @@ -47,6 +47,8 @@ export default defineComponent({ }, }, setup() { + ensureBrowserEnvironment(); + const { currentState } = injectKey((keys) => keys.useCollectionState); const { projectDetails } = injectKey((keys) => keys.useApplication); @@ -70,6 +72,13 @@ export default defineComponent({ }; }, }); + +function ensureBrowserEnvironment(): void { + const { isRunningAsDesktopApplication } = injectKey((keys) => keys.useRuntimeEnvironment); + if (isRunningAsDesktopApplication) { + throw new Error('Not applicable in desktop environments'); + } +}