From 41a6782422be8b204c3e12e668af6874fecd3b9b Mon Sep 17 00:00:00 2001 From: bachrc Date: Thu, 14 Nov 2024 12:00:27 +0000 Subject: [PATCH] feat: la pagination fonctionne MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit il ne reste plus qu'à styliser un peu tout --- Dockerfile | 2 +- src/components/ListeExtractions.svelte | 35 ++++++++++++++++++-------- src/components/Pagination.svelte | 28 +++++++++++++++++++++ src/components/Recherche.svelte | 0 src/lib/schemas.ts | 2 +- src/routes/+page.svelte | 5 ++-- 6 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 src/components/Pagination.svelte create mode 100644 src/components/Recherche.svelte diff --git a/Dockerfile b/Dockerfile index bacdf62..48eae67 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN unzip /tmp/pb.zip -d /pb/ # download deno RUN mkdir -p /home/wizou/.local/bin ENV PATH=$PATH:/home/wizou/.local/bin -COPY --from=denoland/deno:bin-2.0.2 --chown=wizou:wizou /deno /home/wizou/.local/bin +COPY --from=denoland/deno:bin-2.0.6 --chown=wizou:wizou /deno /home/wizou/.local/bin FROM base AS build diff --git a/src/components/ListeExtractions.svelte b/src/components/ListeExtractions.svelte index 284b725..51aa356 100644 --- a/src/components/ListeExtractions.svelte +++ b/src/components/ListeExtractions.svelte @@ -1,18 +1,33 @@
- {#await data} - - {:then extractions} - {#each extractions.items as extraction} - - {/each} - {/await} +
+ + 🔍 +
+ {#each extractions as extraction} + + {/each} + +
+ +
diff --git a/src/components/Pagination.svelte b/src/components/Pagination.svelte new file mode 100644 index 0000000..bc6e04c --- /dev/null +++ b/src/components/Pagination.svelte @@ -0,0 +1,28 @@ + + +
+ {#if props.page > 1} + ⬅️ Page précédente + {/if} + + {#if props.page < props.totalPages} + Page suivante ➡️ + {/if} +
diff --git a/src/components/Recherche.svelte b/src/components/Recherche.svelte new file mode 100644 index 0000000..e69de29 diff --git a/src/lib/schemas.ts b/src/lib/schemas.ts index ea2dfd1..f74b600 100644 --- a/src/lib/schemas.ts +++ b/src/lib/schemas.ts @@ -6,7 +6,7 @@ export const loginSchema = z.object({ }); export const creationExtractionSchema = z.object({ - nom: z.string().min(5).max(50), + nom: z.string().min(5).max(100), poids_cafe: z.number().positive(), poids_boisson: z.number().positive(), utilisateur: z.string(), diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index d725622..4208f8f 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -3,14 +3,15 @@ import { currentUser } from '$lib/login.svelte'; import GrosBouton from '../components/GrosBouton.svelte'; import ListeExtractions from '../components/ListeExtractions.svelte'; + import Recherche from '../components/Recherche.svelte'; -
+
{#if currentUser.value != null} goto('/new')}> ➕ Nouvelle extraction - + {:else} Salut ! Ici on fait du café !