diff --git a/.gitignore b/.gitignore index c43054ae..fe043c58 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,11 @@ dist *.syso - .DS_Store +# Specifically allow the provided code workspace with the multi-root workaround +!.vscode/SatisfactoryModManager.code-workspace + # Created by https://www.toptal.com/developers/gitignore/api/goland+all,go,visualstudiocode # Edit at https://www.toptal.com/developers/gitignore?templates=goland+all,go,visualstudiocode diff --git a/.vscode/SatisfactoryModManager.code-workspace b/.vscode/SatisfactoryModManager.code-workspace new file mode 100644 index 00000000..65642eb4 --- /dev/null +++ b/.vscode/SatisfactoryModManager.code-workspace @@ -0,0 +1,35 @@ +{ + // Needed for vscode ESLint to work + // https://stackoverflow.com/questions/47405315/visual-studio-code-and-subfolder-specific-settings + "folders": [ + { + "name": "root", + "path": "../." + }, + { + "path": "../frontend" + }, + { + "path": "../backend" + } + ], + "settings": { + "files.exclude": { + "**/.git": true, + "backend": true, + "frontend": true + }, + }, + "extensions": { + "recommendations": [ + "svelte.svelte-vscode", + "streetsidesoftware.code-spell-checker", + "dbaeumer.vscode-eslint", + "davidanson.vscode-markdownlint", + "herrmannplatz.npm-dependency-links", + "medo64.render-crlf", + "redhat.vscode-yaml", + "golang.go" + ] + } +} \ No newline at end of file diff --git a/README.md b/README.md index 255ba486..c07c357c 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,14 @@ Although `wails dev` should run these commands for you under normal circumstance you may need to run `pnpm graphql-codegen` in the `frontend` directory to update the code generated from the SMR API, or run `pnpm translations` to update the translation data. +### IDE Configuration + +Make sure that your IDE is connecting with the frontend's installation of ESLint to get the best experience. + +VSCode users, a preconfigured workspace is provided in `.vscode/` +that allows editing both Go and Svelte files +while maintaining correct ESLint functionality. + ### Building ```bash @@ -86,6 +94,12 @@ Then, to run it, use: golangci-lint run --fix ``` +You may also need to manually run the frontend linter. First, navigate to the `frontend` directory, then run: + +```bash +pnpm run format +``` + ### Localization If you'd like to help translate and localize SMM to different languages, join our [discord server](https://discord.ficsit.app/). diff --git a/backend/app/debug_info.go b/backend/app/debug_info.go index bef87e94..f0786541 100644 --- a/backend/app/debug_info.go +++ b/backend/app/debug_info.go @@ -204,7 +204,7 @@ func (a *app) generateAndSaveDebugInfo(filename string) error { return nil } -func (a *app) GenerateDebugInfo() bool { +func (a *app) GenerateDebugInfo() (bool, error) { defaultFileName := fmt.Sprintf("SMMDebug-%s.zip", time.Now().UTC().Format("2006-01-02-15-04-05")) filename, err := wailsRuntime.SaveFileDialog(appCommon.AppContext, wailsRuntime.SaveDialogOptions{ DefaultFilename: defaultFileName, @@ -216,18 +216,17 @@ func (a *app) GenerateDebugInfo() bool { }, }) if err != nil { - slog.Error("failed to open save dialog", slog.Any("error", err)) - return false + return false, fmt.Errorf("failed to open save dialog: %w", err) } if filename == "" { - return false + // user canceled the save dialog + return false, nil } err = a.generateAndSaveDebugInfo(filename) if err != nil { - slog.Error("failed to generate debug info", slog.Any("error", err)) - return false + return false, fmt.Errorf("failed to generate debug info: %w", err) } - return true + return true, nil } diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index a4879080..332c3e79 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -6,10 +6,11 @@ import { DevTools, FormatSimple, Tolgee, TolgeeProvider } from '@tolgee/svelte'; import { setContextClient } from '@urql/svelte'; - import T, { translationElementPart } from '$lib/components/T.svelte'; + import T from '$lib/components/T.svelte'; import TitleBar from '$lib/components/TitleBar.svelte'; import LeftBar from '$lib/components/left-bar/LeftBar.svelte'; import ModDetails from '$lib/components/mod-details/ModDetails.svelte'; + import ErrorDetails from '$lib/components/modals/ErrorDetails.svelte'; import ErrorModal from '$lib/components/modals/ErrorModal.svelte'; import ExternalInstallMod from '$lib/components/modals/ExternalInstallMod.svelte'; import { supportedProgressTypes } from '$lib/components/modals/ProgressModal.svelte'; @@ -24,7 +25,7 @@ import { error, expandedMod, siteURL } from '$lib/store/generalStore'; import { konami, language, updateCheckMode } from '$lib/store/settingsStore'; import { smmUpdate, smmUpdateReady } from '$lib/store/smmUpdateStore'; - import { ExpandMod, GenerateDebugInfo, UnexpandMod } from '$wailsjs/go/app/app'; + import { ExpandMod, UnexpandMod } from '$wailsjs/go/app/app'; import { Environment, EventsOn } from '$wailsjs/runtime'; initializeStores(); @@ -235,34 +236,24 @@ focusOnEntry.focus(); }}>
-
- {#if noInstallsError} - - {:else} - - {/if} -
-
-

- -

-
- + + + {#if noInstallsError} + + {:else} + + {/if} + +
diff --git a/frontend/src/lib/components/left-bar/LeftBar.svelte b/frontend/src/lib/components/left-bar/LeftBar.svelte index fd15d804..c46efd46 100644 --- a/frontend/src/lib/components/left-bar/LeftBar.svelte +++ b/frontend/src/lib/components/left-bar/LeftBar.svelte @@ -378,7 +378,7 @@ + + + {openDiscordTooltipText} + +

+ +{#if debugFileGenerationError} +
+

+ +

+
+
+ +
+{/if} +{#if !fullPageMode} + +{/if} diff --git a/frontend/src/lib/components/modals/ErrorModal.svelte b/frontend/src/lib/components/modals/ErrorModal.svelte index c0776f19..bf5888c5 100644 --- a/frontend/src/lib/components/modals/ErrorModal.svelte +++ b/frontend/src/lib/components/modals/ErrorModal.svelte @@ -1,41 +1,18 @@ -
-
- -
-
-

{error}

-
-
- -
- +
+ + +
diff --git a/frontend/src/lib/components/mods-list/ModsListItem.svelte b/frontend/src/lib/components/mods-list/ModsListItem.svelte index 7a385ca5..b81b5efb 100644 --- a/frontend/src/lib/components/mods-list/ModsListItem.svelte +++ b/frontend/src/lib/components/mods-list/ModsListItem.svelte @@ -74,7 +74,7 @@ return { icon: mdiLinkLock, iconHover: mdiLinkLock, - tooltip: $t('mod-list-item.dependency', 'This mod is installed a dependency of another mod. It cannot be installed or removed on its own.'), + tooltip: $t('mod-list-item.dependency', 'This mod is installed as a dependency of another mod. It cannot be installed or removed on its own.'), }; } if (queuedInstall) {