Skip to content

Commit

Permalink
Hotfix team error when no match chosen. Display team number and match…
Browse files Browse the repository at this point in the history
… number in forms.
  • Loading branch information
SomewhatMay committed Mar 11, 2024
1 parent 0a086aa commit b8b25c8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/lib/components/AddForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,16 @@
>{match.number}</option>
{/each}

<option
<!-- Testing Options -->
<!-- <option
class="cursor-pointer"
value={1}
>{1}</option>
<option
class="cursor-pointer"
value={2}
>{2}</option>
>{2}</option> -->
</select>
{:else}

Expand Down Expand Up @@ -141,8 +142,8 @@
team dropdown is only displayed if manual is
enabled or a match is selected
-->
{#if (match == "" || match == null) && !$manualSubmission}
<div class="text-red-700 text-md font-bold w-max ml-[auto]">Must choose a match first</div>
{#if (match == "" || match == null) && !$manualSubmission && formType.name != "Pit Scouting"}
<div class="text-red-700 text-md font-bold w-max ml-[auto] inline float-right">Must choose a match first</div>
{:else}
<span
class="flex sm:inline mt-1 sm:mt-0">
Expand All @@ -158,14 +159,15 @@
value={team.number}
>{team.number}</option>
{/each}
<option
<!-- Testing Options -->
<!-- <option
class="cursor-pointer"
value={6135}
>{6135}</option>
<option
class="cursor-pointer"
value={1310}
>{1310}</option>
>{1310}</option> -->
</select>
{:else}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/FormFlow/Checkbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { Checkbox } from "$lib/types";
import { getContext } from "svelte";
export const id: number = getContext("id")
const id: number = getContext("id")
$: if ($activeResponses[id].data[component.id] === undefined) {
$activeResponses[id].data[component.id] = component.initialValue ?? 0;
Expand Down
2 changes: 2 additions & 0 deletions src/lib/components/FormFlow/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
on:click={() => submitResponse()}>✔ Done</button
>
</div>

<div class="text-center text-gray-400 text-xs my-4">Saved automatically</div>
{:else}
<div class="text-center">
<div class="font-bold text-3xl mb-1 mt-12">No Valid Form</div>
Expand Down
15 changes: 15 additions & 0 deletions src/routes/form/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@
import { response, activeResponses, formType } from "$lib/store";
import FormFlow from "$lib/components/FormFlow/index.svelte";
import FormsList from "$lib/components/FormsList.svelte";
import { getContext } from "svelte";
$: currentResponse = $response ? $activeResponses[$response] : undefined;
</script>

<div class="md:max-w-[600px] mx-auto">
{#if $response}
<div class="mx-1">
<div class="text-xl font-bold text-center mt-3 mb-1">{currentResponse?.type.name}</div>

<div class="mb-2 flex justify-between items-center gap-2 font-bold">
<span><span class="font-normal text-gray-400">Team:</span> {currentResponse?.team}</span>
<span><span class="font-normal text-gray-400">Match:</span> {currentResponse?.match ?? "Pits"}</span>
</div>

</div>

<hr class="my-2" />

<FormFlow formType={$formType} />
{:else}
<FormsList />
Expand Down

0 comments on commit b8b25c8

Please sign in to comment.