change frontpage image and toast animation

This commit is contained in:
Joseph Montanaro 2023-04-28 22:34:50 -07:00
parent b761d3b493
commit e746963052
7 changed files with 190 additions and 911 deletions

153
src/assets/vault_door.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -7,6 +7,9 @@
export let alt = false; export let alt = false;
export let shift = false; export let shift = false;
let classes = "";
export {classes as class};
function click() { function click() {
if (typeof target === 'string') { if (typeof target === 'string') {
navigate(target); navigate(target);
@ -38,6 +41,6 @@
<svelte:window on:keydown={handleHotkey} /> <svelte:window on:keydown={handleHotkey} />
<a href="#" on:click="{click}"> <a href="#" on:click="{click}" class={classes}>
<slot></slot> <slot></slot>
</a> </a>

View File

@ -1,10 +1,12 @@
<script> <script>
import Link from './Link.svelte'; import Link from './Link.svelte';
import Icon from './Icon.svelte'; import Icon from './Icon.svelte';
export let position = "sticky";
</script> </script>
<nav class="fixed top-0 grid grid-cols-2 w-full p-2"> <nav class="{position} top-0 bg-base-100 w-full flex justify-between items-center p-2">
<div> <div>
<Link target="Home"> <Link target="Home">
<button class="btn btn-square btn-ghost align-middle"> <button class="btn btn-square btn-ghost align-middle">
@ -13,7 +15,11 @@
</Link> </Link>
</div> </div>
<div class="justify-self-end"> {#if $$slots.title}
<slot name="title"></slot>
{/if}
<div>
<Link target="Settings"> <Link target="Settings">
<button class="btn btn-square btn-ghost align-middle "> <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" />

View File

@ -8,6 +8,8 @@
import Icon from '../ui/Icon.svelte'; import Icon from '../ui/Icon.svelte';
import Link from '../ui/Link.svelte'; import Link from '../ui/Link.svelte';
import vaultDoorSvg from '../assets/vault_door.svg?raw';
onMount(async () => { onMount(async () => {
// will block until a request comes in // will block until a request comes in
@ -18,24 +20,31 @@
</script> </script>
<Nav /> <Nav position="fixed">
<h2 slot="title" class="text-3xl font-bold">Creddy</h2>
</Nav>
<div class="flex flex-col h-screen items-center justify-center p-4 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={closedPadlockUrl} alt="A locked padlock" class="w-32" /> -->
{@html vaultDoorSvg}
<h2 class="text-2xl font-bold">Creddy is locked</h2> <h2 class="text-2xl font-bold">Creddy is locked</h2>
<Link target="Unlock"> <Link target="Unlock" class="w-64">
<button class="btn btn-primary">Unlock</button> <button class="btn btn-primary w-full">Unlock</button>
</Link> </Link>
{:else if status === 'unlocked'} {:else if status === 'unlocked'}
<img src="/static/padlock-open.svg" alt="An unlocked padlock" class="w-24" /> {@html vaultDoorSvg}
<h2 class="text-2xl font-bold">Waiting for requests</h2> <h2 class="text-2xl font-bold">Waiting for requests</h2>
{:else if status === 'empty'} {:else if status === 'empty'}
<Link target="EnterCredentials"> {@html vaultDoorSvg}
<button class="btn btn-primary">Enter Credentials</button> <h2 class="text-2xl font-bold">No credentials found</h2>
<Link target="EnterCredentials" class="w-64">
<button class="btn btn-primary w-full">Enter Credentials</button>
</Link> </Link>
{/if} {/if}
{/await} {/await}

View File

@ -7,6 +7,9 @@
import ErrorAlert from '../ui/ErrorAlert.svelte'; import ErrorAlert from '../ui/ErrorAlert.svelte';
import { Setting, ToggleSetting, NumericSetting } from '../ui/settings'; import { Setting, ToggleSetting, NumericSetting } from '../ui/settings';
import { fly } from 'svelte/transition';
import { backInOut } from 'svelte/easing';
let error = null; let error = null;
async function save() { async function save() {
@ -21,11 +24,13 @@
</script> </script>
<Nav /> <Nav>
<h2 slot="title" class="text-2xl font-bold">Settings</h2>
</Nav>
{#await invoke('get_config') then config} {#await invoke('get_config') then config}
<div class="max-w-md mx-auto mt-1.5 p-4"> <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 on login" bind:value={$appState.config.start_on_login} on:update={save}> <ToggleSetting title="Start on login" bind:value={$appState.config.start_on_login} on:update={save}>
<svelte:fragment slot="description"> <svelte:fragment slot="description">
@ -66,8 +71,8 @@
{/await} {/await}
{#if error} {#if error}
<div class="toast"> <div transition:fly={{y: 100, easing: backInOut, duration: 400}} class="toast">
<div class="alert alert-error"> <div class="alert alert-error no-animation">
<div> <div>
<span>{error}</span> <span>{error}</span>
</div> </div>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 34 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 46 KiB