2022-11-23 17:11:44 -08:00
|
|
|
<script>
|
2023-04-25 08:49:00 -07:00
|
|
|
import { onMount } 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
|
|
|
|
2023-04-25 08:49:00 -07:00
|
|
|
import { appState } from '../lib/state.js';
|
2023-04-24 12:05:11 -07:00
|
|
|
import { navigate } from '../lib/routing.js';
|
2023-04-24 22:16:25 -07:00
|
|
|
import Nav from '../ui/Nav.svelte';
|
2023-04-23 22:29:12 -07:00
|
|
|
import Icon from '../ui/Icon.svelte';
|
2023-04-25 08:49:00 -07:00
|
|
|
import Link from '../ui/Link.svelte';
|
2022-11-23 17:11:44 -08:00
|
|
|
|
|
|
|
|
2022-11-27 22:03:15 -08:00
|
|
|
onMount(async () => {
|
|
|
|
// will block until a request comes in
|
2023-04-25 08:49:00 -07:00
|
|
|
let req = await $appState.pendingRequests.get();
|
|
|
|
$appState.currentRequest = req;
|
2023-04-24 12:05:11 -07:00
|
|
|
navigate('Approve');
|
2022-11-27 22:03:15 -08:00
|
|
|
});
|
2022-11-23 17:11:44 -08:00
|
|
|
</script>
|
|
|
|
|
2022-12-22 21:50:09 -08:00
|
|
|
|
2023-04-24 22:16:25 -07:00
|
|
|
<Nav />
|
2022-12-22 21:50:09 -08:00
|
|
|
|
2023-04-26 17:06:37 -07:00
|
|
|
<div class="flex flex-col h-screen items-center justify-center p-4 space-y-4">
|
2023-04-25 22:10:14 -07:00
|
|
|
{#await invoke('get_session_status') then status}
|
|
|
|
{#if status === 'locked'}
|
|
|
|
<img src="/static/padlock-closed.svg" alt="A locked padlock" class="w-32" />
|
|
|
|
<h2 class="text-2xl font-bold">Creddy is locked</h2>
|
|
|
|
<Link target="Unlock">
|
|
|
|
<button class="btn btn-primary">Unlock</button>
|
|
|
|
</Link>
|
|
|
|
|
|
|
|
{:else if status === 'unlocked'}
|
|
|
|
<img src="/static/padlock-open.svg" alt="An unlocked padlock" class="w-24" />
|
|
|
|
<h2 class="text-2xl font-bold">Waiting for requests</h2>
|
|
|
|
|
|
|
|
{:else if status === 'empty'}
|
|
|
|
<Link target="EnterCredentials">
|
|
|
|
<button class="btn btn-primary">Enter Credentials</button>
|
|
|
|
</Link>
|
|
|
|
{/if}
|
|
|
|
{/await}
|
|
|
|
</div>
|