Fix: sync UI section from route path on direct URL access
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Failing after 23s
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Failing after 23s
Navigating directly to /bugs, /oils etc. now correctly activates the matching tab and shows the right page content. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -68,8 +68,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted, watch } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import { useAuthStore } from './stores/auth'
|
import { useAuthStore } from './stores/auth'
|
||||||
import { useOilsStore } from './stores/oils'
|
import { useOilsStore } from './stores/oils'
|
||||||
import { useRecipesStore } from './stores/recipes'
|
import { useRecipesStore } from './stores/recipes'
|
||||||
@@ -83,8 +83,16 @@ const oils = useOilsStore()
|
|||||||
const recipeStore = useRecipesStore()
|
const recipeStore = useRecipesStore()
|
||||||
const ui = useUiStore()
|
const ui = useUiStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
const showUserMenu = ref(false)
|
const showUserMenu = ref(false)
|
||||||
|
|
||||||
|
// Sync ui.currentSection from route on load and navigation
|
||||||
|
const routeToSection = { '/': 'search', '/manage': 'manage', '/inventory': 'inventory', '/oils': 'oils', '/projects': 'projects', '/mydiary': 'mydiary', '/audit': 'audit', '/bugs': 'bugs', '/users': 'users' }
|
||||||
|
watch(() => route.path, (path) => {
|
||||||
|
const section = routeToSection[path] || 'search'
|
||||||
|
ui.showSection(section)
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
// Preview environment detection: pr-{id}.oil.oci.euphon.net
|
// Preview environment detection: pr-{id}.oil.oci.euphon.net
|
||||||
const hostname = window.location.hostname
|
const hostname = window.location.hostname
|
||||||
const prMatch = hostname.match(/^pr-(\d+)\./)
|
const prMatch = hostname.match(/^pr-(\d+)\./)
|
||||||
|
|||||||
Reference in New Issue
Block a user