-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine game event proposals with accepted game events
- Loading branch information
Showing
9 changed files
with
148 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
frontend/src/components/match/GameEventProposalGroupItemList.vue
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,17 @@ | ||
<script setup lang="ts"> | ||
import {computed} from "vue"; | ||
import GameEventItem from "@/components/match/GameEventItem.vue"; | ||
import dayjs from 'dayjs' | ||
import type {Proposal} from "@/proto/ssl_gc_state"; | ||
const props = defineProps<{ | ||
proposal: Proposal, | ||
}>() | ||
const time = computed(() => { | ||
return dayjs(props.proposal.timestamp).format("MMM, DD YYYY HH:mm:ss,SSS") | ||
}) | ||
const gameEvent = computed(() => { | ||
return props.proposal.gameEvent! | ||
}) | ||
</script> | ||
|
||
<template> | ||
<GameEventItem :game-event="gameEvent" :caption="time"/> | ||
<GameEventItem :game-event="gameEvent"/> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<script setup lang="ts"> | ||
import {computed} from "vue"; | ||
import GameEventItem from "@/components/match/GameEventItem.vue"; | ||
import GameEventProposalGroupItem from "@/components/match/GameEventProposalGroupItem.vue"; | ||
import {useMatchStateStore} from "@/store/matchState"; | ||
import type {ProposalGroup} from "@/proto/ssl_gc_state"; | ||
import type {GameEvent} from "@/proto/ssl_gc_game_event"; | ||
const store = useMatchStateStore() | ||
type GameEventWrappedItem = { | ||
id: string | ||
timestamp: number | ||
proposalGroup?: ProposalGroup | ||
gameEvent?: GameEvent | ||
} | ||
const gameEventItems = computed(() => { | ||
const gameEvents = store.matchState.gameEvents! | ||
const proposalGroups = store.matchState.proposalGroups! | ||
const items: GameEventWrappedItem[] = [] | ||
for (const proposalGroup of proposalGroups) { | ||
const item: GameEventWrappedItem = { | ||
id: proposalGroup.id!, | ||
timestamp: proposalGroup.proposals![0].timestamp!.getTime(), | ||
proposalGroup: proposalGroup, | ||
} | ||
items.push(item) | ||
} | ||
for (const gameEvent of gameEvents) { | ||
let gameEventItem = items.find(item => item.id === gameEvent.id); | ||
if (gameEventItem) { | ||
gameEventItem.gameEvent = gameEvent | ||
} else { | ||
const item: GameEventWrappedItem = { | ||
id: gameEvent.id!, | ||
timestamp: gameEvent.createdTimestamp! / 1000, | ||
gameEvent: gameEvent, | ||
} | ||
items.push(item) | ||
} | ||
} | ||
items.sort((a, b) => a.timestamp - b.timestamp) | ||
return items | ||
}) | ||
</script> | ||
|
||
<template> | ||
<q-list bordered class="rounded-borders" v-if="gameEventItems.length > 0"> | ||
<template v-for="(item) in gameEventItems"> | ||
<GameEventProposalGroupItem | ||
v-if="item.proposalGroup" | ||
:proposal-group="item.proposalGroup" | ||
:group-id="item.id" | ||
:accepted-game-event="item.gameEvent" | ||
:key="item.id" | ||
/> | ||
<GameEventItem | ||
v-else-if="item.gameEvent" | ||
:game-event="item.gameEvent" | ||
:key="item.id" | ||
/> | ||
</template> | ||
</q-list> | ||
<div v-else> | ||
No recent game event proposals | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters