Skip to content

Commit 1728ccf

Browse files
committed
Merge branch 'develop' into production
2 parents 9877951 + 4880119 commit 1728ccf

File tree

8 files changed

+101
-73
lines changed

8 files changed

+101
-73
lines changed

src/app.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ class BikeTagApp {
5656
store() {
5757
const pinia = createPinia()
5858
const store = createBikeTag({ includeComponents: false, includeDirectives: false })
59-
this.app
60-
.use(pinia)
61-
.use(store)
59+
this.app.use(pinia).use(store)
6260
debug('app::store', store.storeName)
6361
}
6462
authentication() {

src/common/methods.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,16 @@ export const getBikeTagClientOpts = (win?: Window, withToken = false) => {
176176
}
177177
}
178178

179-
export const setRegionPolygonInCookie = (regionPolygon: any, regionPolygonCookieKey = 'regionPolygon') => {
179+
export const setRegionPolygonInCookie = (
180+
regionPolygon: any,
181+
regionPolygonCookieKey = 'regionPolygon',
182+
) => {
180183
localStorage.setItem(regionPolygonCookieKey, JSON.stringify(regionPolygon))
181184

182185
return regionPolygon
183186
}
184187

185-
export const getRegionPolygonFromCookie = (
186-
regionPolygonCookieKey = 'regionPolygon',
187-
): any => {
188+
export const getRegionPolygonFromCookie = (regionPolygonCookieKey = 'regionPolygon'): any => {
188189
const regionPolygonString = localStorage.getItem(regionPolygonCookieKey)
189190
return regionPolygonString?.length ? JSON.parse(regionPolygonString) : undefined
190191
}
@@ -365,7 +366,7 @@ export const GetQueryString = (win: Window, name: string): string | null => {
365366
export const getQueryParam = (win: Window, param: string): string | null => {
366367
const urlParams = new URLSearchParams(win.location.search)
367368
return urlParams.get(param)
368-
}
369+
}
369370

370371
export const getQueuedTagState = (queuedTag: Tag): BiketagQueueFormSteps => {
371372
const mysteryImageSet = queuedTag.mysteryImageUrl?.length > 0
@@ -482,8 +483,13 @@ export const exportHtmlToDownload = (filename: string, node?: any, selector?: st
482483
})
483484
}
484485

485-
export const debug = (message: string, context?: any, level: 'log' | 'info' | 'warn' | 'error' = 'log') => {
486-
const shouldLogBecauseDebugIsSet = getQueryParam(window, 'debug_a') === 'true' || BikeTagEnv.DEBUG_FE === 'true'
486+
export const debug = (
487+
message: string,
488+
context?: any,
489+
level: 'log' | 'info' | 'warn' | 'error' = 'log',
490+
) => {
491+
const shouldLogBecauseDebugIsSet =
492+
getQueryParam(window, 'debug_a') === 'true' || BikeTagEnv.DEBUG_FE === 'true'
487493
const shouldLogBecauseLevel = level === 'error' || level === 'warn' || level === 'info'
488494
if (shouldLogBecauseDebugIsSet || shouldLogBecauseLevel) {
489495
console[level](message, context)

src/components/DeleteBikeTag.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const previousTag = computed(() => store.getPreviousBikeTag)
7676
// methods
7777
7878
function deleteTagConfirm() {
79-
confirmRemove.value = true
79+
confirmDelete.value = true
8080
}
8181
8282
function deleteTagFunction() {

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,15 @@ export {
7575
// BikeTagGames,
7676
BikeTagHeader,
7777
// BikeTagInput,
78-
BikeTagLabel, createBikeTag,
78+
BikeTagLabel,
79+
createBikeTag,
7980
getBikeTagClientOpts,
8081
initBikeTagStore,
8182
// BikeTagLoader,
8283
// BikeTagMap,
8384
// BikeTagMenu,
8485
// BikeTagPlayer,
8586
// BikeTagQueue,
86-
Types, useBikeTagStore
87+
Types,
88+
useBikeTagStore,
8789
}
88-

src/store/index.ts

Lines changed: 80 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -197,33 +197,38 @@ export const useBikeTagStore = defineStore(BikeTagDefaults.store, {
197197
newGameName = newGameName ?? this.gameName
198198
if (this.game?.name !== newGameName || !this.game?.mainhash) {
199199
this.fetchingData = false
200-
return client.getGame({ game: newGameName }, { source: BikeTagDefaults.gameSource }).then(async (r) => {
201-
if (r.success) {
202-
const game = r.data as Game
203-
204-
if (game.settings['data::aws'] && game.settings['data::aws'] === 'true') {
205-
this.imageSource = 'aws'
206-
} else if (game.settings['data::imgur'] && game.settings['data::imgur'] === 'true') {
207-
this.imageSource = 'imgur'
208-
}
209-
/// TODO: split these up based on the imageSource?
210-
biketagClientOpts.imgur.hash = game.mainhash
211-
biketagClientOpts.imgur.queuehash = game.queuehash
212-
biketagClientOpts.aws.region = game.awsRegion
213-
214-
// TODO: set the default source to something else, now
215-
const configuredClient = client.config(biketagClientOpts, true, true)
216-
debug(`${BikeTagDefaults.store}::client-init`, { configuredClient, imageSource: this.imageSource })
217-
218-
return this.SET_GAME(game)
219-
} else {
220-
const cachedGame = this.allGames.find((g) => g.name === newGameName)
221-
if (cachedGame) {
222-
return this.SET_GAME(cachedGame)
200+
return client
201+
.getGame({ game: newGameName }, { source: BikeTagDefaults.gameSource })
202+
.then(async (r) => {
203+
if (r.success) {
204+
const game = r.data as Game
205+
206+
if (game.settings['data::aws'] && game.settings['data::aws'] === 'true') {
207+
this.imageSource = 'aws'
208+
} else if (game.settings['data::imgur'] && game.settings['data::imgur'] === 'true') {
209+
this.imageSource = 'imgur'
210+
}
211+
/// TODO: split these up based on the imageSource?
212+
biketagClientOpts.imgur.hash = game.mainhash
213+
biketagClientOpts.imgur.queuehash = game.queuehash
214+
biketagClientOpts.aws.region = game.awsRegion
215+
216+
// TODO: set the default source to something else, now
217+
const configuredClient = client.config(biketagClientOpts, true, true)
218+
debug(`${BikeTagDefaults.store}::client-init`, {
219+
configuredClient,
220+
imageSource: this.imageSource,
221+
})
222+
223+
return this.SET_GAME(game)
224+
} else {
225+
const cachedGame = this.allGames.find((g) => g.name === newGameName)
226+
if (cachedGame) {
227+
return this.SET_GAME(cachedGame)
228+
}
223229
}
224-
}
225-
return false
226-
})
230+
return false
231+
})
227232
}
228233
},
229234
async resetBikeTagCache() {
@@ -313,7 +318,7 @@ export const useBikeTagStore = defineStore(BikeTagDefaults.store, {
313318
return client
314319
.getAllGames(undefined, {
315320
source: BikeTagDefaults.gameSource,
316-
cached
321+
cached,
317322
})
318323
.then((d) => {
319324
if (d.success) {
@@ -340,34 +345,36 @@ export const useBikeTagStore = defineStore(BikeTagDefaults.store, {
340345
},
341346
async fetchQueuedTags(cached = true) {
342347
if (this.currentBikeTag?.tagnumber > 0) {
343-
return client.queue(undefined, { source: cached ? this.imageSource : 'biketag', cached }).then((d) => {
344-
if ((d as Tag[])?.length > 0) {
345-
const currentBikeTagQueue: Tag[] = (d as Tag[]).filter(
346-
(t) =>
347-
t.tagnumber > this.currentBikeTag.tagnumber ||
348-
(t.tagnumber === this.currentBikeTag.tagnumber && !t.mysteryImageUrl),
349-
)
350-
351-
/// Get the player queued tag by player id
352-
const [playerQueuedTag] = currentBikeTagQueue.filter(
353-
(t) => this.profile?.sub && t.playerId === this.profile.sub,
354-
)
355-
356-
if (playerQueuedTag) {
357-
this.SET_QUEUED_TAG(playerQueuedTag)
358-
this.SET_QUEUED_TAG_STATE(playerQueuedTag)
348+
return client
349+
.queue(undefined, { source: cached ? this.imageSource : 'biketag', cached })
350+
.then((d) => {
351+
if ((d as Tag[])?.length > 0) {
352+
const currentBikeTagQueue: Tag[] = (d as Tag[]).filter(
353+
(t) =>
354+
t.tagnumber > this.currentBikeTag.tagnumber ||
355+
(t.tagnumber === this.currentBikeTag.tagnumber && !t.mysteryImageUrl),
356+
)
357+
358+
/// Get the player queued tag by player id
359+
const [playerQueuedTag] = currentBikeTagQueue.filter(
360+
(t) => this.profile?.sub && t.playerId === this.profile.sub,
361+
)
362+
363+
if (playerQueuedTag) {
364+
this.SET_QUEUED_TAG(playerQueuedTag)
365+
this.SET_QUEUED_TAG_STATE(playerQueuedTag)
366+
} else {
367+
this.SET_QUEUED_TAG()
368+
this.SET_QUEUED_TAG_STATE()
369+
}
370+
371+
return this.SET_QUEUED_TAGS(currentBikeTagQueue)
359372
} else {
360373
this.SET_QUEUED_TAG()
361374
this.SET_QUEUED_TAG_STATE()
375+
return this.SET_QUEUED_TAGS([])
362376
}
363-
364-
return this.SET_QUEUED_TAGS(currentBikeTagQueue)
365-
} else {
366-
this.SET_QUEUED_TAG()
367-
this.SET_QUEUED_TAG_STATE()
368-
return this.SET_QUEUED_TAGS([])
369-
}
370-
})
377+
})
371378
}
372379

373380
return false
@@ -621,14 +628,18 @@ export const useBikeTagStore = defineStore(BikeTagDefaults.store, {
621628
}
622629
return client.deleteTag(queuedMysteryTag, { source }).then(async (t) => {
623630
if (t.success) {
624-
debug(`${BikeTagDefaults.store}::dequeue-mystery-tag`,'mystery tag dequeued')
631+
debug(`${BikeTagDefaults.store}::dequeue-mystery-tag`, 'mystery tag dequeued')
625632
await client.getQueue({ reindex: true }, { source: 'biketag' })
626633
this.SET_QUEUED_TAG(queuedFoundTag)
627634
this.RESET_FORM_STEP_TO_MYSTERY()
628635

629636
return true
630637
} else {
631-
debug(`${BikeTagDefaults.store}::dequeue-mystery-tag`, 'dequeue BikeTag failed: ' + t.error, 'error')
638+
debug(
639+
`${BikeTagDefaults.store}::dequeue-mystery-tag`,
640+
'dequeue BikeTag failed: ' + t.error,
641+
'error',
642+
)
632643
return t.error
633644
}
634645
})
@@ -643,7 +654,11 @@ export const useBikeTagStore = defineStore(BikeTagDefaults.store, {
643654
this.SET_QUEUE_FOUND(t.data)
644655
await client.getQueue({ resize: true, reindex: true }, { source: 'biketag' })
645656
} else {
646-
debug(`${BikeTagDefaults.store}::queue-found-tag`, 'queue (Found) BikeTag failed: ' + t.error, 'error')
657+
debug(
658+
`${BikeTagDefaults.store}::queue-found-tag`,
659+
'queue (Found) BikeTag failed: ' + t.error,
660+
'error',
661+
)
647662
return t.error
648663
}
649664
return t.success
@@ -660,7 +675,11 @@ export const useBikeTagStore = defineStore(BikeTagDefaults.store, {
660675
this.SET_QUEUE_MYSTERY(t.data)
661676
await client.getQueue({ resize: true, reindex: true }, { source: 'biketag' })
662677
} else {
663-
debug(`${BikeTagDefaults.store}::queue-mystery-tag`, 'queue (Mystery) BikeTag failed: ' + t.error, 'error')
678+
debug(
679+
`${BikeTagDefaults.store}::queue-mystery-tag`,
680+
'queue (Mystery) BikeTag failed: ' + t.error,
681+
'error',
682+
)
664683
return t.error
665684
}
666685
return t.success
@@ -677,7 +696,11 @@ export const useBikeTagStore = defineStore(BikeTagDefaults.store, {
677696
this.SET_QUEUED_SUBMITTED(t.data)
678697
await client.getQueue({ resize: true, reindex: true }, { source: 'biketag' })
679698
} else {
680-
debug(`${BikeTagDefaults.store}::queue-post-tag`, 'queue (Post) BikeTag failed: ' + t.error, 'error')
699+
debug(
700+
`${BikeTagDefaults.store}::queue-post-tag`,
701+
'queue (Post) BikeTag failed: ' + t.error,
702+
'error',
703+
)
681704
return t.error
682705
}
683706
return t.success
@@ -1018,7 +1041,7 @@ export const useBikeTagStore = defineStore(BikeTagDefaults.store, {
10181041
return (url: string, s: string = 'm') =>
10191042
getImageSized(state.imageSource, url, s as 's' | 'm' | 'l' | 'o' | undefined)
10201043
},
1021-
getImageSource (state) {
1044+
getImageSource(state) {
10221045
return state.imageSource
10231046
},
10241047
getQueuedTagState: (state) => {

src/views/Delete.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ const router = useRouter()
5858
const toast = inject('toast')
5959
const { t } = useI18n()
6060
61-
6261
// computed
6362
const getGameName = computed(() => store.getGameName)
6463
const getGameNameProper = computed(() => store.getGameNameProper)

src/views/Edit.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function mergeTags(forward = true) {
138138
mysteryLocation: pendingEdits.mysteryLocation,
139139
mysteryImageUrl: pendingEdits.mysteryImageUrl,
140140
},
141-
}
141+
}
142142
}
143143
}
144144

src/views/Profile.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ onMounted(async () => {
290290
</script>
291291
<style lang="scss">
292292
@import '../assets/styles/style';
293+
293294
.flx-columns {
294295
@include flx-center($flow: column nowrap, $al: flex-start);
295296

0 commit comments

Comments
 (0)