minor fix
This commit is contained in:
parent
5c2f7afa5f
commit
14aad071f4
@ -1,6 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
export let services;
|
export let services;
|
||||||
export let store;
|
export let store;
|
||||||
|
|
||||||
@ -13,6 +12,10 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $store && $store.pkpWallet.address}
|
<!-- Only render the div when $store.pkpWallet is defined -->
|
||||||
<div class="p-12 bg-blue-400">Hello Earth {JSON.stringify($store.pkpWallet.address)}</div>
|
{#if $store}
|
||||||
|
<div class="p-12 bg-blue-400">Hello Earth {$store.pkpWallet.address}</div>
|
||||||
|
{:else}
|
||||||
|
<!-- You can display a loader or placeholder content here -->
|
||||||
|
<div>Loading...</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -34,6 +34,13 @@ ${composite.layout.rows ? `grid-template-rows: ${composite.layout.rows};` : ''}
|
|||||||
`
|
`
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
|
$: if (composite?.children) {
|
||||||
|
composite.children.forEach((child) => {
|
||||||
|
initializeCompositeState(child);
|
||||||
|
mapAndSubscribe(child);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function initializeCompositeState(child: IComposite) {
|
function initializeCompositeState(child: IComposite) {
|
||||||
if (child.id) {
|
if (child.id) {
|
||||||
child.store = createCompositeStore(child.id, child.store || {});
|
child.store = createCompositeStore(child.id, child.store || {});
|
||||||
@ -44,10 +51,6 @@ ${composite.layout.rows ? `grid-template-rows: ${composite.layout.rows};` : ''}
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: if (composite && composite.children) {
|
|
||||||
composite.children.forEach(initializeCompositeState);
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapAndSubscribe(component: IComposite) {
|
function mapAndSubscribe(component: IComposite) {
|
||||||
console.log('Mapping and subscribing for:', component.id);
|
console.log('Mapping and subscribing for:', component.id);
|
||||||
|
|
||||||
@ -80,10 +83,6 @@ ${composite.layout.rows ? `grid-template-rows: ${composite.layout.rows};` : ''}
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: if (composite && composite.children) {
|
|
||||||
composite.children.forEach(mapAndSubscribe);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getComponent(componentName: string) {
|
async function getComponent(componentName: string) {
|
||||||
if (components[componentName]) {
|
if (components[componentName]) {
|
||||||
const module = await components[componentName]();
|
const module = await components[componentName]();
|
||||||
@ -112,18 +111,13 @@ ${composite.layout.rows ? `grid-template-rows: ${composite.layout.rows};` : ''}
|
|||||||
}
|
}
|
||||||
return loadedServices;
|
return loadedServices;
|
||||||
}
|
}
|
||||||
// Additional utility function to get component and service props
|
|
||||||
async function loadComponentAndService(component: IComposite) {
|
async function loadComponentAndService(component: IComposite) {
|
||||||
return await Promise.all([getComponent(component.component), getServiceProps(component)]);
|
return await Promise.all([getComponent(component.component), getServiceProps(component)]);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div class={`grid w-full h-full ${composite?.layout?.tailwindClasses || ''}`} style={layoutStyle}>
|
||||||
class={composite?.layout
|
|
||||||
? `grid w-full h-full ${composite.layout.tailwindClasses}`
|
|
||||||
: 'grid w-full h-full'}
|
|
||||||
style={layoutStyle}
|
|
||||||
>
|
|
||||||
{#if composite && 'component' in composite}
|
{#if composite && 'component' in composite}
|
||||||
{#await loadComponentAndService(composite) then [Component, serviceProps]}
|
{#await loadComponentAndService(composite) then [Component, serviceProps]}
|
||||||
{#if Component}
|
{#if Component}
|
||||||
@ -141,7 +135,7 @@ ${composite.layout.rows ? `grid-template-rows: ${composite.layout.rows};` : ''}
|
|||||||
|
|
||||||
{#if composite?.children}
|
{#if composite?.children}
|
||||||
{#each composite.children as child (child.id)}
|
{#each composite.children as child (child.id)}
|
||||||
<div class={`w-full h-full overflow-hidden`} style={`grid-area: ${child.slot}`}>
|
<div class="w-full h-full overflow-hidden" style={`grid-area: ${child.slot}`}>
|
||||||
{#await loadComponentAndService(child) then [ChildComponent, childServiceProps]}
|
{#await loadComponentAndService(child) then [ChildComponent, childServiceProps]}
|
||||||
{#if ChildComponent}
|
{#if ChildComponent}
|
||||||
<svelte:component
|
<svelte:component
|
||||||
|
Loading…
x
Reference in New Issue
Block a user