added dynamic data loading and mapping towards components.

This commit is contained in:
Samuel Andert
2023-07-26 15:16:41 +02:00
parent 14aad071f4
commit 920e7b7ca1
6 changed files with 99 additions and 17 deletions

View File

@ -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 @@
});
</script>
<!-- Only render the div when $store.pkpWallet is defined -->
{#if $store}
<div class="p-12 bg-blue-400">Hello Earth {$store.pkpWallet.address}</div>
{#if !$store}
<div>Loading store...</div>
{:else}
<!-- You can display a loader or placeholder content here -->
<div>Loading...</div>
<div class="p-12 bg-blue-400">
Hello Earth
{#if $store.pkpWallet}{$store.pkpWallet.address}{/if}
{#if $store.todos && $store.messages}
<ul>
{#each $store.todos as todo}
<li>{todo.name}</li>
{/each}
</ul>
<ul>
{#each $store.messages as message}
<li>{message.text} - {message.date}</li>
{/each}
</ul>
{/if}
</div>
{/if}