|
1 | 1 | <script lang="ts"> |
2 | | - // const electron = require("electron"); |
3 | | -
|
4 | 2 | import Button from "./Button.svelte"; |
5 | 3 | import ButtonGroup from "./ButtonGroup.svelte"; |
6 | 4 | import SocialLinks from "./SocialLinks.svelte"; |
7 | 5 | import {canGoForward, canGoBack, nextPage, state} from "../stores/navigation"; |
8 | | - // import {push, pop, location} from "svelte-spa-router"; |
9 | 6 | import quit from "../actions/quit"; |
10 | | - import {goto, pushState} from "$app/navigation"; |
| 7 | + import {goto, onNavigate} from "$app/navigation"; |
11 | 8 | import {page} from "$app/state"; |
| 9 | + import {base} from "$app/paths"; |
| 10 | +
|
12 | 11 |
|
13 | 12 | let nextButtonContent = "Next"; |
14 | 13 |
|
15 | 14 | async function goToNext() { |
16 | 15 | state.direction = 1; |
17 | | - if ($nextPage) goto($nextPage, page.state); |
| 16 | + if ($nextPage) goto(`${base}${$nextPage}`, page.state); |
18 | 17 | else await quit(); |
19 | 18 | } |
20 | 19 |
|
|
23 | 22 | window.history.back(); |
24 | 23 | } |
25 | 24 |
|
26 | | - $: if (window.location.pathname.startsWith("/setup/")) { |
27 | | - const action = window.location.pathname.slice(7); |
28 | | - const actionText = action[0].toUpperCase() + action.slice(1); |
29 | | - nextButtonContent = actionText; |
30 | | - } |
31 | | - else { |
32 | | - nextButtonContent = "Next"; |
33 | | - } |
| 25 | + onNavigate(() => { |
| 26 | + if (window.location.pathname.startsWith("/actions/setup/")) { |
| 27 | + const action = window.location.pathname.slice(15); |
| 28 | + const actionText = action[0].toUpperCase() + action.slice(1); |
| 29 | + nextButtonContent = actionText; |
| 30 | + } |
| 31 | + else { |
| 32 | + nextButtonContent = "Next"; |
| 33 | + } |
| 34 | + }); |
34 | 35 |
|
35 | | - function navigatePage() { |
| 36 | + function navigatePage(event: KeyboardEvent) { |
36 | 37 | if ((event.key === "ArrowRight" && event.ctrlKey) && $canGoForward) { |
37 | 38 | goToNext(); |
38 | 39 | } |
|
48 | 49 | <footer class="install-footer"> |
49 | 50 | <SocialLinks /> |
50 | 51 | <ButtonGroup> |
51 | | - <Button type="secondary" disabled={!$canGoBack} on:click={goBack}>Back</Button> |
52 | | - <Button type="primary" disabled={!$canGoForward} on:click={goToNext}>{#if $nextPage}{nextButtonContent}{:else}Close{/if}</Button> |
| 52 | + <Button style="secondary" disabled={!$canGoBack} onclick={goBack}>Back</Button> |
| 53 | + <Button style="primary" disabled={!$canGoForward} onclick={goToNext}>{#if $nextPage}{nextButtonContent}{:else}Close{/if}</Button> |
53 | 54 | </ButtonGroup> |
54 | 55 | </footer> |
55 | 56 |
|
|
0 commit comments