display tweaks and approval page timing
This commit is contained in:
		@@ -7,7 +7,7 @@
 | 
				
			|||||||
<nav class="fixed top-0 grid grid-cols-2 w-full p-2">
 | 
					<nav class="fixed top-0 grid grid-cols-2 w-full p-2">
 | 
				
			||||||
    <div>
 | 
					    <div>
 | 
				
			||||||
        <Link target="Home">
 | 
					        <Link target="Home">
 | 
				
			||||||
            <button class="btn btn-squre btn-ghost align-middle">
 | 
					            <button class="btn btn-square btn-ghost align-middle">
 | 
				
			||||||
                <Icon name="home" class="w-8 h-8 stroke-2" />
 | 
					                <Icon name="home" class="w-8 h-8 stroke-2" />
 | 
				
			||||||
            </button>
 | 
					            </button>
 | 
				
			||||||
        </Link>
 | 
					        </Link>
 | 
				
			||||||
@@ -15,7 +15,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <div class="justify-self-end">
 | 
					    <div class="justify-self-end">
 | 
				
			||||||
        <Link target="Settings">
 | 
					        <Link target="Settings">
 | 
				
			||||||
            <button class="align-middle btn btn-square btn-ghost">
 | 
					            <button class="btn btn-square btn-ghost align-middle ">
 | 
				
			||||||
                <Icon name="cog-8-tooth" class="w-8 h-8 stroke-2" />
 | 
					                <Icon name="cog-8-tooth" class="w-8 h-8 stroke-2" />
 | 
				
			||||||
            </button>
 | 
					            </button>
 | 
				
			||||||
        </Link>
 | 
					        </Link>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,7 +42,7 @@
 | 
				
			|||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<Setting {title} {error}>
 | 
					<Setting {title}>
 | 
				
			||||||
    <div slot="input">
 | 
					    <div slot="input">
 | 
				
			||||||
        {#if unit}
 | 
					        {#if unit}
 | 
				
			||||||
            <span class="mr-2">{unit}:</span>
 | 
					            <span class="mr-2">{unit}:</span>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,6 @@
 | 
				
			|||||||
    import ErrorAlert from '../ErrorAlert.svelte';
 | 
					    import ErrorAlert from '../ErrorAlert.svelte';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    export let title;
 | 
					    export let title;
 | 
				
			||||||
    export let error = null;
 | 
					 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@
 | 
				
			|||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<Setting title="Start minimized">
 | 
					<Setting {title}>
 | 
				
			||||||
    <input 
 | 
					    <input 
 | 
				
			||||||
        slot="input" 
 | 
					        slot="input" 
 | 
				
			||||||
        type="checkbox" 
 | 
					        type="checkbox" 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<Nav />
 | 
					<Nav />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="flex flex-col h-screen justify-center items-center space-y-4">
 | 
					<div class="flex flex-col h-screen items-center justify-center p-4 space-y-4">
 | 
				
			||||||
    {#await invoke('get_session_status') then status}
 | 
					    {#await invoke('get_session_status') then status}
 | 
				
			||||||
        {#if status === 'locked'}
 | 
					        {#if status === 'locked'}
 | 
				
			||||||
            <img src="/static/padlock-closed.svg" alt="A locked padlock" class="w-32" />
 | 
					            <img src="/static/padlock-closed.svg" alt="A locked padlock" class="w-32" />
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@
 | 
				
			|||||||
<Nav />
 | 
					<Nav />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{#await invoke('get_config') then config}
 | 
					{#await invoke('get_config') then config}
 | 
				
			||||||
    <div class="mx-auto mt-3 max-w-md">
 | 
					    <div class="max-w-md mx-auto mt-1.5 p-4">
 | 
				
			||||||
        <h2 class="text-2xl font-bold text-center">Settings</h2>
 | 
					        <h2 class="text-2xl font-bold text-center">Settings</h2>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <ToggleSetting title="Start minimized" bind:value={$appState.config.start_minimized} on:update={save}>
 | 
					        <ToggleSetting title="Start minimized" bind:value={$appState.config.start_minimized} on:update={save}>
 | 
				
			||||||
@@ -34,6 +34,13 @@
 | 
				
			|||||||
            </svelte:fragment>
 | 
					            </svelte:fragment>
 | 
				
			||||||
        </NumericSetting>
 | 
					        </NumericSetting>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <NumericSetting title="Listen port" bind:value={$appState.config.listen_port} min=1 on:update={save}>
 | 
				
			||||||
 | 
					            <svelte:fragment slot="description">
 | 
				
			||||||
 | 
					                Listen for credentials requests on this port. 
 | 
				
			||||||
 | 
					                (Should be used with <code>$AWS_CONTAINER_CREDENTIALS_FULL_URI</code>)
 | 
				
			||||||
 | 
					            </svelte:fragment>
 | 
				
			||||||
 | 
					        </NumericSetting>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <Setting title="Update credentials">
 | 
					        <Setting title="Update credentials">
 | 
				
			||||||
            <Link slot="input" target="EnterCredentials">
 | 
					            <Link slot="input" target="EnterCredentials">
 | 
				
			||||||
                <button class="btn btn-sm btn-primary">Update</button>
 | 
					                <button class="btn btn-sm btn-primary">Update</button>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,10 @@
 | 
				
			|||||||
    let success = false;
 | 
					    let success = false;
 | 
				
			||||||
    let error = null;
 | 
					    let error = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let drawDuration = $appState.config.rehide_ms >= 750 ? 500 : 0;
 | 
				
			||||||
 | 
					    let fadeDuration = drawDuration * 0.6;
 | 
				
			||||||
 | 
					    let fadeDelay = drawDuration * 0.4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async function respond() {
 | 
					    async function respond() {
 | 
				
			||||||
        let response = {
 | 
					        let response = {
 | 
				
			||||||
            id: $appState.currentRequest.id,
 | 
					            id: $appState.currentRequest.id,
 | 
				
			||||||
@@ -23,22 +27,21 @@
 | 
				
			|||||||
            await invoke('respond', {response});
 | 
					            await invoke('respond', {response});
 | 
				
			||||||
            success = true;
 | 
					            success = true;
 | 
				
			||||||
            $appState.currentRequest = null;
 | 
					            $appState.currentRequest = null;
 | 
				
			||||||
            window.setTimeout(() => navigate('Home'), 1000);
 | 
					
 | 
				
			||||||
 | 
					            window.setTimeout(
 | 
				
			||||||
 | 
					                () => navigate('Home'),
 | 
				
			||||||
 | 
					                // Extra 50ms so the window can finish disappearing before the screen changes
 | 
				
			||||||
 | 
					                Math.min(5000, $appState.config.rehide_ms + 50),
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        catch (e) {
 | 
					        catch (e) {
 | 
				
			||||||
            error = e;
 | 
					            error = e;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    onMount(respond);
 | 
					    onMount(respond);
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<style>
 | 
					 | 
				
			||||||
    :global(body) {
 | 
					 | 
				
			||||||
        overflow: hidden;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
</style>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
{#if error}
 | 
					{#if error}
 | 
				
			||||||
    <div class="flex flex-col h-screen items-center justify-center m-auto max-w-lg">
 | 
					    <div class="flex flex-col h-screen items-center justify-center m-auto max-w-lg">
 | 
				
			||||||
@@ -56,11 +59,11 @@
 | 
				
			|||||||
{:else if success}
 | 
					{:else if success}
 | 
				
			||||||
    <div class="flex flex-col h-screen items-center justify-center max-w-max m-auto">
 | 
					    <div class="flex flex-col h-screen items-center justify-center max-w-max m-auto">
 | 
				
			||||||
        <svg xmlns="http://www.w3.org/2000/svg" class="w-36 h-36" fill="none" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor">
 | 
					        <svg xmlns="http://www.w3.org/2000/svg" class="w-36 h-36" fill="none" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor">
 | 
				
			||||||
          <path in:draw="{{duration: 500}}" stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
 | 
					          <path in:draw="{{duration: drawDuration}}" stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
 | 
				
			||||||
        </svg>
 | 
					        </svg>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div in:fade="{{delay: 200, duration: 300}}" class="text-2xl font-bold">Approved!</div>
 | 
					        <div in:fade="{{duration: fadeDuration, delay: fadeDelay}}" class="text-2xl font-bold">Approved!</div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
{/if}
 | 
					{/if}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user