diff --git a/src/lib/components/BudgetConnexionModal.svelte b/src/lib/components/BudgetConnexionModal.svelte index afb27f2f109261c2ec66a8f5623e6414dbacdd35..e7d3932ca128c9af1221e0209cb15ef217e2ba7e 100644 --- a/src/lib/components/BudgetConnexionModal.svelte +++ b/src/lib/components/BudgetConnexionModal.svelte @@ -10,6 +10,7 @@ import type { Writable } from "svelte/types/runtime/store" import { browser } from "$app/environment" + import { goto } from "$app/navigation" import { page } from "$app/stores" import { hashObject } from "$lib/hash" import type { ParametricReform } from "$lib/reforms" @@ -246,17 +247,16 @@ </tr> {/each} </table> - <a + <button class="mt-2 flex items-center gap-3 py-2 px-5 hover:bg-gray-200 active:bg-gray-300 rounded-md underline text-gray-600 text-sm font-bold tracking-[0.085em] uppercase" - data-sveltekit-reload - href="/" title="Voir toutes les simulations" + on:click={() => goto("/simulations_budget")} > Voir toutes les simulations<iconify-icon class="align-[-0.25rem] text-xl" icon="ri-arrow-right-line" /> - </a> + </button> </div> {/if} </div> diff --git a/src/routes/simulations_budget/+page.svelte b/src/routes/simulations_budget/+page.svelte new file mode 100644 index 0000000000000000000000000000000000000000..e08e42cc31818b5855f9ba3026b97f7788987e3d --- /dev/null +++ b/src/routes/simulations_budget/+page.svelte @@ -0,0 +1,57 @@ +<script lang="ts"> + import { onMount } from "svelte" + + import { goto } from "$app/navigation" + import type { CachedSimulation } from "$lib/simulations" + + let cachedSimulations: CachedSimulation[] = [] + + onMount(async () => { + const res = await fetch("/simulations_budget/index", { + method: "POST", + }) + if (!res.ok) { + console.error(`Error fetching cached simulations`) + return + } + const { index } = await res.json() + cachedSimulations = index + }) +</script> + +<main class="bg-graph-paper h-full flex items-center justify-center"> + <div class="w-full h-full max-w-screen-md bg-white p-10"> + <button + class="inline-flex items-center gap-2 py-2 px-5 bg-white hover:bg-gray-100 active:bg-gray-200 rounded-md border border-gray-700 text-gray-700 text-sm font-bold tracking-[0.085em] uppercase" + title="Retour au simulateur" + on:click={() => goto("/")} + > + <iconify-icon + class="align-[-0.25rem] text-xl" + icon="ri-arrow-left-line" + /> + <span class="ml-2">Retour au simulateur</span> + </button> + + <h2 class="mt-10 w-full text-left text-xl font-bold"> + Simulations budgétaires déjà disponibles : + </h2> + + <table class="w-full text-sm mt-5"> + {#each cachedSimulations as cachedSimulation} + <tr class="even:bg-white even:bg-opacity-30 odd:bg-gray-200"> + <td class="pl-3 pr-10 py-2 text-start">{cachedSimulation.date}</td> + <td class="py-2 text-start font-bold font-serif" + >{cachedSimulation.title}</td + > + <td class="pl-10 pr-3 py-2 text-end" + ><a + href="/simulations_budget/{cachedSimulation.hash}" + class="underline text-gray-600">Voir cette simulation</a + ></td + > + </tr> + {/each} + </table> + </div> +</main> diff --git a/src/routes/variables/[variable]/+page.svelte b/src/routes/variables/[variable]/+page.svelte index 206c3af2335fd5c9bffb1863d4236bb1e0dbbea2..b1cfc82a322a75261ee8af3806b624d55a84e110 100644 --- a/src/routes/variables/[variable]/+page.svelte +++ b/src/routes/variables/[variable]/+page.svelte @@ -99,13 +99,13 @@ <main class="bg-polka-dots flex items-center justify-center"> <div class="max-w-screen-md bg-white"> - <button + <a class="ml-10 mt-5 inline-flex cursor-pointer items-center rounded bg-gray-200 p-2 pr-3 text-sm text-black shadow-md hover:bg-gray-300 active:bg-gray-400" - on:click={() => history.back()} + href="/" > <iconify-icon class="text-2xl" icon="ri-arrow-left-line" /> <span class="ml-3">Retour au simulateur</span> - </button> + </a> <VariableView date={$date} editable diff --git a/tailwind.config.cjs b/tailwind.config.cjs index f998c94baaa5b56431fb9b87a9edac88ab005cdb..20626bd5981799a9b07a4fcc96f3c9b1f9611ffe 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -28,10 +28,13 @@ const config = { }, backgroundImage: { /* Graph paper - Heropatterns.com échelle réduite */ - "graph-paper": "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='50' viewBox='0 0 100 100'%3E%3Crect width='100%' height='100%' fill='%23fff'/%3E%3Cg fill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-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E\")", + "graph-paper": + "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='50' viewBox='0 0 100 100'%3E%3Crect width='100%' height='100%' fill='%23fff'/%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23ded500' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E\")", /* Polka dots - Heropatterns.com échelle réduite */ - "polka-dots": "url(\"data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%' height='100%' fill='%23fff'/%3E%3Cg fill='%23ded500' fill-opacity='0.4' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E\")", - "diagonal-stripes": "url(\"data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='1' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E\")" + "polka-dots": + "url(\"data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%' height='100%' fill='%23fff'/%3E%3Cg fill='%23ded500' fill-opacity='0.4' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E\")", + "diagonal-stripes": + "url(\"data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='1' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E\")", }, blur: { xs: "1.2px",