2022-11-23 17:11:44 -08:00
|
|
|
<script>
|
2022-11-27 22:03:15 -08:00
|
|
|
import { onMount, createEventDispatcher } from 'svelte';
|
2022-12-22 21:50:09 -08:00
|
|
|
import { invoke } from '@tauri-apps/api/tauri';
|
2023-04-23 22:29:12 -07:00
|
|
|
|
|
|
|
import Icon from '../ui/Icon.svelte';
|
2022-11-23 17:11:44 -08:00
|
|
|
|
2022-11-27 22:03:15 -08:00
|
|
|
export let appState;
|
2022-11-23 17:11:44 -08:00
|
|
|
|
2022-11-27 22:03:15 -08:00
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
onMount(async () => {
|
|
|
|
// will block until a request comes in
|
|
|
|
let req = await appState.pendingRequests.get();
|
|
|
|
appState.currentRequest = req;
|
2022-12-13 16:50:44 -08:00
|
|
|
console.log('Got credentials request from queue:');
|
|
|
|
console.log(req);
|
2022-11-27 22:03:15 -08:00
|
|
|
dispatch('navigate', {target: 'Approve'});
|
|
|
|
});
|
2022-12-22 21:50:09 -08:00
|
|
|
|
|
|
|
let status = 'unknown';
|
|
|
|
onMount(async() => {
|
|
|
|
status = await invoke('get_session_status');
|
|
|
|
})
|
2022-11-23 17:11:44 -08:00
|
|
|
</script>
|
|
|
|
|
2022-12-22 21:50:09 -08:00
|
|
|
|
2023-04-23 22:29:12 -07:00
|
|
|
<nav class="fixed top-0 grid grid-cols-2 w-full p-2">
|
|
|
|
<div id="nav-left flex">
|
|
|
|
<button class="btn btn-squre btn-ghost align-middle">
|
|
|
|
<Icon name="home" class="w-8 h-8 stroke-2" />
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div id="nav-right" class="justify-self-end">
|
|
|
|
<button class="align-middle btn btn-square btn-ghost">
|
|
|
|
<Icon name="cog-8-tooth" class="w-8 h-8 stroke-2" />
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</nav>
|
2022-12-22 21:50:09 -08:00
|
|
|
|
|
|
|
{#if status === 'locked'}
|
2023-04-23 22:29:12 -07:00
|
|
|
<div class="flex flex-col h-screen justify-center items-center space-y-4">
|
|
|
|
<img src="/static/padlock-closed.svg" alt="An unlocked padlock" class="w-32" />
|
|
|
|
<h2 class="text-2xl font-bold">Creddy is locked</h2>
|
|
|
|
<button class="btn btn-primary" on:click={() => dispatch('navigate', {target: 'Unlock'})}>Unlock</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{:else if status === 'unlocked'}
|
|
|
|
<div class="flex flex-col h-screen justify-center items-center space-y-4">
|
|
|
|
<img src="/static/padlock-open.svg" alt="An unlocked padlock" class="w-24" />
|
|
|
|
<h2 class="text-2xl font-bold">Creddy is ready</h2>
|
|
|
|
</div>
|
|
|
|
|
2022-12-22 21:50:09 -08:00
|
|
|
{:else if status === 'empty'}
|
2023-04-23 22:29:12 -07:00
|
|
|
<button class="btn btn-primary" on:click={() => dispatch('navigate', {target: 'EnterCredentials'})}>
|
2022-12-22 21:50:09 -08:00
|
|
|
Enter Credentials
|
2023-04-23 22:29:12 -07:00
|
|
|
</button>
|
2022-12-22 21:50:09 -08:00
|
|
|
{/if}
|