Skip to content

Commit

Permalink
fix: actions display on timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
azaleacolburn committed Nov 14, 2024
1 parent 1dcc4a5 commit c083a05
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
18 changes: 8 additions & 10 deletions src/lib/components/Action.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<script lang="ts">
import type { ActionData } from '$lib/types';
import type { AutoActionData } from '$lib/types';
let { action = $bindable(), deleteself }: { action: ActionData; deleteself: () => void } =
$props();
let {
action_data = $bindable(),
deleteself
}: { action_data: AutoActionData; deleteself: () => void } = $props();
let actionBorderColor = $derived(
action.result === 'success' ? 'border-cresc_green' : 'border-fail_red'
);
let actionBackgroundColor = $derived(
action.result === 'success' ? 'bg-cresc_green' : 'bg-fail_red'
);
//let actionBorderColor = $derived(action.success ? 'border-cresc_green' : 'border-fail_red');
let actionBackgroundColor = $derived(action_data.success ? 'bg-cresc_green' : 'bg-fail_red');
</script>

<!-- <button -->
Expand All @@ -23,5 +21,5 @@
class="{actionBackgroundColor} w-full p-1 rounded border-2 border-outline_gray text-text_white"
onclick={deleteself}
>
{action.type}
{action_data.action}
</button>
2 changes: 1 addition & 1 deletion src/lib/components/Timeline.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{#each actions as _, i}
<Action
bind:action={actions[i]}
action_data={actions[i]}
deleteself={() => {
actions.splice(actions.indexOf(actions[i]), 1);
}}
Expand Down
3 changes: 1 addition & 2 deletions src/routes/scout/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
let actions: AutoActionData[] = $state([]);
let timelineExtended = $state(false);
let latestActions: AutoActionData[] = $state([]);
const match: TeamMatch = $state({
id: 0,
Expand All @@ -31,7 +30,7 @@
<h1 class="row-span-1 text-center font-bold pb-2 h-5">Team {team_key}</h1>
{#if timelineExtended}
<div class="row-span-8">
<Timeline bind:actions={latestActions} />
<Timeline bind:actions />
</div>
<button
class="row-span-1 bg-btn_grey h-10 w-80 p-1 rounded border-2 border-outline_gray static"
Expand Down

0 comments on commit c083a05

Please sign in to comment.