Skip to content

Commit

Permalink
Cleaner UX to share a cash config
Browse files Browse the repository at this point in the history
  • Loading branch information
fravan committed May 21, 2024
1 parent 7f045c0 commit 8943ede
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 60 deletions.
41 changes: 0 additions & 41 deletions src/lib/components/ProductForm.svelte

This file was deleted.

2 changes: 1 addition & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="max-w-screen-lg mx-auto">
<Header />

<main>
<main class="px-2">
<slot />
</main>
</div>
41 changes: 23 additions & 18 deletions src/routes/setup/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { createProductsStore } from '$lib/stores/products.svelte.js';
let store = createProductsStore();
let showingLink = $state(false);
</script>

<svelte:head>
Expand All @@ -14,23 +15,27 @@
</svelte:head>

<section>
<div class="flex justify-between gap-4 items-center">
<h2 class="text-xl font-bold">Configuration</h2>
</div>
{#if showingLink}
<div class="flex flex-col gap-2 items-center">
<p class="text-center">Partagez la caisse avec le QR code suivant</p>
<CashRegisterShareLink encodedProducts={store.encodedProducts} />
<Button variant="primary" onclick={() => (showingLink = false)}
>Revenir à la configuration</Button
>
</div>
{:else}
<table class="w-full">
<thead><ProductHeaderRow onAddClick={store.addNewProduct} /></thead>
<tbody>
{#each store.products as _, i}
<ProductRow bind:product={store.products[i]} onDelete={store.removeProduct} />
{/each}
</tbody>
</table>

<table class="w-full">
<thead><ProductHeaderRow onAddClick={store.addNewProduct} /></thead>
<tbody>
{#each store.products as p}
<ProductRow bind:product={p} onDelete={store.removeProduct} />
{/each}
</tbody>
</table>

<div class="my-8">
<Button variant="primary" onclick={store.clear}>Supprimer tous les produits</Button>
</div>
<!--
<CashRegisterShareLink encodedProducts={store.encodedProducts} />
-->
<div class="my-8 flex flex-col md:flex-row gap-2">
<Button variant="outline" onclick={store.clear}>Supprimer tous les produits</Button>
<Button variant="primary" onclick={() => (showingLink = true)}>Partager la caisse</Button>
</div>
{/if}
</section>

0 comments on commit 8943ede

Please sign in to comment.