diff --git a/src/lib/components/Timeline.svelte b/src/lib/components/Timeline.svelte index 9d6700a..b9821a8 100644 --- a/src/lib/components/Timeline.svelte +++ b/src/lib/components/Timeline.svelte @@ -2,15 +2,16 @@ import type { ActionData } from '$lib/types'; import Action from './Action.svelte'; - let { actions = $bindable() }: { actions: ActionData[] } = $props(); + let { actions = $bindable() }: { actions: ActionData[] } = $props() + let latestActions: ActionData[] = $derived(actions.toReversed().slice(0, 5))
- {#each actions as _, i} + {#each latestActions as _, i} { - actions.splice(i, 1); + actions.splice(actions.indexOf(latestActions[i]), 1); }} /> {/each} diff --git a/src/routes/scout/+page.svelte b/src/routes/scout/+page.svelte index 2de844f..cec9c99 100644 --- a/src/routes/scout/+page.svelte +++ b/src/routes/scout/+page.svelte @@ -4,19 +4,17 @@ function addAction() { //everything here is for testing, as there is no system for this yet - latestActions.push({ type: actionType.ScoreAnotherRobotsTote, result: actionResult.success }); - latestActions.push({ type: actionType.EjectTote, result: actionResult.fail }); - latestActions.push({ type: actionType.IntakeTote, result: actionResult.success }); + actions.push({ type: actionType.ScoreAnotherRobotsTote, result: actionResult.success }); + actions.push({ type: actionType.EjectTote, result: actionResult.fail }); + actions.push({ type: actionType.IntakeTote, result: actionResult.success }); } - let latestActions: ActionData[] = $state([]); + let actions: ActionData[] = $state([]);
- + - +