misc: removed old routes

This commit is contained in:
Théo 2023-09-13 17:23:22 +02:00
parent bf6c76554f
commit e08bbaae50
2 changed files with 0 additions and 144 deletions

View file

@ -1,45 +0,0 @@
import type { PageServerLoad } from './$types';
import { API_URL } from '$env/static/private';
import type { Chapter, Puzzle } from '$lib/types';
export const load = (async ({ parent, fetch, cookies }) => {
await parent();
const session = cookies.get('session');
const res = await fetch(`${API_URL}/chapters`, {
headers: {
Authorization: `Bearer ${session}`
}
});
if (!res.ok) {
return {
chapters: []
};
}
const chapters = (await res.json()) as Chapter[];
for (const chapter of chapters) {
chapter.puzzles = [];
const res = await fetch(`${API_URL}/chapter/${chapter.id}`, {
headers: {
Authorization: `Bearer ${session}`
}
});
if (!res.ok) continue;
let { puzzles } = (await res.json()) as { puzzles: Puzzle[] };
puzzles = puzzles.sort((a, b) => a.scoreMax - b.scoreMax);
chapter.puzzles = puzzles;
}
return {
chapters
};
}) satisfies PageServerLoad;

View file

@ -1,99 +0,0 @@
<script lang="ts">
import Puzzle from '$lib/components/Puzzle.svelte';
export let data;
$: chapters = data.chapters;
</script>
<section class="flex w-full flex-col space-y-6">
{#each chapters as chapter}
<div class="flex flex-col">
<div class="flex flex-col justify-between md:flex-row md:items-center">
<div class="flex items-center gap-x-2">
<h1 class="text-xl font-semibold">{chapter.name}</h1>
<!-- {!isInEventGroup(chapter) && isBeforeStart(chapter) && (
<Dialog
key={chapter.id}
title={chapter.name}
open={isOpen[chapter.id]}
onOpenChange={() => handleClick(chapter.id)}
trigger={
<button class="flex items-center gap-x-2 text-sm font-semibold text-muted hover:text-brand">
{/* <Icon name="group-line" /> */}
Rejoindre un groupe
</button>
}
class="right-96 p-4"
>
<GroupForm chapter={chapter} token={token} />
</Dialog>
)} -->
</div>
<div class="flex flex-col">
{#if chapter.startDate && chapter.endDate}
<div class="flex items-center justify-start gap-x-2 md:justify-end">
<!-- {/* <Icon name="calendar-line" class="text-sm text-muted" /> */} -->
<span class="text-sm text-muted">
{new Date(chapter.startDate).toLocaleDateString('fr-FR', {
day: 'numeric',
month: 'long',
year: 'numeric',
hour: 'numeric',
minute: 'numeric'
})}{' '}
-{' '}
{new Date(chapter.endDate).toLocaleDateString('fr-FR', {
day: 'numeric',
month: 'long',
year: 'numeric',
hour: 'numeric',
minute: 'numeric'
})}
</span>
</div>
{:else}
<div class="h-1 w-1/4 rounded-lg bg-gray-200">
<div class="h-1 w-1/2 rounded-lg bg-gradient-to-tl from-brand to-brand-accent" />
</div>
{/if}
<div class="mt-1 flex justify-start gap-x-2">
<!-- {isInEventGroup(chapter) && (
<>
<FilterDifficulty
chapters={data}
chapter={chapter}
filter={filterDifficulty}
setFilter={setFilterDifficulty}
setFilterChapter={setFilterChapter}
/>
<FilterTags
chapters={data}
chapter={chapter}
filter={filterTags}
setFilter={setFilterTags}
setFilterChapter={setFilterChapter}
/>
</>
)} -->
</div>
</div>
</div>
<ul class="mt-4 flex flex-col space-y-4">
{#each chapter.puzzles as puzzle}
<Puzzle {puzzle} />
{/each}
</ul>
<!-- {isInEventGroup(chapter) && (
<ul class="mt-4 flex flex-col space-y-4">
{filteredData &&
filteredData
.sort((a, b) => a.scoreMax - b.scoreMax)
.map((puzzle) => (
<PuzzleProp key={puzzle.id} puzzle={puzzle} chapter={chapter} />
))}
</ul>
)} -->
</div>
{/each}
</section>