From 920e7b7ca1f16700eafe85f9497a3fdb433edcdd Mon Sep 17 00:00:00 2001 From: Samuel Andert Date: Wed, 26 Jul 2023 15:16:41 +0200 Subject: [PATCH] added dynamic data loading and mapping towards components. --- .../components/HelloEarth/HelloEarth.svelte | 25 +++++++++++--- src/lib/core/Composite.svelte | 34 +++++++++++++------ src/lib/core/dataLoader.ts | 31 +++++++++++++++++ src/lib/data/queryMessages.ts | 9 +++++ src/lib/data/queryTodos.ts | 9 +++++ src/routes/+page.svelte | 8 ++++- 6 files changed, 99 insertions(+), 17 deletions(-) create mode 100644 src/lib/core/dataLoader.ts create mode 100644 src/lib/data/queryMessages.ts create mode 100644 src/lib/data/queryTodos.ts diff --git a/src/lib/components/HelloEarth/HelloEarth.svelte b/src/lib/components/HelloEarth/HelloEarth.svelte index 18b314d..e4ceaed 100644 --- a/src/lib/components/HelloEarth/HelloEarth.svelte +++ b/src/lib/components/HelloEarth/HelloEarth.svelte @@ -3,6 +3,8 @@ export let services; export let store; + // Watch for store changes + onMount(async () => { if (services && services.helloEarthAlert) { console.log('Alerted by HelloEarthAlert'); @@ -12,10 +14,23 @@ }); - -{#if $store} -
Hello Earth {$store.pkpWallet.address}
+{#if !$store} +
Loading store...
{:else} - -
Loading...
+
+ Hello Earth + {#if $store.pkpWallet}{$store.pkpWallet.address}{/if} + {#if $store.todos && $store.messages} + + + {/if} +
{/if} diff --git a/src/lib/core/Composite.svelte b/src/lib/core/Composite.svelte index ada9583..8a0b072 100644 --- a/src/lib/core/Composite.svelte +++ b/src/lib/core/Composite.svelte @@ -1,7 +1,9 @@