rework routing

This commit is contained in:
2023-04-24 12:05:11 -07:00
parent 049b81610d
commit 53580d7919
9 changed files with 119 additions and 114 deletions

View File

@ -1,28 +1,29 @@
<script>
import { createEventDispatcher } from 'svelte';
import { invoke } from '@tauri-apps/api/tauri';
import { fly } from 'svelte/transition';
import { expoIn } from 'svelte/easing';
import { navigate } from '../lib/routing.js';
import Icon from '../ui/Icon.svelte';
export let appState;
const dispatch = createEventDispatcher();
async function approve() {
let status = await invoke('get_session_status');
if (status === 'unlocked') {
dispatch('navigate', {target: 'ShowApproved'});
navigate('ShowApproved');
}
else if (status === 'locked') {
dispatch('navigate', {target: 'Unlock'})
navigate('Unlock');
}
else {
dispatch('navigate', {target: 'EnterCredentials'});
navigate('EnterCredentials');
}
}
function deny() {
dispatch('navigate', {target: 'ShowDenied'});
navigate('ShowDenied');
}
function handleHotkey(event) {
@ -46,6 +47,10 @@
<svelte:window on:keydown={handleHotkey} />
<!-- <div
out:fly="{{x: '-100vw', duration: 200, easing: expoIn}}"
class="flex flex-col space-y-4 p-4 m-auto max-w-max h-screen justify-center"
> -->
<div class="flex flex-col space-y-4 p-4 m-auto max-w-max h-screen justify-center">
<!-- <div class="p-4 rounded-box border-2 border-neutral-content"> -->
<div class="space-y-1 mb-4">