Skip to content

Commit b751c20

Browse files
committed
Suggestions from code review
1 parent 3687f59 commit b751c20

File tree

4 files changed

+79
-57
lines changed

4 files changed

+79
-57
lines changed

backend/migration/migration.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ import (
1111
)
1212

1313
type migration struct {
14-
smm2Dir string
14+
smm2Dir string
15+
migrationSuccessMarkerPath string
1516
}
1617

1718
var Migration *migration
1819

1920
func Init() {
2021
if Migration == nil {
2122
Migration = &migration{}
22-
Migration.smm2Dir = filepath.Join(viper.GetString(("smm-local-dir")), "profiles")
23+
Migration.smm2Dir = filepath.Join(viper.GetString("smm-local-dir"), "profiles")
24+
Migration.migrationSuccessMarkerPath = filepath.Join(Migration.smm2Dir, migrationSuccessMarkerFile)
2325
}
2426
}
2527

@@ -39,13 +41,13 @@ func pathExists(path string) bool {
3941

4042
func (m *migration) NeedsSmm2Migration() bool {
4143
if pathExists(m.smm2Dir) {
42-
return !pathExists(m.smm2Dir + migrationSuccessMarkerFile)
44+
return !pathExists(Migration.migrationSuccessMarkerPath)
4345
}
4446
return false
4547
}
4648

4749
func (m *migration) MarkSmm2MigrationSuccess() error {
48-
file, err := os.Create(m.smm2Dir + migrationSuccessMarkerFile)
50+
file, err := os.Create(Migration.migrationSuccessMarkerPath)
4951
if err != nil {
5052
return fmt.Errorf("failed to create migration success marker file: %w", err)
5153
}

frontend/src/App.svelte

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,14 @@
147147
}
148148
}
149149
150-
cacheDir.subscribe((cacheDirectory) => {
151-
GetCacheDirDiskSpaceLeft().then((spaceLeftBytes) => {
152-
if (spaceLeftBytes < 10e9) {
153-
const spaceLeftGbReadable = (spaceLeftBytes * 1e-9).toFixed(1);
154-
$error = `The drive your cache directory is on (${cacheDirectory}) is very low on disk space (Only ~${spaceLeftGbReadable} GB left). Please free up some space or move the cache directory to another drive in the Mod Manager Settings.`;
155-
}
156-
}).catch((err) => {
157-
$error = `failed to check cache directory disk space left: ${err}`;
158-
});
150+
$: GetCacheDirDiskSpaceLeft().then((spaceLeftBytes) => {
151+
if (spaceLeftBytes < 10e9) {
152+
const spaceLeftGbReadable = (spaceLeftBytes * 1e-9).toFixed(1);
153+
$error = `The drive your cache directory is on (${$cacheDir}) is very low on disk space (Only ~${spaceLeftGbReadable} GB left). Please free up some space or move the cache directory to another drive in the Mod Manager Settings.`;
154+
}
155+
}).catch((err) => {
156+
$error = `failed to check cache directory disk space left: ${err}`;
159157
});
160-
161-
162158
$: if ($smmUpdateReady && $updateCheckMode === 'ask') {
163159
modalStore.trigger({
164160
type: 'component',

frontend/src/lib/components/modals/MigrationModal.svelte

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script lang="ts">
2+
import { mdiAlert, mdiPlus } from '@mdi/js';
23
import { T } from '@tolgee/svelte';
34
5+
import SvgIcon from '$lib/components/SVGIcon.svelte';
46
import { MarkSmm2MigrationSuccess } from '$wailsjs/go/migration/migration';
57
import { BrowserOpenURL } from '$wailsjs/runtime/runtime';
68
@@ -34,7 +36,7 @@
3436
<section class="px-4 overflow-y-auto">
3537
<ul class="list-dl list space-y-3">
3638
<li>
37-
<span class="badge bg-primary-800 text-lg">+</span>
39+
<span class="badge bg-primary-800 text-lg"><SvgIcon class="w-5 h-5 my-1" icon={mdiPlus} /></span>
3840
<span class="flex-auto text-lg">
3941
<T defaultValue="Dedicated server management" keyName="smm2_migration.feature.servers" />
4042
<p class="text-base">
@@ -43,7 +45,7 @@
4345
</span>
4446
</li>
4547
<li>
46-
<span class="badge bg-primary-800 text-lg">+</span>
48+
<span class="badge bg-primary-800 text-lg"><SvgIcon class="w-5 h-5 my-1" icon={mdiPlus} /></span>
4749
<span class="flex-auto text-lg">
4850
<T defaultValue="User interface refresh" keyName="smm2_migration.feature.ui" />
4951
<p class="text-base">
@@ -52,7 +54,7 @@
5254
</span>
5355
</li>
5456
<li>
55-
<span class="badge bg-primary-800 text-lg">+</span>
57+
<span class="badge bg-primary-800 text-lg"><SvgIcon class="w-5 h-5 my-1" icon={mdiPlus} /></span>
5658
<span class="flex-auto text-lg">
5759
<T defaultValue="Translation support" keyName="smm2_migration.feature.translation" />
5860
<p class="text-base">
@@ -61,7 +63,7 @@
6163
</span>
6264
</li>
6365
<li>
64-
<span class="badge bg-primary-800 text-lg">+</span>
66+
<span class="badge bg-primary-800 text-lg"><SvgIcon class="w-5 h-5 my-1" icon={mdiPlus} /></span>
6567
<span class="flex-auto text-lg">
6668
<T defaultValue="Action queueing" keyName="smm2_migration.feature.queue" />
6769
<p class="text-base">
@@ -70,16 +72,16 @@
7072
</span>
7173
</li>
7274
<li>
73-
<span class="badge bg-primary-800 text-lg">+</span>
75+
<span class="badge bg-primary-800 text-lg"><SvgIcon class="w-5 h-5 my-1" icon={mdiPlus} /></span>
7476
<span class="flex-auto text-lg">
75-
<T defaultValue="Native Linux + Mac support" keyName="smm2_migration.feature.platform_support" />
77+
<T defaultValue="Native Linux Heroic, Steam Snap, Mac support" keyName="smm2_migration.feature.platform_support" />
7678
<p class="text-base">
7779
<T defaultValue="Get a build from the GitHub releases if you haven't yet!" keyName="smm2_migration.feature.platform_support.description" />
7880
</p>
7981
</span>
8082
</li>
8183
<li>
82-
<span class="badge bg-tertiary-800 text-lg">+</span>
84+
<span class="badge bg-tertiary-800 text-lg"><SvgIcon class="w-5 h-5 my-1" icon={mdiPlus} /></span>
8385
<span class="flex-auto text-lg">
8486
<T defaultValue="Improved performance" keyName="smm2_migration.feature.performance" />
8587
<p class="text-base">
@@ -88,11 +90,11 @@
8890
</span>
8991
</li>
9092
<li>
91-
<span class="badge bg-warning-800 text-lg"></span>
93+
<span class="badge bg-warning-800 text-lg"><SvgIcon class="w-5 h-5 my-1" icon={mdiAlert} /></span>
9294
<span class="flex-auto text-lg">
9395
<T defaultValue="New profile format" keyName="smm2_migration.feature.profile_format" />
9496
<p class="text-base">
95-
<T defaultValue="SMM2 profiles are not compatible with SMM3! Your existing profiles have been migrated. TODO were they actually?" keyName="smm2_migration.feature.profile_format.description" />
97+
<T defaultValue="SMM2 profiles are not compatible with SMM3! Your existing profiles have automatically been migrated, but you can't Import any profiles created with SMM2." keyName="smm2_migration.feature.profile_format.description" />
9698
</p>
9799
</span>
98100
</li>

frontend/src/lib/components/modals/first-time-setup/FirstTimeSetupModal.svelte

Lines changed: 55 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { mdiTimerSandFull, mdiWeb } from '@mdi/js';
2+
import { mdiClock, mdiPlay, mdiTimerSandFull, mdiTimerSandPaused, mdiWatch, mdiWeb } from '@mdi/js';
33
import { SlideToggle } from '@skeletonlabs/skeleton';
44
import { T } from '@tolgee/svelte';
55
@@ -16,6 +16,7 @@
1616
BrowserOpenURL('https://docs.ficsit.app/satisfactory-modding/latest/ForUsers/Welcome.html');
1717
};
1818
19+
// Modal should be persistent when used because pressing Escape doesn't trigger this
1920
function onClose() {
2021
SetNewUserSetupComplete(true);
2122
parent.onClose();
@@ -37,52 +38,73 @@
3738
/>
3839
</p>
3940
</section>
40-
<section class="px-4 overflow-y-auto">
41+
<section class="px-4 overflow-y-visible">
4142
<ul class="list">
4243
<li>
4344
<span class="badge bg-tertiary-500">
4445
<SvgIcon
45-
class="h-5 w-5"
46+
class="h-6 w-6 my-1"
4647
icon={mdiTimerSandFull}
4748
/>
4849
</span>
49-
<span class="flex-auto">
50+
<div class="flex-auto">
5051
<p class="text-lg"><T defaultValue="When I add or remove a mod, or switch profiles..." keyName="first_time_setup.option.queue-auto-start.title" /></p>
51-
<p class="text-base">
52-
<span class="flex-auto">
53-
<SlideToggle
54-
name="slider-queue"
55-
active="bg-primary-600"
56-
bind:checked={$queueAutoStart}>
57-
<span>
58-
{#if $queueAutoStart}
59-
<T
60-
defaultValue="Apply the change immediately."
61-
keyName="first_time_setup.option.queue-auto-start.enabled"
62-
/>
63-
{:else}
64-
<T
65-
defaultValue='Queue the change and wait for me to press "Apply" to enact queued changes.'
66-
keyName="first_time_setup.option.queue-auto-start.enabled"
67-
/>
68-
{/if}
69-
</span>
70-
</SlideToggle>
52+
<SlideToggle
53+
name="slider-queue"
54+
class="flex-auto"
55+
active="bg-primary-600"
56+
bind:checked={$queueAutoStart}>
57+
<span>
58+
{#if $queueAutoStart}
59+
<T
60+
defaultValue="Apply the change immediately."
61+
keyName="first_time_setup.option.queue-auto-start.enabled"
62+
/>
63+
{:else}
64+
<T
65+
defaultValue='Queue the change and wait for me to press "Apply" to enact queued changes.'
66+
keyName="first_time_setup.option.queue-auto-start.disabled"
67+
/>
68+
{/if}
7169
</span>
72-
</span>
70+
</SlideToggle>
71+
<!-- TODO testing the button group approach -->
72+
<div class="btn-group bg-surface-200-700-token">
73+
<button
74+
class="!btn-sm !px-4 text-lg"
75+
class:!bg-primary-900={$queueAutoStart}
76+
on:click={() => { $queueAutoStart = true; }}
77+
>
78+
<T defaultValue="Apply the change immediately." keyName="first_time_setup.option.queue-auto-start.enabled"/>
79+
<div class="grow"/>
80+
<SvgIcon
81+
class="h-5 w-5"
82+
icon={mdiPlay} />
83+
</button>
84+
<button
85+
class="!btn-sm !px-4 text-lg"
86+
class:!bg-primary-900={!$queueAutoStart}
87+
on:click={() => { $queueAutoStart = false; }}
88+
>
89+
<T defaultValue='Queue the change and wait for me to press "Apply" to enact queued changes.' keyName="first_time_setup.option.queue-auto-start.disabled"/>
90+
<div class="grow"/>
91+
<SvgIcon
92+
class="h-5 w-5"
93+
icon={mdiClock} />
94+
</button>
95+
</div>
96+
</div>
7397
</li>
7498
<li>
7599
<span class="badge bg-tertiary-500 text-lg">
76100
<SvgIcon
77-
class="h-5 w-5"
101+
class="h-6 w-6 my-1"
78102
icon={mdiWeb}
79103
/>
80104
</span>
81-
<span class="w-full">
82-
<p class="text-lg"><T defaultValue="Use this language where available:" keyName="first_time_setup.option.language.title" /></p>
83-
<p class="text-base">
84-
<LanguageSelector />
85-
</span>
105+
<div class="w-full">
106+
<span class="text-lg"><T defaultValue="Use this language where available:" keyName="first_time_setup.option.language.title" /></span>
107+
<LanguageSelector />
86108
</li>
87109
</ul>
88110
</section>
@@ -108,8 +130,8 @@
108130
</p>
109131
</section>
110132
<footer class="card-footer">
111-
<button class="btn" on:click={onClose}>
112-
<T defaultValue="Close" keyName="common.close" />
133+
<button class="btn variant-ringed" on:click={onClose}>
134+
<T defaultValue="Get Started!" keyName="first_time_setup.acknowledge" />
113135
</button>
114136
</footer>
115137
</div>

0 commit comments

Comments
 (0)