Skip to content

Commit a9bd403

Browse files
committed
fix: attempt to use reactivity to resize window
1 parent ebd0d32 commit a9bd403

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

frontend/src/components/installer/FailureModal.svelte

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import * as Installer from "../../../wailsjs/go/installer/Installer.js";
99
import Heading from "../text/Heading.svelte";
1010
import Button from "../Button.svelte";
11-
import { closeWindow } from "../windows/index.js";
11+
import { closeWindow, resizeWindow } from "../windows/index.js";
1212
import { BrowserOpenURL } from "../../../wailsjs/runtime/runtime.js";
1313
1414
import * as IPC from "./ipc";
@@ -26,16 +26,29 @@
2626
2727
setTimeout(() => IPC.doAction(op, path, onAction));
2828
}
29+
30+
let isOwned = true;
31+
32+
// svelte hacks...
33+
async function CheckOwnership() {
34+
isOwned = await Installer.CheckForOwnershipDarwin(path);
35+
}
36+
37+
$: if (!isOwned) {
38+
resizeWindow(_windowId, 450, 510);
39+
} else {
40+
resizeWindow(_windowId, 450, 200);
41+
}
2942
</script>
3043

3144
<section role="dialog">
3245
<Heading tag="h6" --color="var(--accent-red)">Oh no!</Heading>
3346
<p>Something went wrong!</p>
3447
{#if message}
3548
{#if message.includes("file exists") || message.includes("permission denied")}
36-
{#await Installer.CheckForOwnershipDarwin(path)}
49+
{#await CheckOwnership()}
3750
<p>{message}</p>
38-
{:then isOwned}
51+
{:then}
3952
{#if !isOwned}
4053
<p>Hmm... seems like you've encountered a Mac-specific problem! Usually, this is one of two things:</p>
4154
<p>

frontend/src/components/windows/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ export const closeWindow = (id: string) => {
4848
});
4949
};
5050

51+
export const resizeWindow = (id: string, w: number, h: number) => {
52+
windowStore.update(windows => {
53+
windows[id].props.width = w;
54+
windows[id].props.height = h;
55+
return windows;
56+
});
57+
}
58+
5159
let zIndex = 0;
5260
export const getFocusZIndex = () => {
5361
zIndex++;

0 commit comments

Comments
 (0)