From b560897e17f9621ed9a10f79445f8b2ec1987b82 Mon Sep 17 00:00:00 2001 From: Samuel Andert Date: Tue, 25 Jul 2023 15:54:36 +0200 Subject: [PATCH] minors --- src/lib/components/GoogleAuth.svelte | 5 ++-- .../components/HelloEarth/HelloEarth.svelte | 3 ++ src/lib/services/helloEarthAlert.ts | 3 ++ .../{setupLitProvider.ts => setupLit.ts} | 6 +--- src/routes/+page.svelte | 30 +++++++++++-------- 5 files changed, 27 insertions(+), 20 deletions(-) create mode 100644 src/lib/services/helloEarthAlert.ts rename src/lib/services/provider/{setupLitProvider.ts => setupLit.ts} (88%) diff --git a/src/lib/components/GoogleAuth.svelte b/src/lib/components/GoogleAuth.svelte index e74aa0a..ad6215f 100644 --- a/src/lib/components/GoogleAuth.svelte +++ b/src/lib/components/GoogleAuth.svelte @@ -8,7 +8,7 @@ const redirectUri = 'http://localhost:5173/'; - export let setupLitProvider; + export let setupLit; let view = 'sign_in'; let sessionSigs; @@ -30,8 +30,7 @@ onMount(async () => { try { - provider = await setupLitProvider.setupLitProvider(); - setupLitProvider.alertMe(); + provider = await setupLit.connectProvider(); logMessage('Component mounted.'); diff --git a/src/lib/components/HelloEarth/HelloEarth.svelte b/src/lib/components/HelloEarth/HelloEarth.svelte index 1c9a1a6..bb9eb2c 100644 --- a/src/lib/components/HelloEarth/HelloEarth.svelte +++ b/src/lib/components/HelloEarth/HelloEarth.svelte @@ -7,7 +7,10 @@ const store = getComponentStore(id); $: console.log('store:', $store); + export let helloEarthAlert; + onMount(async () => { + helloEarthAlert.alertMe(); console.log('hello Earth'); }); diff --git a/src/lib/services/helloEarthAlert.ts b/src/lib/services/helloEarthAlert.ts new file mode 100644 index 0000000..22f0f6e --- /dev/null +++ b/src/lib/services/helloEarthAlert.ts @@ -0,0 +1,3 @@ +export function alertMe() { + alert("Hello Earth") +} \ No newline at end of file diff --git a/src/lib/services/provider/setupLitProvider.ts b/src/lib/services/provider/setupLit.ts similarity index 88% rename from src/lib/services/provider/setupLitProvider.ts rename to src/lib/services/provider/setupLit.ts index 50e10dc..a8b5409 100644 --- a/src/lib/services/provider/setupLitProvider.ts +++ b/src/lib/services/provider/setupLit.ts @@ -10,7 +10,7 @@ import { LitNodeClient } from '@lit-protocol/lit-node-client'; let provider: BaseProvider | undefined; -export async function setupLitProvider() { +export async function connectProvider() { const litNodeClient = new LitNodeClient({ litNetwork: 'serrano', debug: false @@ -28,7 +28,3 @@ export async function setupLitProvider() { return provider; } - -export function alertMe() { - alert("hello") -} \ No newline at end of file diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 947f0a4..f298f22 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -5,20 +5,27 @@ layout: ` grid-template-areas: "auth", - "hello", - "google" - grid-template-rows: 1fr 1fr; + "header", + "main", + "footer" + grid-template-rows: 1fr 1fr auto; `, children: [ { - id: 'authsig', - componentName: 'HelloEarth', - slot: 'hello' + id: '1', + componentName: 'GoogleAuth', + slot: 'header', + services: ['setupLit'] + }, + { + id: '2', + componentName: 'Messages', + slot: 'Main' }, // { - // id: 'wallet1', + // id: '2', // componentName: 'Wallet', - // slot: 'play', + // slot: 'main', // state: { // rpcURL: 'https://rpc.gnosischain.com/', // pkpPubKey: @@ -26,10 +33,9 @@ // } // }, { - id: 'google', - componentName: 'GoogleAuth', - slot: 'google', - services: ['setupLitProvider'] + id: '3', + componentName: 'Terminal', + slot: 'footer' } ] };