Lib: Move cards into cards/ directory

This commit is contained in:
2024-12-18 14:59:06 +01:00
parent 49112280de
commit b3629fbe95
4 changed files with 37 additions and 27 deletions

View File

@ -1,11 +1,8 @@
<script lang="ts"> <script lang="ts">
import { get_image_preview_event_handler } from "$lib/image"; import { get_image_preview_event_handler } from "$lib/image";
import { FileDropzone, SlideToggle } from "@skeletonlabs/skeleton"; import { FileDropzone, SlideToggle } from "@skeletonlabs/skeleton";
import LazyCard from "./LazyCard.svelte"; import { Button, Input, LazyCard, LazyDropdown, type LazyDropdownOption } from "$lib/components";
import Button from "./Button.svelte";
import type { Driver } from "$lib/schema"; import type { Driver } from "$lib/schema";
import Input from "./Input.svelte";
import LazyDropdown, { type LazyDropdownOption } from "./LazyDropdown.svelte";
import { import {
DRIVER_CARD_ASPECT_HEIGHT, DRIVER_CARD_ASPECT_HEIGHT,
DRIVER_CARD_ASPECT_WIDTH, DRIVER_CARD_ASPECT_WIDTH,
@ -118,7 +115,7 @@
disabled={disable_inputs} disabled={disable_inputs}
required={require_inputs} required={require_inputs}
> >
<svelte:fragment slot="message"><b>Upload Headshot</b> or Drag and Drop</svelte:fragment> <svelte:fragment slot="message"><b>Upload Headshot</b></svelte:fragment>
</FileDropzone> </FileDropzone>
<!-- Save/Delete buttons --> <!-- Save/Delete buttons -->
@ -133,14 +130,28 @@
/> />
</div> </div>
{#if driver} {#if driver}
<Button formaction="?/update_driver" color="secondary" disabled={disable_inputs} submit <Button
>Save Changes</Button formaction="?/update_driver"
color="secondary"
disabled={disable_inputs}
submit
width="w-1/2"
> >
<Button color="primary" submit disabled={disable_inputs} formaction="?/delete_driver" Save
>Delete</Button </Button>
<Button
color="primary"
submit
disabled={disable_inputs}
formaction="?/delete_driver"
width="w-1/2"
> >
Delete
</Button>
{:else} {:else}
<Button formaction="?/create_driver" color="tertiary" submit>Create Driver</Button> <Button formaction="?/create_driver" color="tertiary" submit width="w-full"
>Create Driver</Button
>
{/if} {/if}
</div> </div>
</div> </div>

View File

@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import type { Snippet } from "svelte"; import type { Snippet } from "svelte";
import LazyImage from "./LazyImage.svelte"; import LazyImage from "../LazyImage.svelte";
import { lazyload } from "$lib/lazyload"; import { lazyload } from "$lib/lazyload";
interface CardProps { interface CardProps {

View File

@ -1,10 +1,8 @@
<script lang="ts"> <script lang="ts">
import { get_image_preview_event_handler } from "$lib/image"; import { get_image_preview_event_handler } from "$lib/image";
import { FileDropzone } from "@skeletonlabs/skeleton"; import { FileDropzone } from "@skeletonlabs/skeleton";
import LazyCard from "./LazyCard.svelte"; import { Button, LazyCard, Input } from "$lib/components";
import Button from "./Button.svelte";
import type { Race } from "$lib/schema"; import type { Race } from "$lib/schema";
import Input from "./Input.svelte";
import { format } from "date-fns"; import { format } from "date-fns";
import { import {
RACE_CARD_ASPECT_HEIGHT, RACE_CARD_ASPECT_HEIGHT,
@ -58,6 +56,8 @@
sprintquali.value = ""; sprintquali.value = "";
sprint.value = ""; sprint.value = "";
}; };
const labelwidth = "80px";
</script> </script>
<LazyCard <LazyCard
@ -82,7 +82,7 @@
name="name" name="name"
value={race?.name ?? ""} value={race?.name ?? ""}
autocomplete="off" autocomplete="off"
labelwidth="120px" {labelwidth}
disabled={disable_inputs} disabled={disable_inputs}
required={require_inputs}>Name</Input required={require_inputs}>Name</Input
> >
@ -91,7 +91,7 @@
name="step" name="step"
value={race?.step ?? ""} value={race?.step ?? ""}
autocomplete="off" autocomplete="off"
labelwidth="120px" {labelwidth}
type="number" type="number"
min={1} min={1}
max={24} max={24}
@ -103,7 +103,7 @@
name="pxx" name="pxx"
value={race?.pxx ?? ""} value={race?.pxx ?? ""}
autocomplete="off" autocomplete="off"
labelwidth="120px" {labelwidth}
type="number" type="number"
min={1} min={1}
max={20} max={20}
@ -117,25 +117,25 @@
name="sprintqualidate" name="sprintqualidate"
value={sprintqualidate ?? ""} value={sprintqualidate ?? ""}
autocomplete="off" autocomplete="off"
labelwidth="120px" {labelwidth}
type="datetime-local" type="datetime-local"
disabled={disable_inputs}>Sprint Quali</Input disabled={disable_inputs}>SQuali</Input
> >
<Input <Input
id="race_sprintdate_{race?.id ?? 'create'}" id="race_sprintdate_{race?.id ?? 'create'}"
name="sprintdate" name="sprintdate"
value={sprintdate ?? ""} value={sprintdate ?? ""}
autocomplete="off" autocomplete="off"
labelwidth="120px" {labelwidth}
type="datetime-local" type="datetime-local"
disabled={disable_inputs}>Sprint</Input disabled={disable_inputs}>SRace</Input
> >
<Input <Input
id="race_qualidate_{race?.id ?? 'create'}" id="race_qualidate_{race?.id ?? 'create'}"
name="qualidate" name="qualidate"
value={qualidate ?? ""} value={qualidate ?? ""}
autocomplete="off" autocomplete="off"
labelwidth="120px" {labelwidth}
type="datetime-local" type="datetime-local"
disabled={disable_inputs} disabled={disable_inputs}
required={require_inputs}>Quali</Input required={require_inputs}>Quali</Input
@ -145,10 +145,10 @@
name="racedate" name="racedate"
value={racedate ?? ""} value={racedate ?? ""}
autocomplete="off" autocomplete="off"
labelwidth="120px" {labelwidth}
type="datetime-local" type="datetime-local"
disabled={disable_inputs} disabled={disable_inputs}
required={require_inputs}>Sprint Quali</Input required={require_inputs}>Race</Input
> >
<!-- Headshot upload --> <!-- Headshot upload -->
@ -161,7 +161,7 @@
disabled={disable_inputs} disabled={disable_inputs}
required={require_inputs} required={require_inputs}
> >
<svelte:fragment slot="message"><b>Upload Pictogram</b> or Drag and Drop</svelte:fragment> <svelte:fragment slot="message"><b>Upload Pictogram</b></svelte:fragment>
</FileDropzone> </FileDropzone>
<!-- Save/Delete buttons --> <!-- Save/Delete buttons -->

View File

@ -1,9 +1,8 @@
<script lang="ts"> <script lang="ts">
import LazyCard from "./LazyCard.svelte"; import LazyCard from "./LazyCard.svelte";
import Button from "./Button.svelte"; import { Button, LazyDropdown, type LazyDropdownOption } from "$lib/components";
import type { Driver, Substitution } from "$lib/schema"; import type { Driver, Substitution } from "$lib/schema";
import { get_by_value } from "$lib/database"; import { get_by_value } from "$lib/database";
import LazyDropdown, { type LazyDropdownOption } from "./LazyDropdown.svelte";
import type { Action } from "svelte/action"; import type { Action } from "svelte/action";
import { import {
DRIVER_HEADSHOT_HEIGHT, DRIVER_HEADSHOT_HEIGHT,