dropped tba api, results done, missing pictures
This commit is contained in:
		| @@ -1,13 +1,75 @@ | ||||
| <script lang="ts"> | ||||
| 	import type { PageData } from './$types'; | ||||
| 	import Year from './Year.svelte'; | ||||
|  | ||||
| 	export let data: PageData; | ||||
| 	const events = data.events; | ||||
| </script> | ||||
|  | ||||
| <div class="container"> | ||||
| 	{#each $events as year} | ||||
| 		<Year {year} /> | ||||
| 	{/each} | ||||
| 	<article> | ||||
| 		<header>Saison 2022</header> | ||||
| 		<strong>Festival de robotique de Montréal (Jour 3)</strong> | ||||
| 		<ul> | ||||
| 			<li>11e en qualification</li> | ||||
| 		</ul> | ||||
| 	</article> | ||||
| 	<article> | ||||
| 		<header>Saison 2020</header> | ||||
| 		<strong>Festival de robotique de Sherbrooke</strong> | ||||
| 		<ul> | ||||
| 			<li>18e en qualification</li> | ||||
| 			<li>Finaliste Prix Liste de Dean Kamen (Édouard Moffet)</li> | ||||
| 			<li>Prix du Professionnalisme coopératif</li> | ||||
| 		</ul> | ||||
| 	</article> | ||||
| 	<article> | ||||
| 		<header>Saison 2019</header> | ||||
| 		<strong>Festival de robotique de Québec</strong> | ||||
| 		<ul> | ||||
| 			<li>1er en qualification</li> | ||||
| 			<li>Alliance finaliste</li> | ||||
| 		</ul> | ||||
| 		<strong>Championnat Mondial de Détroit (Tesla)</strong> | ||||
| 		<ul> | ||||
| 			<li>21e en qualification</li> | ||||
| 		</ul> | ||||
| 	</article> | ||||
| 	<article> | ||||
| 		<header>Saison 2018</header> | ||||
| 		<strong>Festival de robotique de Montréal</strong> | ||||
| 		<ul> | ||||
| 			<li>9e en qualification</li> | ||||
| 			<li>Finalise Prix Liste de Dean Kamen (Olivier Demers)</li> | ||||
| 		</ul> | ||||
| 	</article> | ||||
| 	<article> | ||||
| 		<header>Saison 2017</header> | ||||
| 		<strong>Festival de robotique de Montréal</strong> | ||||
| 		<ul> | ||||
| 			<li>18e en qualification</li> | ||||
| 			<li>Alliance finaliste</li> | ||||
| 			<li>Prix de l'inspiration en ingénierie</li> | ||||
| 		</ul> | ||||
| 		<strong>Championnat Mondial de St. Louis (Carson)</strong> | ||||
| 		<ul> | ||||
| 			<li>47e en qualification</li> | ||||
| 		</ul> | ||||
| 	</article> | ||||
| 	<article> | ||||
| 		<header>Saison 2016</header> | ||||
| 		<strong>Festival de robotique de Montréal</strong> | ||||
| 		<ul> | ||||
| 			<li>1er en qualification</li> | ||||
| 			<li>Alliance championne</li> | ||||
| 			<li>Prix de l'entrepreneuriat</li> | ||||
| 		</ul> | ||||
| 		<strong>Championnat Mondial de St. Louis (Hopper)</strong> | ||||
| 		<ul> | ||||
| 			<li>15e en qualification</li> | ||||
| 		</ul> | ||||
| 	</article> | ||||
| 	<article> | ||||
| 		<header>Saison 2015</header> | ||||
| 		<strong>Festival de robotique de Montréal</strong> | ||||
| 		<ul> | ||||
| 			<li>5e en qualification</li> | ||||
| 			<li>Prix de l’Équipe recrue la mieux classée en qualifications</li> | ||||
| 		</ul> | ||||
| 	</article> | ||||
| </div> | ||||
|   | ||||
| @@ -1,34 +0,0 @@ | ||||
| import { events } from './EventsStore'; | ||||
| import type { PageLoad } from './$types'; | ||||
| import type { Events, Event } from './EventsStore'; | ||||
|  | ||||
| export const load = (async ({ fetch }) => { | ||||
| 	events.reset(); | ||||
| 	const years_response = await fetch( | ||||
| 		'https://www.thebluealliance.com/api/v3/team/frc5618/years_participated', | ||||
| 		{ | ||||
| 			method: 'GET', | ||||
| 			headers: { | ||||
| 				'X-TBA-Auth-Key': '6oQL4iTAIFO0tc5xmRSWVQoNlgm5jpB5x4YZBdqhGTFJjqfqM6XV53s8FBAEiXOJ' | ||||
| 			} | ||||
| 		} | ||||
| 	); | ||||
| 	const years: Array<number> = await years_response.json(); | ||||
| 	years.reverse().forEach(async (year) => { | ||||
| 		const events_response = await fetch( | ||||
| 			`https://www.thebluealliance.com/api/v3/team/frc5618/events/${year}/simple`, | ||||
| 			{ | ||||
| 				method: 'GET', | ||||
| 				headers: { | ||||
| 					'X-TBA-Auth-Key': '6oQL4iTAIFO0tc5xmRSWVQoNlgm5jpB5x4YZBdqhGTFJjqfqM6XV53s8FBAEiXOJ' | ||||
| 				} | ||||
| 			} | ||||
| 		); | ||||
| 		const year_events: Array<Event> = await events_response.json(); | ||||
| 		const response: Events = { year, events_list: year_events }; | ||||
| 		events.insert(response); | ||||
| 	}); | ||||
| 	return { | ||||
| 		events | ||||
| 	}; | ||||
| }) satisfies PageLoad; | ||||
| @@ -1,7 +0,0 @@ | ||||
| <script lang="ts"> | ||||
| 	import type { Event } from './EventsStore'; | ||||
|  | ||||
| 	export let event: Event; | ||||
| </script> | ||||
|  | ||||
| <div>{event.name}</div> | ||||
| @@ -1,39 +0,0 @@ | ||||
| import { writable } from 'svelte/store'; | ||||
|  | ||||
| function createCount() { | ||||
| 	const { subscribe, set, update } = writable(new Array<Events>()); | ||||
|  | ||||
| 	return { | ||||
| 		subscribe, | ||||
| 		insert: (events: Events) => { | ||||
| 			update((n) => [...n, events]); | ||||
| 		}, | ||||
| 		reset: () => set([]) | ||||
| 	}; | ||||
| } | ||||
|  | ||||
| export const events = createCount(); | ||||
|  | ||||
| export type Event = { | ||||
| 	key: string; | ||||
| 	name: string; | ||||
| 	event_code: string; | ||||
| 	event_type: string; | ||||
| 	district: { | ||||
| 		abbreviation: string; | ||||
| 		display_name: string; | ||||
| 		key: string; | ||||
| 		year: number; | ||||
| 	}; | ||||
| 	city: string; | ||||
| 	state_prov: string; | ||||
| 	country: string; | ||||
| 	start_date: string; | ||||
| 	end_date: string; | ||||
| 	year: number; | ||||
| }; | ||||
|  | ||||
| export type Events = { | ||||
| 	year: number; | ||||
| 	events_list: Array<Event>; | ||||
| }; | ||||
| @@ -1,16 +0,0 @@ | ||||
| <script lang="ts"> | ||||
| 	import { each } from 'svelte/internal'; | ||||
| 	import Event from './Event.svelte'; | ||||
| 	import type { Events } from './EventsStore'; | ||||
|  | ||||
| 	export let year: Events; | ||||
| </script> | ||||
|  | ||||
| <div class="container"> | ||||
| 	<article> | ||||
| 		<header>{year.year}</header> | ||||
| 		{#each year.events_list as event} | ||||
| 			<Event {event} /> | ||||
| 		{/each} | ||||
| 	</article> | ||||
| </div> | ||||
		Reference in New Issue
	
	Block a user