Refactor WebSocket handling and remove nuxt-visitors module

Replaced nuxt-visitors module with a custom WebSocket implementation for location tracking. Removed redundant code and comments in `useVisitors` composable and introduced the `location.server` plugin to manage user location. Updated dependencies and configurations to reflect these changes, streamlining the approach.
This commit is contained in:
2025-02-02 19:03:49 +01:00
parent 523a4a0582
commit 6ab4ffc092
10 changed files with 53 additions and 101 deletions

View File

@@ -57,7 +57,7 @@ async function toggleTheme() {
}
const { locale, setLocale, locales, t } = useI18n()
const currentLocale = computed(() => locales.filter(l => l.code === locale.value)[0])
const currentLocale = computed(() => locales.value.filter(l => l.code === locale.value)[0])
const lang = ref(locale.value)
watch(lang, () => changeLocale(lang.value))

View File

@@ -34,7 +34,7 @@ const DEFAULT_CONFIG: COBEOptions = {
mapBrightness: 1,
baseColor: [0.8, 0.8, 0.8],
opacity: 0.7,
markerColor: [251 / 255, 100 / 255, 21 / 255],
markerColor: [160 / 255, 160 / 255, 160 / 255],
glowColor: [1, 1, 1],
markers: [],
}
@@ -90,7 +90,6 @@ function onRender(state: Record<string, unknown>) {
state.height = width.value * 2
state.markers = props.locations?.map(location => ({
location: [location.latitude, location.longitude],
// Set the size of the marker to 0.1 if it's the user's location, otherwise 0.05
size: props.myLocation?.latitude === location.latitude && props.myLocation?.longitude === location.longitude ? 0.1 : 0.05,
}))
}

View File

@@ -2,7 +2,7 @@
import type { Stats } from '~~/types'
const { locale, locales } = useI18n()
const currentLocale = computed(() => locales.find(l => l.code === locale.value))
const currentLocale = computed(() => locales.value.find(l => l.code === locale.value))
const { data: stats } = await useFetch<Stats>('/api/stats')
const { t } = useI18n({