From fbcc752665dffa95214255334cd6d3233ea6b2da Mon Sep 17 00:00:00 2001 From: Azalea Colburn Date: Tue, 19 Nov 2024 18:36:38 -0800 Subject: [PATCH 1/6] feat: phase switching --- src/routes/scout/[team_data]/+page.svelte | 62 ++++++-- ...nInputs.svelte => AutoActionInputs.svelte} | 0 .../scout/[team_data]/TeleActionInputs.svelte | 150 ++++++++++++++++++ 3 files changed, 197 insertions(+), 15 deletions(-) rename src/routes/scout/[team_data]/{ActionInputs.svelte => AutoActionInputs.svelte} (100%) create mode 100644 src/routes/scout/[team_data]/TeleActionInputs.svelte diff --git a/src/routes/scout/[team_data]/+page.svelte b/src/routes/scout/[team_data]/+page.svelte index 793c5bf..d038bb8 100644 --- a/src/routes/scout/[team_data]/+page.svelte +++ b/src/routes/scout/[team_data]/+page.svelte @@ -1,16 +1,20 @@
- Team {data.team_key} - {pageName} + Team {data.team_key} + {#if gamePhase !== 'Auto'} + + {/if} + {gamePhase}: {pageName} + {#if gamePhase === 'Post'} + + {:else} + + {/if}
- - - - + {#if gamePhase === 'Auto'} + + + + {:else if gamePhase === 'Tele'} + + + + {:else} +
Postmatch
+ {/if}
diff --git a/src/routes/scout/[team_data]/ActionInputs.svelte b/src/routes/scout/[team_data]/AutoActionInputs.svelte similarity index 100% rename from src/routes/scout/[team_data]/ActionInputs.svelte rename to src/routes/scout/[team_data]/AutoActionInputs.svelte diff --git a/src/routes/scout/[team_data]/TeleActionInputs.svelte b/src/routes/scout/[team_data]/TeleActionInputs.svelte new file mode 100644 index 0000000..5eed401 --- /dev/null +++ b/src/routes/scout/[team_data]/TeleActionInputs.svelte @@ -0,0 +1,150 @@ + + +
+ {#if is_none_state} +
+ + {#if held_balloons > 0} + + {/if} + {#if held_ejectables > 0} + + {/if} +
+ {:else if is_intake_state} +
+ + + +
+ + {:else if is_score_state} +
+ {#if held_balloons > 0} +
+

Ballon

+
+ + + {#if held_totes > 0} + + {/if} + +
+
+ {/if} + +
+ {:else if is_eject_state} +
+ {#if held_balloons > 0} + + {/if} + {#if held_totes > 0} + + {/if} +
+ + {:else} + + (actionState = + actionState.substring(0, 1) === 'S' + ? 'Score' + : actionState.substring(0, 1) === 'E' + ? 'Eject' + : 'Intake')} + /> + {/if} +
From 78f36cc2a4d13b63ae9a028a9b0e1ee3117d7486 Mon Sep 17 00:00:00 2001 From: Azalea Colburn Date: Tue, 19 Nov 2024 19:29:50 -0800 Subject: [PATCH 2/6] fix: bind held items in timeline modification --- src/lib/ActionInputStateMachine.svelte.ts | 14 ++++ src/lib/components/Action.svelte | 2 +- src/lib/components/Timeline.svelte | 22 ++++-- src/lib/types.ts | 6 ++ src/routes/scout/[team_data]/+page.svelte | 34 +++++++-- .../scout/[team_data]/AutoActionInputs.svelte | 46 ++++++------ .../scout/[team_data]/TeleActionInputs.svelte | 72 +++++++++---------- 7 files changed, 121 insertions(+), 75 deletions(-) diff --git a/src/lib/ActionInputStateMachine.svelte.ts b/src/lib/ActionInputStateMachine.svelte.ts index ef2ebd6..c06a3c1 100644 --- a/src/lib/ActionInputStateMachine.svelte.ts +++ b/src/lib/ActionInputStateMachine.svelte.ts @@ -5,6 +5,20 @@ export class ActionInputVerifier { private held_balloons: number = 0; private held_totes: number = 0; + public get_held_tele(): { balloons: number; totes: number } { + return { + balloons: this.held_balloons, + totes: this.held_totes + }; + } + public get_held_auto(): { bunnies: number; balloons: number; totes: number } { + return { + bunnies: this.held_bunnies, + balloons: this.held_balloons, + totes: this.held_totes + }; + } + public verify_actions(action_data: AutoActionData[]) { action_data .reverse() diff --git a/src/lib/components/Action.svelte b/src/lib/components/Action.svelte index cd2caf7..75bac0f 100644 --- a/src/lib/components/Action.svelte +++ b/src/lib/components/Action.svelte @@ -10,7 +10,7 @@ }: { action_data: AutoActionData; index: number; - shift: (index: number, change: number) => void; + shift: (index: number, change: -1 | 1) => void; remove: (index: number) => void; } = $props(); diff --git a/src/lib/components/Timeline.svelte b/src/lib/components/Timeline.svelte index 16ef430..2f212c5 100644 --- a/src/lib/components/Timeline.svelte +++ b/src/lib/components/Timeline.svelte @@ -1,12 +1,17 @@ diff --git a/src/lib/types.ts b/src/lib/types.ts index bba036e..a4907ba 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -91,6 +91,12 @@ export type BunnyAction = | 'ScoreBunnyLow'; export type AutoAction = TeleAction | BunnyAction; +export type TeleHeldItems = { + balloons: number; + totes: number; +}; +export type AutoHeldItems = TeleHeldItems & { bunnies: number }; + // For state machine export type ItemInputState = 'Intake' | 'Score' | 'Eject' | 'None'; export type TeleInputState = TeleAction | ItemInputState; diff --git a/src/routes/scout/[team_data]/+page.svelte b/src/routes/scout/[team_data]/+page.svelte index d038bb8..630a5ce 100644 --- a/src/routes/scout/[team_data]/+page.svelte +++ b/src/routes/scout/[team_data]/+page.svelte @@ -1,5 +1,11 @@
@@ -50,7 +69,7 @@
{#if gamePhase === 'Auto'} - + - + {:else if gamePhase === 'Tele'} - + {:else}
Postmatch
{/if} diff --git a/src/routes/scout/[team_data]/AutoActionInputs.svelte b/src/routes/scout/[team_data]/AutoActionInputs.svelte index 4be02f1..c96a201 100644 --- a/src/routes/scout/[team_data]/AutoActionInputs.svelte +++ b/src/routes/scout/[team_data]/AutoActionInputs.svelte @@ -5,8 +5,14 @@ let { actions = $bindable(), held = $bindable(), + furthest_auto_index = $bindable(), pageName = $bindable() - }: { actions: AutoActionData[]; held: AutoHeldItems; pageName: string } = $props(); + }: { + actions: AutoActionData[]; + held: AutoHeldItems; + furthest_auto_index: number; + pageName: string; + } = $props(); let actionState: AutoInputState = $state('None') as AutoInputState; @@ -49,6 +55,7 @@ ok: true }; actions.push(action); + furthest_auto_index++; actionState = 'None'; } From 11b26cba672e7f34c5382a3dfffcc7cdc6fd6859 Mon Sep 17 00:00:00 2001 From: awwpotato Date: Tue, 19 Nov 2024 19:25:41 -1000 Subject: [PATCH 5/6] fix: page switcher not consistant --- src/routes/scout/[team_data]/+page.svelte | 25 ++++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/routes/scout/[team_data]/+page.svelte b/src/routes/scout/[team_data]/+page.svelte index d18dd3f..fd63a20 100644 --- a/src/routes/scout/[team_data]/+page.svelte +++ b/src/routes/scout/[team_data]/+page.svelte @@ -56,16 +56,20 @@
- Team {data.team_key} - {#if gamePhase !== 'Auto'} - - {/if} - {gamePhase}: {pageName} - {#if gamePhase === 'Post'} - - {:else} - - {/if} + Team {data.team_key} +
+ + {gamePhase}: {pageName} + +
{#if gamePhase === 'Auto'} @@ -100,5 +104,6 @@ /> {:else}
Postmatch
+ {/if}
From 2340dd4fe821e8914eb64f739da44830faa43492 Mon Sep 17 00:00:00 2001 From: awwpotato Date: Tue, 19 Nov 2024 19:27:58 -1000 Subject: [PATCH 6/6] fix: tweak gap on page switcher --- src/routes/scout/[team_data]/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/scout/[team_data]/+page.svelte b/src/routes/scout/[team_data]/+page.svelte index fd63a20..c62396a 100644 --- a/src/routes/scout/[team_data]/+page.svelte +++ b/src/routes/scout/[team_data]/+page.svelte @@ -57,7 +57,7 @@
Team {data.team_key} -
+