refactor save

This commit is contained in:
Samuel Andert 2023-08-04 18:41:58 +02:00
parent 00cea8429c
commit aced9fca2b
5 changed files with 13 additions and 10 deletions

View File

@ -15,10 +15,10 @@
} }
</script> </script>
<div class="p-2 border-2 border-blue-500"> <div class="p-8 border-2 border-blue-500">
<p>My ID is: {me.id}</p> <p>My ID is: {me.id}</p>
I am the parent, this is my state: {$data.state} My state is: {$data.state}
<div <div
class="p-2 border-2" class="p-2 border-2"
style="background-color: {$data.state}; border-radius: 50%; width: 50px; height: 50px;" style="background-color: {$data.state}; border-radius: 50%; width: 50px; height: 50px;"

View File

@ -9,10 +9,10 @@
}; };
</script> </script>
<div class="border-2 border-yellow-500"> <div class="p-8 border-2 border-yellow-500">
<p>My ID is: {me.id}</p> <p>My ID is: {me.id}</p>
i am the child and this is my state: {$data.state} My state is: {$data.state}
<button <button
class="px-4 py-2 font-bold text-white bg-blue-500 rounded hover:bg-blue-700" class="px-4 py-2 font-bold text-white bg-blue-500 rounded hover:bg-blue-700"
on:click={handleButton}>Switch</button on:click={handleButton}>Switch</button

View File

@ -14,15 +14,18 @@
} }
</script> </script>
<div class="flex flex-col h-screen"> <div class="flex flex-col h-screen border-2 border-green-500">
<section class=" h-96"> <section class="p-8 h-96">
<p>My ID is: {me.id}</p>
My state is: {$data.state}
{#if $data.store.todos} {#if $data.store.todos}
{#each $data.store.todos as todo} {#each $data.store.todos as todo}
<p>{todo.text}</p> <p>{todo.text}</p>
{/each} {/each}
{/if} {/if}
</section> </section>
<section class="flex-grow overflow-y-auto"> <section class="flex-grow p-8 overflow-y-auto">
{#if $data.store.messages} {#if $data.store.messages}
{#each $data.store.messages as message} {#each $data.store.messages as message}
<p>{message.text}</p> <p>{message.text}</p>

View File

@ -31,7 +31,7 @@
component: 'ComposerCharly', component: 'ComposerCharly',
slot: 'aside', slot: 'aside',
data: { data: {
queries: { map: {
todos: queryTodos, todos: queryTodos,
messages: queryMessages messages: queryMessages
} }

View File

@ -115,8 +115,8 @@
if (child.id) { if (child.id) {
child.store = createComposerStore(child.id, child.store || {}); child.store = createComposerStore(child.id, child.store || {});
if (child.data?.queries) { if (child.data?.map) {
subscribeAndMapQueries(child.id, child.data.queries); subscribeAndMapQueries(child.id, child.data.map);
} }
} }