This commit is contained in:
trev 2025-03-19 06:47:48 -04:00
parent 26f77a992d
commit 5e6df3da7b
4 changed files with 30 additions and 17 deletions

View File

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { Haptics, ImpactStyle } from '@capacitor/haptics'; import { Haptics } from '@capacitor/haptics';
let { let {
focused = $bindable(false), focused = $bindable(false),

View File

@ -5,7 +5,7 @@
</script> </script>
<Sonner <Sonner
theme={"light"} theme={"dark"}
class="toaster group" class="toaster group"
toastOptions={{ toastOptions={{
classes: { classes: {

View File

@ -5,12 +5,12 @@
let { children } = $props(); let { children } = $props();
</script> </script>
<Toaster /> <Toaster class="break-all" position="top-right" />
<div class="flex flex-col h-screen"> <div class="flex flex-col h-screen">
<div id="header"></div> <div id="header"></div>
<div class="overflow-y-auto"> <div class="grow flex flex-col overflow-y-auto">
{@render children()} {@render children()}
</div> </div>
@ -20,11 +20,13 @@
<style> <style>
#header { #header {
height: var(--safe-area-inset-top); height: var(--safe-area-inset-top);
padding-bottom: 5px;
background-color: black; background-color: black;
} }
#footer { #footer {
height: var(--safe-area-inset-bottom); height: var(--safe-area-inset-bottom);
padding-top: 10px;
background-color: black; background-color: black;
} }
</style> </style>

View File

@ -1,6 +1,8 @@
<script lang="ts"> <script lang="ts">
import Button from '$lib/components/ui/button/button.svelte'; import Button from '$lib/components/ui/button/button.svelte';
import ScanCapture from '$lib/ScanCapture.svelte'; import ScanCapture from '$lib/ScanCapture.svelte';
import { Haptics, ImpactStyle } from '@capacitor/haptics';
import { toast } from 'svelte-sonner';
import { SvelteSet } from 'svelte/reactivity'; import { SvelteSet } from 'svelte/reactivity';
import { fade } from 'svelte/transition'; import { fade } from 'svelte/transition';
@ -10,31 +12,40 @@
function onscan(value: string) { function onscan(value: string) {
if (!list.has(value)) { if (!list.has(value)) {
list.add(value); list.add(value);
Haptics.impact({ style: ImpactStyle.Light });
toast(`${value}`);
} }
} }
</script> </script>
<ScanCapture {onscan} /> <ScanCapture {onscan} />
<div class="flex h-screen"> <div class="flex grow">
<div class="m-auto flex flex-col justify-center items-center gap-8 p-4"> <div class="m-auto flex flex-col justify-center items-center gap-8 p-4">
{#key count} {#key count}
<h1 in:fade class="decoration-sky text-9xl font-bold text-center underline-offset-4"> <h1
in:fade={{ duration: 200 }}
class="decoration-sky text-9xl font-bold text-center underline-offset-4"
>
{count} {count}
</h1> </h1>
{/key} {/key}
<div class="flex flex-wrap gap-2"> <div class="flex gap-2">
{#each list as value (value)}
<span>{value}</span>
{/each}
</div>
<Button <Button
class="w-28 cursor-pointer" class="w-28 cursor-pointer"
variant="outline"
onclick={() => { onclick={() => {
list.clear(); list.clear();
}}>Reset</Button }}>Reset</Button
> >
<Button
class="w-28 cursor-pointer"
onclick={() => {
list.clear();
toast.success("Scans added")
}}>Submit</Button
>
</div>
</div> </div>
</div> </div>