Lib: Remove SkeletonData schema and use correct PageData types instead
This commit is contained in:
@ -9,7 +9,7 @@
|
|||||||
type ToastStore,
|
type ToastStore,
|
||||||
} from "@skeletonlabs/skeleton";
|
} from "@skeletonlabs/skeleton";
|
||||||
import { Button, Input, Card, Dropdown } from "$lib/components";
|
import { Button, Input, Card, Dropdown } from "$lib/components";
|
||||||
import type { Driver, SkeletonData } from "$lib/schema";
|
import type { Driver } from "$lib/schema";
|
||||||
import { DRIVER_HEADSHOT_HEIGHT, DRIVER_HEADSHOT_WIDTH } from "$lib/config";
|
import { DRIVER_HEADSHOT_HEIGHT, DRIVER_HEADSHOT_WIDTH } from "$lib/config";
|
||||||
import { team_dropdown_options } from "$lib/dropdown";
|
import { team_dropdown_options } from "$lib/dropdown";
|
||||||
import { get_driver_headshot_template } from "$lib/database";
|
import { get_driver_headshot_template } from "$lib/database";
|
||||||
@ -17,10 +17,11 @@
|
|||||||
import { pb } from "$lib/pocketbase";
|
import { pb } from "$lib/pocketbase";
|
||||||
import { invalidateAll } from "$app/navigation";
|
import { invalidateAll } from "$app/navigation";
|
||||||
import { error } from "@sveltejs/kit";
|
import { error } from "@sveltejs/kit";
|
||||||
|
import type { PageData } from "../../../routes/data/season/drivers/$types";
|
||||||
|
|
||||||
interface DriverCardProps {
|
interface DriverCardProps {
|
||||||
/** Data passed from the page context */
|
/** Data passed from the page context */
|
||||||
data: SkeletonData;
|
data: PageData;
|
||||||
|
|
||||||
/** The [Driver] object used to prefill values. */
|
/** The [Driver] object used to prefill values. */
|
||||||
driver?: Driver;
|
driver?: Driver;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
type ToastStore,
|
type ToastStore,
|
||||||
} from "@skeletonlabs/skeleton";
|
} from "@skeletonlabs/skeleton";
|
||||||
import { Button, Card, Input } from "$lib/components";
|
import { Button, Card, Input } from "$lib/components";
|
||||||
import type { Race, SkeletonData } from "$lib/schema";
|
import type { Race } from "$lib/schema";
|
||||||
import { RACE_PICTOGRAM_HEIGHT, RACE_PICTOGRAM_WIDTH } from "$lib/config";
|
import { RACE_PICTOGRAM_HEIGHT, RACE_PICTOGRAM_WIDTH } from "$lib/config";
|
||||||
import { get_race_pictogram_template } from "$lib/database";
|
import { get_race_pictogram_template } from "$lib/database";
|
||||||
import { format_date } from "$lib/date";
|
import { format_date } from "$lib/date";
|
||||||
@ -16,10 +16,11 @@
|
|||||||
import { pb } from "$lib/pocketbase";
|
import { pb } from "$lib/pocketbase";
|
||||||
import { invalidateAll } from "$app/navigation";
|
import { invalidateAll } from "$app/navigation";
|
||||||
import { error } from "@sveltejs/kit";
|
import { error } from "@sveltejs/kit";
|
||||||
|
import type { PageData } from "../../../routes/data/season/races/$types";
|
||||||
|
|
||||||
interface RaceCardProps {
|
interface RaceCardProps {
|
||||||
/** Data passed from the page context */
|
/** Data passed from the page context */
|
||||||
data: SkeletonData;
|
data: PageData;
|
||||||
|
|
||||||
/** The [Race] object used to prefill values. */
|
/** The [Race] object used to prefill values. */
|
||||||
race?: Race;
|
race?: Race;
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Card, Button, Dropdown } from "$lib/components";
|
import { Card, Button, Dropdown } from "$lib/components";
|
||||||
import type {
|
import type { Driver, RacePick, Substitution } from "$lib/schema";
|
||||||
CurrentPickedUser,
|
|
||||||
Driver,
|
|
||||||
Race,
|
|
||||||
RacePick,
|
|
||||||
RaceResult,
|
|
||||||
SkeletonData,
|
|
||||||
Substitution,
|
|
||||||
} from "$lib/schema";
|
|
||||||
import { get_by_value, get_driver_headshot_template } from "$lib/database";
|
import { get_by_value, get_driver_headshot_template } from "$lib/database";
|
||||||
import {
|
import {
|
||||||
getModalStore,
|
getModalStore,
|
||||||
@ -21,15 +13,11 @@
|
|||||||
import { get_error_toast } from "$lib/toast";
|
import { get_error_toast } from "$lib/toast";
|
||||||
import { invalidateAll } from "$app/navigation";
|
import { invalidateAll } from "$app/navigation";
|
||||||
import { pb } from "$lib/pocketbase";
|
import { pb } from "$lib/pocketbase";
|
||||||
|
import type { PageData } from "../../../routes/racepicks/$types";
|
||||||
|
|
||||||
interface RacePickCardProps {
|
interface RacePickCardProps {
|
||||||
/** Data passed from the page context */
|
/** Data passed from the page context */
|
||||||
data: SkeletonData & {
|
data: PageData;
|
||||||
currentrace: Race;
|
|
||||||
racepicks: Promise<RacePick[]>;
|
|
||||||
currentpickedusers: Promise<CurrentPickedUser[]>;
|
|
||||||
raceresults: Promise<RaceResult[]>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** The [RacePick] object used to prefill values. */
|
/** The [RacePick] object used to prefill values. */
|
||||||
racepick?: RacePick;
|
racepick?: RacePick;
|
||||||
@ -59,7 +47,7 @@
|
|||||||
|
|
||||||
// Reactive state
|
// Reactive state
|
||||||
let required: boolean = $derived(!racepick);
|
let required: boolean = $derived(!racepick);
|
||||||
let disabled: boolean = $derived(!data.admin);
|
let disabled: boolean = false; // TODO: Datelock
|
||||||
let pxx_select_value: string = $state(racepick?.pxx ?? "");
|
let pxx_select_value: string = $state(racepick?.pxx ?? "");
|
||||||
let dnf_select_value: string = $state(racepick?.dnf ?? "");
|
let dnf_select_value: string = $state(racepick?.dnf ?? "");
|
||||||
|
|
||||||
|
@ -9,16 +9,17 @@
|
|||||||
type ToastStore,
|
type ToastStore,
|
||||||
} from "@skeletonlabs/skeleton";
|
} from "@skeletonlabs/skeleton";
|
||||||
import { Button, Card, Dropdown } from "$lib/components";
|
import { Button, Card, Dropdown } from "$lib/components";
|
||||||
import type { Driver, Race, RaceResult, SkeletonData } from "$lib/schema";
|
import type { Driver, Race, RaceResult } from "$lib/schema";
|
||||||
import { get_by_value } from "$lib/database";
|
import { get_by_value } from "$lib/database";
|
||||||
import { race_dropdown_options } from "$lib/dropdown";
|
import { race_dropdown_options } from "$lib/dropdown";
|
||||||
import { pb } from "$lib/pocketbase";
|
import { pb } from "$lib/pocketbase";
|
||||||
import { get_error_toast } from "$lib/toast";
|
import { get_error_toast } from "$lib/toast";
|
||||||
import { invalidateAll } from "$app/navigation";
|
import { invalidateAll } from "$app/navigation";
|
||||||
|
import type { PageData } from "../../../routes/data/raceresults/$types";
|
||||||
|
|
||||||
interface RaceResultCardProps {
|
interface RaceResultCardProps {
|
||||||
/** Data passed from the page context */
|
/** Data passed from the page context */
|
||||||
data: SkeletonData & { results: RaceResult[] };
|
data: PageData;
|
||||||
|
|
||||||
/** The [RaceResult] object used to prefill values. */
|
/** The [RaceResult] object used to prefill values. */
|
||||||
result?: RaceResult;
|
result?: RaceResult;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Card, Button, Dropdown } from "$lib/components";
|
import { Card, Button, Dropdown } from "$lib/components";
|
||||||
import type { Driver, SkeletonData, Substitution } from "$lib/schema";
|
import type { Driver, Substitution } from "$lib/schema";
|
||||||
import { get_by_value, get_driver_headshot_template } from "$lib/database";
|
import { get_by_value, get_driver_headshot_template } from "$lib/database";
|
||||||
import {
|
import {
|
||||||
getModalStore,
|
getModalStore,
|
||||||
@ -13,10 +13,11 @@
|
|||||||
import { get_error_toast } from "$lib/toast";
|
import { get_error_toast } from "$lib/toast";
|
||||||
import { pb } from "$lib/pocketbase";
|
import { pb } from "$lib/pocketbase";
|
||||||
import { invalidateAll } from "$app/navigation";
|
import { invalidateAll } from "$app/navigation";
|
||||||
|
import type { PageData } from "../../../routes/data/season/substitutions/$types";
|
||||||
|
|
||||||
interface SubstitutionCardProps {
|
interface SubstitutionCardProps {
|
||||||
/** Data passed from the page context */
|
/** Data passed from the page context */
|
||||||
data: SkeletonData;
|
data: PageData;
|
||||||
|
|
||||||
/** The [Substitution] object used to prefill values. */
|
/** The [Substitution] object used to prefill values. */
|
||||||
substitution?: Substitution;
|
substitution?: Substitution;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
type ToastStore,
|
type ToastStore,
|
||||||
} from "@skeletonlabs/skeleton";
|
} from "@skeletonlabs/skeleton";
|
||||||
import { Card, Button, Input, LazyImage } from "$lib/components";
|
import { Card, Button, Input, LazyImage } from "$lib/components";
|
||||||
import type { SkeletonData, Team } from "$lib/schema";
|
import type { Team } from "$lib/schema";
|
||||||
import {
|
import {
|
||||||
TEAM_BANNER_HEIGHT,
|
TEAM_BANNER_HEIGHT,
|
||||||
TEAM_BANNER_WIDTH,
|
TEAM_BANNER_WIDTH,
|
||||||
@ -20,10 +20,11 @@
|
|||||||
import { pb } from "$lib/pocketbase";
|
import { pb } from "$lib/pocketbase";
|
||||||
import { invalidateAll } from "$app/navigation";
|
import { invalidateAll } from "$app/navigation";
|
||||||
import { error } from "@sveltejs/kit";
|
import { error } from "@sveltejs/kit";
|
||||||
|
import type { PageData } from "../../../routes/data/season/teams/$types";
|
||||||
|
|
||||||
interface TeamCardProps {
|
interface TeamCardProps {
|
||||||
/** Data from the page context */
|
/** Data from the page context */
|
||||||
data: SkeletonData;
|
data: PageData;
|
||||||
|
|
||||||
/** The [Team] object used to prefill values. */
|
/** The [Team] object used to prefill values. */
|
||||||
team?: Team;
|
team?: Team;
|
||||||
|
@ -3,20 +3,6 @@
|
|||||||
|
|
||||||
// Application Data
|
// Application Data
|
||||||
|
|
||||||
/**
|
|
||||||
* The data returned from the root layout's [load]-function.
|
|
||||||
*/
|
|
||||||
export interface SkeletonData {
|
|
||||||
user: User;
|
|
||||||
admin: boolean;
|
|
||||||
|
|
||||||
graphics: Promise<Graphic[]>;
|
|
||||||
teams: Promise<Team[]>;
|
|
||||||
drivers: Promise<Driver[]>;
|
|
||||||
races: Promise<Race[]>;
|
|
||||||
substitutions: Promise<Substitution[]>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Graphic {
|
export interface Graphic {
|
||||||
name: string;
|
name: string;
|
||||||
file: string;
|
file: string;
|
||||||
@ -27,7 +13,7 @@ export interface User {
|
|||||||
id: string;
|
id: string;
|
||||||
username: string;
|
username: string;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
avatar: string;
|
avatar?: string;
|
||||||
avatar_url?: string;
|
avatar_url?: string;
|
||||||
admin: boolean;
|
admin: boolean;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user