Skip to content

Commit 1bf9c56

Browse files
committed
Highlight fouls with a red icon
1 parent e0c9aa3 commit 1bf9c56

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

src/components/protocol/ProtocolTable.vue

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</template>
1313
<template v-slot:cell(type)="data">
1414
<span v-b-tooltip.hover.d500 :title="protocolType(data.item)">
15-
<font-awesome-icon class="fa-sm" :icon="iconForType(protocolType(data.item))"/>
15+
<font-awesome-icon :class="{'fa-sm': true, foul: isFoul(data.item)}" :icon="iconForType(protocolType(data.item))" />
1616
</span>
1717
</template>
1818
<template v-slot:cell(time)="data">
@@ -124,6 +124,38 @@
124124
return undefined;
125125
}
126126
},
127+
isFoul(entry) {
128+
let protocolType = this.protocolType(entry);
129+
let gameEventType;
130+
if (protocolType === 'addGameEvent') {
131+
gameEventType = entry.change.addGameEvent.gameEvent.type;
132+
} else if (protocolType === 'addProposal') {
133+
gameEventType = entry.change.addProposal.proposal.gameEvent.type;
134+
} else if (protocolType === 'addPassiveGameEvent') {
135+
gameEventType = entry.change.addPassiveGameEvent.gameEvent.type;
136+
} else {
137+
return false;
138+
}
139+
switch(gameEventType) {
140+
case 'ATTACKER_TOO_CLOSE_TO_DEFENSE_AREA':
141+
case 'DEFENDER_IN_DEFENSE_AREA':
142+
case 'BOUNDARY_CROSSING':
143+
case 'KEEPER_HELD_BALL':
144+
case 'BOT_DRIBBLED_BALL_TOO_FAR':
145+
case 'BOT_PUSHED_BOT':
146+
case 'BOT_HELD_BALL_DELIBERATELY':
147+
case 'BOT_TIPPED_OVER':
148+
case 'ATTACKER_TOUCHED_BALL_IN_DEFENSE_AREA':
149+
case 'BOT_KICKED_BALL_TOO_FAST':
150+
case 'BOT_CRASH_UNIQUE':
151+
case 'BOT_CRASH_DRAWN':
152+
case 'DEFENDER_TOO_CLOSE_TO_KICK_POINT':
153+
case 'BOT_TOO_FAST_IN_STOP':
154+
case 'BOT_INTERFERED_PLACEMENT':
155+
return true;
156+
}
157+
return false;
158+
},
127159
iconForType(type) {
128160
switch (type) {
129161
case 'newCommand':
@@ -214,4 +246,8 @@
214246
text-align: left;
215247
margin-left: 50px;
216248
}
249+
250+
.foul {
251+
color: Tomato;
252+
}
217253
</style>

0 commit comments

Comments
 (0)