Skip to content

Commit

Permalink
Merge pull request #245 from KenEucker/develop
Browse files Browse the repository at this point in the history
3.3.3
  • Loading branch information
KenEucker authored Jan 24, 2024
2 parents cb8da3d + 15b76c6 commit fb4eeba
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 30 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "biketag-vue",
"version": "3.3.2",
"version": "3.3.3",
"license": "AGPL-3.0-or-later",
"author": "Ken Eucker",
"bugs": {
Expand Down Expand Up @@ -31,7 +31,7 @@
"@vueuse/head": "^2.0.0",
"ajv": "^8.12.0",
"autoprefixer": "^10.4.17",
"biketag": "^3.3.2",
"biketag": "^3.3.3",
"bootstrap": "^5.3.2",
"bootstrap-vue-next": "^0.15.5",
"crypto-js": "^4.2.0",
Expand Down
13 changes: 10 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,25 @@ function checkForNewBikeTagPost() {
async function created() {
const initResults = []
/// Set it first thing
await router.isReady()
const _gameIsSet = store.gameName?.length !== 0
if (_gameIsSet && router.currentRoute.value.name !== 'landing') {
const routeIsRoot = router.currentRoute.value.path === '/'
const routeIsLanding = router.currentRoute.value.name === 'Landing'
if (_gameIsSet && (!routeIsLanding || routeIsRoot)) {
const game = await store.setGame().catch((err) => {
debug('view::data-init', err)
// router.push('/landing')
})
gameIsSet.value = true
const routeIsHome = routeIsRoot ? true : router.currentRoute.value?.name === 'Home'
initResults.push(await store.fetchCurrentBikeTag())
if (game) {
await router.push({ name: 'Home' })
if (game && routeIsHome) {
const tagnumber = parseInt(router.currentRoute.value.path.split('/')[1]) ?? undefined
const params = { tagnumber }
await router.push({ name: 'Home', params })
}
initResults.push(store.fetchTags())
Expand Down
2 changes: 2 additions & 0 deletions src/assets/styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ body {

.popover {
z-index: 99;
max-width: 60vw;
min-width: 400px;
}

#app {
Expand Down
4 changes: 2 additions & 2 deletions src/components/BikeTagMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const emit = defineEmits(['dragend'])
const store = useBikeTagStore()
const worldZoom = 3
const cityZoom = 10
const tagsZoom = 20
const playZoom = 15
const centerNorthAmerica = [40, -45]
let map
Expand Down Expand Up @@ -114,7 +114,7 @@ onMounted(async () => {
draggable: true,
}).addTo(map)
L.control.locate().addTo(map)
map.setView(props.start, tagsZoom)
map.setView(props.start, playZoom)
marker.on('dragend', (e) => {
emit('dragend', e.target._latlng)
})
Expand Down
5 changes: 2 additions & 3 deletions src/components/BikeTagMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,9 @@ function onScroll() {
async function resetBikeTagApp() {
if (await isOnline()) {
store.resetBikeTagCache()
router.push({ name: 'Home' })
} else {
router.push('/')
}
router.push({ name: 'Home' })
}
function login() {
closeCollapsible()
Expand Down
5 changes: 4 additions & 1 deletion src/components/QueueFound.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
placeholder="Enter a location"
/>
</bike-tag-input>
<b-popover target="found" triggers="click focus" placement="top">
<b-popover target="found" :hide="!showMap" placement="top">
<template #title> Location: {{ getLocation }} </template>
<p v-if="locationDisabled">{{ t('pages.round.image_first') }}</p>
<bike-tag-map
Expand Down Expand Up @@ -172,6 +172,7 @@ const gps = ref({ lat: null, lng: null })
const isGpsDefault = ref(true)
const inputDOM = ref(null)
const showModal = ref(false)
const showMap = ref(false)
const uploadInProgress = ref(false)
const location = ref('')
const player = ref('')
Expand Down Expand Up @@ -442,6 +443,7 @@ const setImage = async (event) => {
lng: round(GPSData.longitude),
}
isGpsDefault.value = false
showMap.value = true
center.value = { ...gps.value }
} else if (getGame.value?.boundary.lat && getGame.value?.boundary.lng) {
gps.value = {
Expand All @@ -451,6 +453,7 @@ const setImage = async (event) => {
isGpsDefault.value = true
center.value = { ...gps.value }
} else {
showMap.value = true
isGpsDefault.value = false
}
location.value = ''
Expand Down
26 changes: 13 additions & 13 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,16 @@ import { useI18n } from 'vue-i18n'
// data
const router = useRouter()
const route = useRoute()
let tagnumber = ref(route.params?.tagnumber ? parseInt(route.params.tagnumber) : 0)
const tagIsLoading = ref(true)
const store = useBikeTagStore()
const { t } = useI18n()
const tagnumber = computed(() => (route.params?.tagnumber ? parseInt(route.params.tagnumber) : 0))

// computed
const getCurrentBikeTag = computed(() => store.getCurrentBikeTag)
const getImgurImageSized = computed(() => store.getImgurImageSized)
const getTags = computed(() => store.getTags)

/// Support legacy webHashHistory urls
if (tagnumber.value === 0 && window.location.hash.indexOf('#/') === 0) {
tagnumber.value = parseInt(window.location.hash.split('#/')[1])
}

const tag = computed(() => {
if (tagnumber.value !== 0) {
const tag = getTags.value?.filter((t) => t.tagnumber === tagnumber.value)
Expand All @@ -108,21 +103,26 @@ function tagImageLoaded() {
tagIsLoading.value = false
}
function goNextSingle() {
tagnumber.value++
if (tagnumber.value === getCurrentBikeTag.value.tagnumber) {
tagnumber.value = 0
router.push('/')
} else {
router.push(`/${tagnumber.value}`)
router.push(`/${tagnumber.value + 1}`)
}
}
function goPreviousSingle() {
tagnumber.value = tagnumber.value > 0 ? tagnumber.value : getCurrentBikeTag.value.tagnumber
tagnumber.value--
router.push(`/${tagnumber.value}`)
const newTagnumber = tagnumber.value > 0 ? tagnumber.value : getCurrentBikeTag.value.tagnumber
router.push(`/${newTagnumber - 1}`)
}

// mounted
onMounted(() => (tagIsLoading.value = tagnumber.value === 0))
onMounted(async () => {
await router.isReady()
/// Support legacy webHashHistory urls
if (tagnumber.value === 0 && window.location.hash.indexOf('#/') === 0) {
tagnumber.value = parseInt(window.location.hash.split('#/')[1])
}
tagIsLoading.value = tagnumber.value === 0
})
</script>

<style lang="scss">
Expand Down
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export default defineConfig({
EnvironmentPlugin(BikeTagEnv),
VitePWA({
srcDir: 'src',
filename: 'worker.ts',
strategies: 'injectManifest',
// filename: 'worker.ts',
strategies: 'generateSW',
registerType: 'autoUpdate',
includeAssets: ['**/*'],
// includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'mask-icon.png'],
Expand Down

0 comments on commit fb4eeba

Please sign in to comment.