|
1 | 1 | <script lang="ts"> |
2 | 2 | import { nonNullish } from '@dfinity/utils'; |
3 | | - import { run } from 'svelte/legacy'; |
4 | | - import { fade } from 'svelte/transition'; |
5 | | - import LaunchpadFirstSatellite from '$lib/components/modules/launchpad/LaunchpadFirstSatellite.svelte'; |
| 3 | + import LaunchpadGuard from '$lib/components/modules/launchpad/LaunchpadGuard.svelte'; |
| 4 | + import LaunchpadHeader from '$lib/components/modules/launchpad/LaunchpadHeader.svelte'; |
6 | 5 | import LaunchpadSegments from '$lib/components/modules/launchpad/LaunchpadSegments.svelte'; |
7 | | - import Message from '$lib/components/ui/Message.svelte'; |
8 | | - import Spinner from '$lib/components/ui/Spinner.svelte'; |
| 6 | + import LaunchpadToolbar from '$lib/components/modules/launchpad/LaunchpadToolbar.svelte'; |
| 7 | + import { account } from '$lib/derived/console/account.derived'; |
9 | 8 | import { satellites } from '$lib/derived/satellites.derived'; |
10 | | - import { i18n } from '$lib/stores/app/i18n.store'; |
11 | 9 |
|
12 | | - let loading = $state(true); |
13 | | - run(() => { |
14 | | - (() => { |
15 | | - if (nonNullish($satellites)) { |
16 | | - setTimeout(() => (loading = false), 500); |
17 | | - return; |
18 | | - } |
| 10 | + let filter = $state(''); |
19 | 11 |
|
20 | | - loading = true; |
21 | | - })(); |
22 | | - }); |
| 12 | + // If the user was never updated, they never received credits. |
| 13 | + // We do this check to e.g. not display the getting started banner on Skylab. |
| 14 | + let userNoFirstCredits = $derived( |
| 15 | + nonNullish($account) && |
| 16 | + $account.created_at === $account.updated_at && |
| 17 | + $account.credits.e8s === 0n |
| 18 | + ); |
| 19 | +
|
| 20 | + let withoutGreetingsReturningLabel = $derived(($satellites?.length ?? 0n) === 0n); |
23 | 21 | </script> |
24 | 22 |
|
25 | | -{#if loading || ($satellites?.length ?? 0n) === 0} |
26 | | - {#if loading} |
27 | | - <div class="spinner"> |
28 | | - <Message> |
29 | | - {#snippet icon()} |
30 | | - <Spinner inline /> |
31 | | - {/snippet} |
| 23 | +<LaunchpadGuard> |
| 24 | + <section> |
| 25 | + <LaunchpadHeader userGettingStarted={userNoFirstCredits} {withoutGreetingsReturningLabel}> |
| 26 | + <LaunchpadToolbar bind:filter /> |
| 27 | + </LaunchpadHeader> |
32 | 28 |
|
33 | | - <p>{$i18n.launchpad.loading_launchpad}</p> |
34 | | - </Message> |
35 | | - </div> |
36 | | - {:else} |
37 | | - <section in:fade> |
38 | | - <LaunchpadFirstSatellite /> |
39 | | - </section> |
40 | | - {/if} |
41 | | -{:else if ($satellites?.length ?? 0) >= 1} |
42 | | - <section in:fade> |
43 | | - <LaunchpadSegments /> |
| 29 | + <LaunchpadSegments {filter} /> |
44 | 30 | </section> |
45 | | -{/if} |
| 31 | +</LaunchpadGuard> |
46 | 32 |
|
47 | 33 | <style lang="scss"> |
48 | 34 | @use '../../../styles/mixins/grid'; |
49 | | - @use '../../../styles/mixins/media'; |
50 | 35 |
|
51 | 36 | section { |
52 | 37 | @include grid.twelve-columns; |
|
57 | 42 | margin-top: var(--padding-4x); |
58 | 43 | } |
59 | 44 | } |
60 | | -
|
61 | | - section, |
62 | | - h1, |
63 | | - div { |
64 | | - position: relative; |
65 | | - } |
66 | | -
|
67 | | - .spinner { |
68 | | - position: fixed; |
69 | | - top: 50%; |
70 | | - left: 50%; |
71 | | - transform: translate(-50%, -75%); |
72 | | - } |
73 | 45 | </style> |
0 commit comments