-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
il ne reste plus qu'à styliser un peu tout
- Loading branch information
Showing
6 changed files
with
58 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
<script lang="ts"> | ||
import { pb } from '$lib/database'; | ||
import { getExtractions, type Extraction } from '$lib/extractions'; | ||
import Loader from './Loader.svelte'; | ||
import { onMount } from 'svelte'; | ||
import { page } from '$app/stores'; | ||
import Pagination from './Pagination.svelte'; | ||
import ResumeExtraction from './ResumeExtraction.svelte'; | ||
let data = getExtractions(1, 20); | ||
let extractions: Extraction[] = $state([]); | ||
let pageEnCours = $derived(parseInt($page.url.searchParams.get('page') ?? '1')); | ||
let elementsParPage = $derived(parseInt($page.url.searchParams.get('elementsParPage') ?? '3')); | ||
let totalPages = $state(0); | ||
$effect(() => { | ||
getExtractions(pageEnCours, elementsParPage).then((data) => { | ||
extractions = data.items as Extraction[]; | ||
totalPages = data.totalPages; | ||
}); | ||
}); | ||
</script> | ||
|
||
<div class="w-full flex flex-col"> | ||
{#await data} | ||
<Loader /> | ||
{:then extractions} | ||
{#each extractions.items as extraction} | ||
<ResumeExtraction extraction={extraction as Extraction} /> | ||
{/each} | ||
{/await} | ||
<div class="flex flex-row items-center h-12 rounded-3xl bg-white border"> | ||
<input type="text" class="grow h-full rounded-l-3xl px-4 border-r" /> | ||
<span class="px-2">🔍</span> | ||
</div> | ||
{#each extractions as extraction} | ||
<ResumeExtraction extraction={extraction as Extraction} /> | ||
{/each} | ||
|
||
<div> | ||
<Pagination page={pageEnCours} {totalPages} /> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<script lang="ts"> | ||
import { page } from '$app/stores'; | ||
let props: { | ||
page: number; | ||
totalPages: number; | ||
} = $props(); | ||
function currentUrlWithPage(pageNumber: number): string { | ||
let params = new URLSearchParams($page.url.searchParams.toString()); | ||
params.set('page', pageNumber.toString()); | ||
return `?${params.toString()}`; | ||
} | ||
let pagePrecedente = $derived(props.page - 1); | ||
let pageSuivante = $derived(props.page + 1); | ||
</script> | ||
|
||
<div class="flex flex-row"> | ||
{#if props.page > 1} | ||
<a href={currentUrlWithPage(pagePrecedente)}><span>⬅️ Page précédente</span></a> | ||
{/if} | ||
|
||
{#if props.page < props.totalPages} | ||
<a href={currentUrlWithPage(pageSuivante)}><span>Page suivante ➡️</span></a> | ||
{/if} | ||
</div> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters