timetracker update

This commit is contained in:
Daniel Goc
2026-03-11 09:33:36 +01:00
parent bbf8a2c133
commit 9ef4bb219b
121 changed files with 4328 additions and 2231 deletions

View File

@@ -1,6 +1,5 @@
<template>
<USelectMenu v-model="locale" :items="langs"
class="w-40 bg-white dark:bg-(--black) rounded-md shadow-sm hover:none!"
<USelectMenu v-model="locale" :items="langs" class="w-40 bg-white dark:bg-(--black) rounded-md shadow-sm hover:none!"
valueKey="iso_code" :searchInput="false">
<template #default="{ modelValue }">
<div class="flex items-center gap-1">
@@ -22,7 +21,7 @@ import { langs, currentLang } from '@/router/langs'
import { useRouter, useRoute } from 'vue-router'
import { useCookie } from '@/composable/useCookie'
import { computed, watch } from 'vue'
import { i18n } from '@/plugins/i18n'
import { i18n } from '@/plugins/02_i18n'
const router = useRouter()
const route = useRoute()
@@ -36,28 +35,23 @@ const locale = computed({
i18n.locale.value = value
currentLang.value = langs.find((x) => x.iso_code == value)
// Update URL to reflect language change
const currentPath = route.path
const pathParts = currentPath.split('/').filter(Boolean)
cookie.setCookie('lang_id', `${langs.find((x) => x.iso_code == value)?.id}`, { days: 60, secure: true, sameSite: 'Lax' })
if (pathParts.length > 0) {
// Check if first part is a locale
const isLocale = langs.some((l) => l.lang_code === pathParts[0])
if (isLocale) {
// Replace existing locale
pathParts[0] = value
router.replace({ path: '/' + pathParts.join('/'), query: route.query })
} else {
// Add locale to path
router.replace({ path: '/' + value + currentPath, query: route.query })
}
}
},
})
// Sync i18n locale with router locale on initial load
watch(
() => route.params.locale,
(newLocale) => {