abstracted subscribe to state in composite
This commit is contained in:
parent
e3f2dbacc8
commit
5c2f7afa5f
@ -1,12 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
export let id;
|
|
||||||
|
|
||||||
import { getCompositeStore } from '$lib/core/compositeStores';
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
const store = getCompositeStore(id);
|
|
||||||
|
|
||||||
export let services;
|
export let services;
|
||||||
|
export let store;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (services && services.helloEarthAlert) {
|
if (services && services.helloEarthAlert) {
|
||||||
@ -17,4 +13,6 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#if $store && $store.pkpWallet.address}
|
||||||
<div class="p-12 bg-blue-400">Hello Earth {JSON.stringify($store.pkpWallet.address)}</div>
|
<div class="p-12 bg-blue-400">Hello Earth {JSON.stringify($store.pkpWallet.address)}</div>
|
||||||
|
{/if}
|
||||||
|
@ -130,7 +130,7 @@ ${composite.layout.rows ? `grid-template-rows: ${composite.layout.rows};` : ''}
|
|||||||
<svelte:component
|
<svelte:component
|
||||||
this={Component}
|
this={Component}
|
||||||
id={composite.id}
|
id={composite.id}
|
||||||
{...composite.store}
|
store={getCompositeStore(composite.id)}
|
||||||
services={serviceProps}
|
services={serviceProps}
|
||||||
/>
|
/>
|
||||||
{:else if composite.component}
|
{:else if composite.component}
|
||||||
@ -147,7 +147,7 @@ ${composite.layout.rows ? `grid-template-rows: ${composite.layout.rows};` : ''}
|
|||||||
<svelte:component
|
<svelte:component
|
||||||
this={ChildComponent}
|
this={ChildComponent}
|
||||||
id={child.id}
|
id={child.id}
|
||||||
{...child.store}
|
store={getCompositeStore(child.id)}
|
||||||
services={childServiceProps}
|
services={childServiceProps}
|
||||||
/>
|
/>
|
||||||
{#if child.children && child.children.length}
|
{#if child.children && child.children.length}
|
||||||
|
@ -1,24 +1,22 @@
|
|||||||
<script>
|
<script>
|
||||||
import Wallet from '$lib/Wallet.svelte';
|
|
||||||
import HelloEarth from '$lib/components/HelloEarth/HelloEarth.svelte';
|
|
||||||
import Composite from '$lib/core/Composite.svelte';
|
import Composite from '$lib/core/Composite.svelte';
|
||||||
|
|
||||||
let composite = {
|
let composite = {
|
||||||
id: 'composite',
|
id: 'composite',
|
||||||
layout: {
|
layout: {
|
||||||
areas: `
|
areas: `
|
||||||
"top top top"
|
"top main"
|
||||||
"main main main"
|
"aside main"
|
||||||
"footer footer footer";
|
"footer footer ";
|
||||||
`,
|
`,
|
||||||
columns: '1fr 1fr 1fr',
|
columns: '1fr 1fr ',
|
||||||
rows: '1fr 1fr auto'
|
rows: '1fr 1fr auto'
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
id: 'wallet',
|
id: 'w',
|
||||||
component: 'Wallet',
|
component: 'Wallet',
|
||||||
slot: 'top',
|
slot: 'aside',
|
||||||
store: {
|
store: {
|
||||||
pkpWallet: '',
|
pkpWallet: '',
|
||||||
rpcURL: 'https://rpc.gnosischain.com/',
|
rpcURL: 'https://rpc.gnosischain.com/',
|
||||||
@ -26,6 +24,15 @@
|
|||||||
'046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571'
|
'046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'hello',
|
||||||
|
component: 'HelloEarth',
|
||||||
|
slot: 'top',
|
||||||
|
map: {
|
||||||
|
pkpWallet: 'w.pkpWallet'
|
||||||
|
},
|
||||||
|
services: ['helloEarthAlert']
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'messages',
|
id: 'messages',
|
||||||
component: 'Messages',
|
component: 'Messages',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user