diff --git a/src/app.html b/src/app.html index 88d12e6f91849bf67674b177d44f98a84716f6a9..6c3b55845e0b64387929e7c69a5ebb45ae064bc8 100644 --- a/src/app.html +++ b/src/app.html @@ -4,6 +4,19 @@ <meta charset="utf-8" /> <link rel="icon" href="%sveltekit.assets%/favicon.png" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> + + <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> + <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" /> + <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" /> + <link rel="manifest" href="/site.webmanifest" /> + <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" /> + <meta name="apple-mobile-web-app-title" content="Qui est-ce ?" /> + <meta name="application-name" content="Qui est-ce ?" /> + <meta name="msapplication-TileColor" content="#2b5797" /> + <meta name="theme-color" content="#ffffff" /> + + <title>Qui est-ce ?</title> + %sveltekit.head% </head> <body data-sveltekit-preload-data="hover"> diff --git a/src/routes/quiz/new/+page.server.ts b/src/routes/quiz/new/+page.server.ts index 8eeb72bd2ebbf4d863b168f5fa43c7652f500bdc..3494569af693595b2ea515909d235523dbc23a4e 100644 --- a/src/routes/quiz/new/+page.server.ts +++ b/src/routes/quiz/new/+page.server.ts @@ -16,10 +16,13 @@ type BaseLevel = { type Level = BaseLevel & { size: number; + disabled: boolean; }; const VIIEUX_YEAR = 20; +const MINIMUM_SIZE = 15; + export async function load(event) { const game = new Game(event.cookies); @@ -72,13 +75,15 @@ export async function load(event) { ]; const promoSizes = await Promise.all( - Array.from(new Array(VIIEUX_YEAR), (_, i) => getPromotion(i + 1).then((promo) => promo.size)) + Array.from(new Array(VIIEUX_YEAR+1), (_, i) => getPromotion(i).then((promo) => promo.size)) ); const levels: Level[] = baseLevels.map((level) => { const end = (level.maxYear ?? level.year) + 1; + const size = promoSizes.slice(level.year, end).reduce(sum, 0); return { - size: promoSizes.slice(level.year, end).reduce(sum, 0), + size, + disabled: size < MINIMUM_SIZE, ...level }; }); @@ -95,6 +100,11 @@ export const actions = { return fail(400, { form }); } + const promotion = await getPromotion(form.data.year); + if (promotion.size < MINIMUM_SIZE) { + return fail(400, { form }); + } + const state = new Game(event.cookies); state.state.year = form.data.year; diff --git a/src/routes/quiz/new/+page.svelte b/src/routes/quiz/new/+page.svelte index da4628add3d09c66d134acc203ca60dd9f024150..74c17d35793bc66ee51576a21b4e4e07a4410339 100644 --- a/src/routes/quiz/new/+page.svelte +++ b/src/routes/quiz/new/+page.svelte @@ -32,7 +32,8 @@ </Field> <button type="submit" - class="col-span-1 flex h-36 w-36 flex-col divide-y divide-gray-200 rounded-2xl border-6 border-solid border-zinc-800 bg-slate-100 text-center shadow transition-[0.45s] hover:translate-y-[-3px] hover:bg-slate-300 focus:border-indigo-500 sm:h-72 sm:w-72" + disabled={level.disabled} + class="col-span-1 flex h-36 w-36 flex-col divide-y divide-gray-200 rounded-2xl border-6 border-solid border-zinc-800 bg-red-300 cursor-not-allowed enabled:cursor-pointer enabled:bg-slate-100 text-center shadow transition-[0.45s] enabled:hover:translate-y-[-3px] enabled:hover:bg-slate-300 enabled:focus:border-indigo-500 sm:h-72 sm:w-72" > <div class="flex flex-1 flex-col p-2 sm:p-8"> <img class="mx-auto h-16 flex-shrink-0 sm:h-32 sm:w-32" src={level.image} alt="" /> diff --git a/static/android-chrome-192x192.png b/static/android-chrome-192x192.png new file mode 100644 index 0000000000000000000000000000000000000000..ea5ec7ca022464d4551160edf93b938926f60516 Binary files /dev/null and b/static/android-chrome-192x192.png differ diff --git a/static/android-chrome-256x256.png b/static/android-chrome-256x256.png new file mode 100644 index 0000000000000000000000000000000000000000..4eecf230a5dd9b2f7156fa4a3af08aa944f4512e Binary files /dev/null and b/static/android-chrome-256x256.png differ diff --git a/static/apple-touch-icon.png b/static/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..66821cb9f5e5d4e997173d5a7d19b18bb06e614c Binary files /dev/null and b/static/apple-touch-icon.png differ diff --git a/static/browserconfig.xml b/static/browserconfig.xml new file mode 100644 index 0000000000000000000000000000000000000000..f9c2e67fe6a04c5aa35d5d0be293f003c2f7e7da --- /dev/null +++ b/static/browserconfig.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<browserconfig> + <msapplication> + <tile> + <square150x150logo src="/mstile-150x150.png"/> + <TileColor>#2b5797</TileColor> + </tile> + </msapplication> +</browserconfig> diff --git a/static/favicon-16x16.png b/static/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..501cef154580871c724de6040787345bbad086ff Binary files /dev/null and b/static/favicon-16x16.png differ diff --git a/static/favicon-32x32.png b/static/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..b50745ac8f290a0d2d3d94810a0590e19eb4c2ff Binary files /dev/null and b/static/favicon-32x32.png differ diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..0bb7c7866e5ee0aaaa0403f8f30ffb562d179dd7 Binary files /dev/null and b/static/favicon.ico differ diff --git a/static/icon.png b/static/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..7e165a1e3f5530e7649e3c0ad19c1a5c0c41a33b Binary files /dev/null and b/static/icon.png differ diff --git a/static/mstile-150x150.png b/static/mstile-150x150.png new file mode 100644 index 0000000000000000000000000000000000000000..3d667fb07cec866e01c84761da09a38f6bc7804c Binary files /dev/null and b/static/mstile-150x150.png differ diff --git a/static/safari-pinned-tab.svg b/static/safari-pinned-tab.svg new file mode 100644 index 0000000000000000000000000000000000000000..68c9426fd851e8dd75991c98922c483c648f185a --- /dev/null +++ b/static/safari-pinned-tab.svg @@ -0,0 +1,24 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" + "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> +<svg version="1.0" xmlns="http://www.w3.org/2000/svg" + width="256.000000pt" height="256.000000pt" viewBox="0 0 256.000000 256.000000" + preserveAspectRatio="xMidYMid meet"> +<metadata> +Created by potrace 1.14, written by Peter Selinger 2001-2017 +</metadata> +<g transform="translate(0.000000,256.000000) scale(0.100000,-0.100000)" +fill="#000000" stroke="none"> +<path d="M1101 2309 c-29 -5 -95 -23 -145 -40 -362 -121 -624 -435 -686 -821 +-18 -113 -8 -342 19 -438 28 -95 107 -258 160 -330 162 -216 381 -356 646 +-411 77 -16 293 -16 370 0 331 69 591 269 735 566 73 148 91 224 97 393 6 160 +-5 251 -44 377 -104 331 -360 581 -698 681 -77 22 -113 27 -245 30 -85 1 -179 +-1 -209 -7z m350 -371 c207 -98 286 -310 191 -511 -30 -65 -108 -169 -206 +-274 l-58 -63 -134 0 c-74 0 -134 2 -134 5 0 3 41 53 90 111 157 183 196 259 +179 351 -11 55 -38 95 -87 125 -30 19 -51 23 -112 23 -65 0 -85 -5 -141 -32 +-36 -18 -86 -51 -111 -72 l-45 -40 -6 137 c-6 159 -6 158 96 213 99 53 176 70 +298 66 97 -3 112 -6 180 -39z m-129 -1054 c14 -8 37 -28 50 -46 31 -45 33 +-143 2 -184 -33 -45 -70 -67 -121 -71 -113 -11 -202 90 -173 198 28 104 143 +153 242 103z"/> +</g> +</svg> diff --git a/static/site.webmanifest b/static/site.webmanifest new file mode 100644 index 0000000000000000000000000000000000000000..a274be8b8050230275db428990e3525cb35b7b3f --- /dev/null +++ b/static/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "Qui est-ce ?", + "short_name": "Qui est-ce ?", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-256x256.png", + "sizes": "256x256", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +}