add github link, do not ask for user's location unless they want it

This commit is contained in:
Will Freeman
2024-10-29 21:08:58 -06:00
parent b5dc9c0a56
commit 61d27c1b0f
2 changed files with 17 additions and 11 deletions

View File

@@ -17,6 +17,7 @@ const items = [
{ title: 'About', icon: 'mdi-information', to: '/about' },
{ title: 'Contact', icon: 'mdi-email', to: '/contact' },
{ title: 'Feature Roadmap', icon: 'mdi-road-variant', to: '/roadmap' },
{ title: 'GitHub', icon: 'mdi-github', href: 'https://github.com/frillweeman/deflock'}
]
const drawer = ref(false)
@@ -61,6 +62,7 @@ watch(() => theme.global.name.value, (newTheme) => {
:key="item.title"
link
:to="item.to"
:href="item.href"
><v-icon start>{{ item.icon }}</v-icon>{{ item.title }}</v-list-item>
</v-list>
</v-navigation-drawer>

View File

@@ -3,7 +3,7 @@
<NewVisitor />
<v-card class="map-notif" v-show="isLoadingALPRs && !showClusters">
<v-card-title><v-progress-circular indeterminate color="primary" size="x-large" /></v-card-title>
<v-card-title><v-progress-circular indeterminate color="primary" /></v-card-title>
</v-card>
<!-- use-global-leaflet=false is a workaround for a bug in current version of vue-leaflet -->
@@ -59,6 +59,9 @@
</template>
</v-text-field>
</form>
<v-btn @click="goToUserLocation" icon class="mt-2">
<v-icon x-large>mdi-crosshairs-gps</v-icon>
</v-btn>
</l-control>
<!-- url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" -->
<l-tile-layer
@@ -148,6 +151,15 @@ function onSearch() {
});
}
function goToUserLocation() {
getUserLocation()
.then(location => {
center.value = { lat: location[0], lng: location[1] };
}).catch(error => {
console.debug('Error getting user location.', error);
});
}
function getUserLocation(): Promise<[number, number]> {
return new Promise((resolve, reject) => {
if (navigator.geolocation) {
@@ -253,17 +265,9 @@ onMounted(() => {
lng: parseFloat(parts[2]),
};
}
} else {
center.value = { lat: 37.855068, lng: -122.357998 };
}
getUserLocation()
.then(location => {
if (!hash)
center.value = { lat: location[0], lng: location[1] };
}).catch(error => {
// TODO: allow search
console.debug('Error getting user location. Defaulting to Huntsville, AL.', error);
center.value = { lat: 34.730819, lng: -86.586114 }; // Huntsville, AL
});
});
</script>