diff --git a/.prettierrc b/.prettierrc index 9573023..8bc6e86 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,6 +3,6 @@ "singleQuote": true, "trailingComma": "none", "printWidth": 100, - "plugins": ["prettier-plugin-svelte"], + "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] } diff --git a/bun.lockb b/bun.lockb index 776ad14..a0825cf 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 62d2359..e1f49f0 100644 --- a/package.json +++ b/package.json @@ -30,5 +30,8 @@ "typescript": "^5.6.3", "typescript-eslint": "^8.14.0", "vite": "^5.4.11" + }, + "dependencies": { + "lucide-svelte": "^0.456.0" } } diff --git a/src/lib/components/Action.svelte b/src/lib/components/Action.svelte index 1a5a1be..103f0fb 100644 --- a/src/lib/components/Action.svelte +++ b/src/lib/components/Action.svelte @@ -1,25 +1,45 @@ - - - - - - - - + {action_data.action} +
+ + + +
+ diff --git a/src/lib/components/SuccessFail.svelte b/src/lib/components/SuccessFail.svelte index 007da5b..a2ffa60 100644 --- a/src/lib/components/SuccessFail.svelte +++ b/src/lib/components/SuccessFail.svelte @@ -3,19 +3,21 @@ $props(); -
- - - +
+ + + +
diff --git a/src/lib/components/Timeline.svelte b/src/lib/components/Timeline.svelte index de4c097..769a74d 100644 --- a/src/lib/components/Timeline.svelte +++ b/src/lib/components/Timeline.svelte @@ -2,15 +2,38 @@ import type { AutoActionData } from '$lib/types'; import Action from './Action.svelte'; - let { actions = $bindable() }: { actions: AutoActionData[] } = $props(); + let { + actions = $bindable(), + displaying = $bindable() + }: { actions: AutoActionData[]; displaying: boolean } = $props(); // let latestActions: AutoActionData[] = $derived(actions.toReversed().slice(0, 5)); + + const remove = (index: number) => { + actions.splice(index, 1); + }; + + const shift = (index: number, change: number) => { + let item = actions[index]; + actions.splice(index, 1); + actions.splice(index + change, 0, item); + }; -{#each actions as _, i} - { - actions.splice(actions.indexOf(actions[i]), 1); - }} - /> -{/each} + diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 4b474b2..493a0b6 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -7,6 +7,6 @@ diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index aefc4d7..cfde746 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,6 +1,9 @@ -
+

hiiii :3

- + scout
diff --git a/src/routes/scout/+page.svelte b/src/routes/scout/+page.svelte index ddf130b..7491f7b 100644 --- a/src/routes/scout/+page.svelte +++ b/src/routes/scout/+page.svelte @@ -1,5 +1,5 @@ -
-

Team {team_key}

- {#if timelineExtended} -
- -
- - {:else} -
- -
+
+ Team {team_key} - - {/if} + + + +
diff --git a/src/routes/scout/ActionInputs.svelte b/src/routes/scout/ActionInputs.svelte index eadb514..a018aba 100644 --- a/src/routes/scout/ActionInputs.svelte +++ b/src/routes/scout/ActionInputs.svelte @@ -9,8 +9,8 @@ let held_bunnies: number = $state(0); let held_balloons: number = $state(0); let held_totes: number = $state(0); - let held_scorables: number = $derived(held_balloons + held_bunnies); - let held_ejectables: number = $derived(held_scorables + held_totes); + const held_scorables: number = $derived(held_balloons + held_bunnies); + const held_ejectables: number = $derived(held_scorables + held_totes); function intake_piece() { actionState = actionState === 'None' ? 'Intake' : actionState; @@ -29,135 +29,146 @@ actionState = `ScoreBalloon${where}`; } function complete(success: boolean) { - // Assume that the robot ejects even if they fail to score - if (actionState.includes('IntakeBalloon')) held_balloons++; - else if (actionState.includes('IntakeBunny')) held_bunnies++; - else if (actionState.includes('IntakeTote')) held_totes++; - else if (actionState.includes('ScoreBalloon')) held_balloons--; + // Assume that a failure means a note remains where it is + if (success) { + if (actionState.includes('IntakeBalloon')) held_balloons++; + else if (actionState.includes('IntakeBunny')) held_bunnies++; + else if (actionState.includes('IntakeTote')) held_totes++; + else if (actionState.includes('EjectBalloon')) held_balloons--; + else if (actionState.includes('EjectBunny')) held_bunnies--; + else if (actionState.includes('EjectTote')) held_totes--; + } + // Assume failed scoring is still ejecting + if (actionState.includes('ScoreBalloon')) held_balloons--; else if (actionState.includes('ScoreBunny')) held_bunnies--; - else if (actionState.includes('EjectBalloon')) held_balloons--; - else if (actionState.includes('EjectBunny')) held_bunnies--; - else if (actionState.includes('EjectTote')) held_totes--; const action: AutoActionData = { action: actionState as AutoAction, success: success }; - actions.push(action); + actions.unshift(action); // TODO: Make sure unshift works actionState = 'None'; } - const is_none_state = $derived(actionState === 'None'); - const is_intake_state = $derived(actionState === 'Intake'); - const is_score_state = $derived(actionState === 'Score'); + const is_none_state: boolean = $derived(actionState === 'None'); + const is_intake_state: boolean = $derived(actionState === 'Intake'); + const is_score_state: boolean = $derived(actionState === 'Score'); const is_eject_state = $derived(actionState === 'Eject'); -

Number of pieces currently held: {held_scorables}

-
+
{#if is_none_state} -
- +
+ {#if held_scorables > 0} - + {/if} {#if held_ejectables > 0} - + {/if}
{:else if is_intake_state} -
- Intake +
+ - (actionState = 'IntakeTote')} + >Tote - (actionState = 'IntakeBalloon')} + >Balloon From Ground - (actionState = 'IntakeBalloonCoral')}>Ballon From Coral
+ {:else if is_score_state} -
+
{#if held_bunnies > 0} - - - {#if held_totes > 0} +

Score Bunny

+
+ score_bunny('UncontrolledTote')}>Uncontrolled Tote - {/if} - + {#if held_totes > 0} + + {/if} + +
{/if} {#if held_balloons > 0} - - - {#if held_totes > 0} +

Score Ballon

+
+ score_balloon('UncontrolledTote')}>Uncontrolled Tote - {/if} - + {#if held_totes > 0} + + {/if} + +
{/if} -
+ {:else if is_eject_state} -
+
+

Eject

{#if held_bunnies > 0} - (actionState = 'EjectBunny')}>Bunny {/if} {#if held_balloons > 0} (actionState = 'EjectBalloon')}>Ballon {/if} {#if held_totes > 0} - (actionState = 'EjectTote')}>Tote {/if} -
+ {:else}