shell.svelte (1077B)
1 <script lang="ts"> 2 import { onMount } from 'svelte'; 3 import AppShell from '../../../src/lib/components/AppShell.svelte'; 4 let connected = $state(false); 5 let commands = $state(0); 6 let enabled = $state(true); 7 let ready = $state(false); 8 onMount(() => { 9 ready = true; 10 }); 11 const publicKey = 'HC_TEST_ONLY_PUBLIC_KEY_' + 'a'.repeat(64); 12 function connect() { 13 commands++; 14 connected = true; 15 } 16 function disconnect() { 17 commands++; 18 connected = false; 19 } 20 </script> 21 22 <AppShell 23 currentPath="/search" 24 availableRoutes={['/search', '/sell', '/selling', '/about', '/privacy']} 25 identity={connected 26 ? { 27 kind: 'connected', 28 publicKey, 29 ondisconnect: ready && enabled ? disconnect : undefined 30 } 31 : { kind: 'guest', onconnect: ready && enabled ? connect : undefined }} 32 > 33 <h1>HC_TEST_ONLY_SHELL</h1> 34 <p role="status">Commands: {commands}</p> 35 <button 36 type="button" 37 class="button button--secondary" 38 onclick={() => { 39 enabled = !enabled; 40 }}>Toggle command availability</button 41 > 42 </AppShell>