Skip to content

Commit 9adeabe

Browse files
committed
Add shortcuts for commands and continue
1 parent 146c7cd commit 9adeabe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+424
-366
lines changed

frontend/src/App.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ if (uiStore.darkMode !== undefined) {
2727
$q.dark.set(uiStore.darkMode)
2828
}
2929
30+
const showShortcuts = computed(() => uiStore.showShortcuts)
31+
const toggleShortcuts = () => {
32+
uiStore.showShortcuts = !uiStore.showShortcuts
33+
}
34+
3035
let initialDrawerWidth = 0
3136
const resizeRightDrawer = (ev: any) => {
3237
if (ev.isFirst === true) {
@@ -64,7 +69,11 @@ const dev = computed(() => {
6469
<div class="q-mx-md">
6570
<ExternalConnectionStatus/>
6671
</div>
67-
<q-toggle dense flat round @click="toggleDarkMode" :model-value="darkMode" color="black">Dark</q-toggle>
72+
<q-toggle dense flat round class="q-mx-sm" @click="toggleDarkMode" :model-value="darkMode" color="black">Dark
73+
</q-toggle>
74+
<q-toggle dense flat round class="q-mx-sm" @click="toggleShortcuts" :model-value="showShortcuts" color="black">
75+
Show Shortcuts
76+
</q-toggle>
6877
<q-btn dense flat round icon="menu" @click="toggleRightDrawer"/>
6978
</q-toolbar>
7079

frontend/src/components/common/NumberInput.vue

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
<script setup lang="ts">
22
3+
import {inject} from "vue";
4+
import type {Shortcuts} from "@/providers/shortcuts";
5+
36
defineProps<{
47
modelValue?: number,
58
label?: string,
69
}>()
10+
711
const emit = defineEmits<{
812
(event: 'update:modelValue', payload: number | undefined): void;
913
}>();
1014
15+
const shortcuts = inject<Shortcuts>('shortcuts')!
16+
const onFocusin = () => shortcuts.disable()
17+
const onFocusout = () => shortcuts.enable()
18+
1119
const updateValue = (value: string | number | null) => {
1220
if (value !== null) {
1321
if (typeof value === 'string') {
@@ -23,12 +31,14 @@ const updateValue = (value: string | number | null) => {
2331

2432
<template>
2533
<q-input
26-
input-class="text-center"
27-
dense
28-
:label="label"
29-
type="number"
30-
:model-value="modelValue"
31-
@update:model-value="updateValue"
34+
input-class="text-center"
35+
dense
36+
:label="label"
37+
type="number"
38+
:model-value="modelValue"
39+
@update:model-value="updateValue"
40+
@focusin="onFocusin"
41+
@focusout="onFocusout"
3242
>
3343
<template v-slot:prepend>
3444
<q-icon name="close" @click="updateValue(null)"/>

frontend/src/components/common/TextInput.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<script setup lang="ts">
22
3+
import {inject} from "vue";
4+
import type {Shortcuts} from "@/providers/shortcuts";
5+
36
defineProps<{
47
modelValue?: string,
58
label?: string,
@@ -9,6 +12,10 @@ const emit = defineEmits<{
912
(event: 'update:modelValue', payload: string | undefined): void;
1013
}>();
1114
15+
const shortcuts = inject<Shortcuts>('shortcuts')!
16+
const onFocusin = () => shortcuts.disable()
17+
const onFocusout = () => shortcuts.enable()
18+
1219
const updateValue = (v: string | number | null) => {
1320
if (v) {
1421
if (typeof v === 'number') {
@@ -28,6 +35,8 @@ const updateValue = (v: string | number | null) => {
2835
:label="label"
2936
:model-value="modelValue"
3037
@update:model-value="updateValue"
38+
@focusin="onFocusin"
39+
@focusout="onFocusout"
3140
>
3241
<template v-slot:prepend>
3342
<q-icon name="close" @click="updateValue(null)"/>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<script setup lang="ts">
2+
import TeamBadge from "@/components/common/TeamBadge.vue";
3+
import type {ManualActions} from "@/providers/manualActions";
4+
import {computed, inject} from "vue";
5+
import type {Command_Type} from "@/proto/ssl_gc_state";
6+
import type {Team} from "@/proto/ssl_gc_common";
7+
import {useUiStateStore} from "@/store/uiState";
8+
9+
const props = defineProps<{
10+
type: Command_Type,
11+
team?: Team,
12+
}>()
13+
14+
const manualActions = inject<ManualActions>('command-actions')!
15+
const uiStore = useUiStateStore()
16+
const action = computed(() => manualActions.getCommandAction(props.type, props.team))
17+
const label = computed(() => {
18+
if (uiStore.showShortcuts && action.value.shortcutLabel) {
19+
return `${action.value.label} [${action.value.shortcutLabel}]`
20+
}
21+
return action.value.label
22+
})
23+
24+
</script>
25+
26+
<template>
27+
<q-btn class="q-mx-md q-my-xs" color="primary" @click="action.send" :disable="!action.enabled" :label="label">
28+
<TeamBadge :team="action.team" floating/>
29+
</q-btn>
30+
</template>

frontend/src/components/control/ForceStartButton.vue

Lines changed: 0 additions & 24 deletions
This file was deleted.

frontend/src/components/control/FreeKickButton.vue

Lines changed: 0 additions & 28 deletions
This file was deleted.

frontend/src/components/control/GoalButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import {inject} from "vue";
33
import ControlButton from "@/components/control/ControlButton.vue";
44
import {GameEvent_Goal, GameEvent_Type} from "@/proto/ssl_gc_game_event";
5-
import type {ControlApi} from "@/providers/controlApi/ControlApi";
5+
import type {ControlApi} from "@/providers/controlApi";
66
import type {Team} from "@/proto/ssl_gc_common";
77
88
const props = defineProps<{

frontend/src/components/control/HaltButton.vue

Lines changed: 0 additions & 23 deletions
This file was deleted.

frontend/src/components/control/KickoffButton.vue

Lines changed: 0 additions & 28 deletions
This file was deleted.

frontend/src/components/control/NormalStartButton.vue

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)