Skip to content

Commit 968d96f

Browse files
rhit-daughewdCopilot
andcommitted
Switch profile for repeat installs
Co-authored-by: Copilot <copilot@github.com>
1 parent c48c188 commit 968d96f

1 file changed

Lines changed: 23 additions & 10 deletions

File tree

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

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { error } from '$lib/store/generalStore';
88
import { offline } from '$lib/store/settingsStore';
99
import { InstallModpackRelease } from '$wailsjs/go/ficsitcli/ficsitCLI';
10-
import { profiles } from '$lib/store/ficsitCLIStore';
10+
import { profiles, selectedProfile } from '$lib/store/ficsitCLIStore';
1111
1212
export let parent: { onClose: () => void };
1313
@@ -43,6 +43,13 @@
4343
parent.onClose();
4444
}
4545
46+
function switchToProfile() {
47+
if (!modpack) return;
48+
const modpackName = modpack.name;
49+
selectedProfile.asyncSet(`${modpackName}-${version}`);
50+
parent.onClose();
51+
}
52+
4653
$: renderedLogo = modpack?.logo || 'https://ficsit.app/images/no_image.webp';
4754
</script>
4855

@@ -71,16 +78,22 @@
7178
{/if}
7279
</section>
7380
<footer class="card-footer">
74-
<button
75-
class="btn text-primary-600 variant-ringed"
76-
disabled={isInstalled}
77-
on:click={install}>
78-
{#if isInstalled}
79-
<T defaultValue="Already installed" keyName="external-install-modpack.already-installed" />
80-
{:else}
81+
{#if isInstalled}
82+
<p class="text-sm text-red-500">
83+
<T defaultValue="This profile already exists" keyName="external-install-modpack.already-installed-warning" />
84+
</p>
85+
<button
86+
class="btn text-primary-600 variant-ringed"
87+
on:click={switchToProfile}>
88+
<T defaultValue="Switch to profile" keyName="external-install-modpack.already-installed" />
89+
</button>
90+
{:else}
91+
<button
92+
class="btn text-primary-600 variant-ringed"
93+
on:click={install}>
8194
<T defaultValue="Install" keyName="external-install-modpack.install" />
82-
{/if}
83-
</button>
95+
</button>
96+
{/if}
8497
<button
8598
class="btn"
8699
on:click={parent.onClose}>

0 commit comments

Comments
 (0)