File tree 3 files changed +35
-2
lines changed
3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
2
import StepButton from " ./StepButton.vue"
3
3
import Encounters from " ./Encounters.vue"
4
+ import Verification from " ./Verification.vue"
4
5
</script >
5
6
6
7
<template >
7
8
<StepButton />
8
9
<Encounters />
10
+ <Verification />
9
11
</template >
Original file line number Diff line number Diff line change
1
+ <script setup lang="ts">
2
+ import { Checkbox } from " @/components"
3
+ import { useTravelStore } from " ../store"
4
+ import { storeToRefs } from " pinia"
5
+ import { watch } from " vue"
6
+ import { wrapAnchorWithButton } from " @/utils"
7
+
8
+ const travelStore = useTravelStore ()
9
+ const { shouldAutoFocusVerification, lastStepResponse } = storeToRefs (travelStore )
10
+
11
+ watch (lastStepResponse , (val ) => {
12
+ if (! shouldAutoFocusVerification .value ) return
13
+ if (! val ?.text ?.includes (" verification" )) return
14
+
15
+ /** let dom hydrate */
16
+ setTimeout (() => {
17
+ const verificationAnchor = document .querySelector <HTMLAnchorElement >(" .travel-content a" )
18
+ if (! verificationAnchor ) return
19
+
20
+ verificationAnchor .removeAttribute (" target" )
21
+ wrapAnchorWithButton (verificationAnchor ).focus ()
22
+ })
23
+ })
24
+ </script >
25
+
26
+ <template >
27
+ <Checkbox v-model =" shouldAutoFocusVerification" >
28
+ <template #default > Autofocus verification button </template >
29
+ <template #subtitle > Will open in this tab </template >
30
+ </Checkbox >
31
+ </template >
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export const useTravelStore = defineStore(
7
7
const shouldAutoFocusStep = ref ( false )
8
8
const shouldPersistCooldown = ref ( false )
9
9
const shouldAutoFocusEncounters = ref ( false )
10
- // const shouldAutoFocusVerification = ref(false)
10
+ const shouldAutoFocusVerification = ref ( false )
11
11
12
12
const lastStepResponse = ref < null | TravelResponse > ( null )
13
13
const cooldownTimestamp = ref < null | string > ( null )
@@ -29,7 +29,7 @@ export const useTravelStore = defineStore(
29
29
shouldAutoFocusStep,
30
30
shouldPersistCooldown,
31
31
shouldAutoFocusEncounters,
32
- // shouldAutoFocusVerification,
32
+ shouldAutoFocusVerification,
33
33
cooldownTimestamp,
34
34
cooldownTimeLeft,
35
35
lastStepResponse,
You can’t perform that action at this time.
0 commit comments