1
1
<script setup lang="ts">
2
2
import { Checkbox } from " @/components"
3
-
4
- import { watch } from " vue"
5
- import { useTravelStore } from " ./store"
3
+ import { useTravelStore } from " ../store"
6
4
import { storeToRefs } from " pinia"
7
- import { focusOnButtonEnable , wrapAnchorWithButton } from " @/utils"
5
+ import { watch } from " vue"
6
+ import { wrapAnchorWithButton } from " @/utils"
8
7
9
8
const travelStore = useTravelStore ()
10
- const { shouldAutoFocusStep, shouldAutoFocusEncounters, lastStepResponse } = storeToRefs (travelStore )
11
-
12
- /** Encounter auto focus */
9
+ const { shouldAutoFocusEncounters, lastStepResponse } = storeToRefs (travelStore )
13
10
14
11
watch (lastStepResponse , async (response ) => {
15
12
if (! response ) return
@@ -31,31 +28,9 @@ watch(lastStepResponse, async (response) => {
31
28
}
32
29
})
33
30
})
34
-
35
- /** Travel button auto focus */
36
-
37
- const travelButton = document .querySelector <HTMLButtonElement >(" .px-4.py-4 button" )
38
- const observer = travelButton && focusOnButtonEnable (travelButton )
39
-
40
- watch (
41
- shouldAutoFocusStep ,
42
- (val ) => {
43
- if (! observer ) return
44
-
45
- if (val ) observer .connect ()
46
- else observer .disconnect ()
47
- },
48
- {
49
- immediate: true ,
50
- }
51
- )
52
31
</script >
53
32
54
33
<template >
55
- <Checkbox v-model =" shouldAutoFocusStep" >
56
- <template #default > Autofocus step button </template >
57
- <template #subtitle > Just hit space/enter! </template >
58
- </Checkbox >
59
34
<Checkbox v-model =" shouldAutoFocusEncounters" >
60
35
<template #default > Autofocus encounters </template >
61
36
<template #subtitle > Hit space/enter to attack/gather </template >
0 commit comments