Main page shows hero, redirects to /catalog on first selection
Some checks failed
Build Docker Image / build (push) Has been cancelled
Some checks failed
Build Docker Image / build (push) Has been cancelled
This commit is contained in:
@@ -157,6 +157,13 @@ export function useCatalogSearch() {
|
|||||||
return 'hero'
|
return 'hero'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Check if we're on the main page (not /catalog)
|
||||||
|
const localePath = useLocalePath()
|
||||||
|
const isMainPage = computed(() => {
|
||||||
|
const catalogPath = localePath('/catalog')
|
||||||
|
return !route.path.startsWith(catalogPath)
|
||||||
|
})
|
||||||
|
|
||||||
// Navigation helpers
|
// Navigation helpers
|
||||||
const updateQuery = (updates: Partial<LocationQuery>) => {
|
const updateQuery = (updates: Partial<LocationQuery>) => {
|
||||||
const newQuery = { ...route.query }
|
const newQuery = { ...route.query }
|
||||||
@@ -169,7 +176,12 @@ export function useCatalogSearch() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.push({ query: newQuery })
|
// If on main page and adding filters, navigate to /catalog
|
||||||
|
if (isMainPage.value && Object.keys(newQuery).length > 0) {
|
||||||
|
router.push({ path: localePath('/catalog'), query: newQuery })
|
||||||
|
} else {
|
||||||
|
router.push({ query: newQuery })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const startSelect = (type: SelectMode) => {
|
const startSelect = (type: SelectMode) => {
|
||||||
@@ -197,7 +209,11 @@ export function useCatalogSearch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const clearAll = () => {
|
const clearAll = () => {
|
||||||
router.push({ query: {} })
|
if (isMainPage.value) {
|
||||||
|
router.push({ path: localePath('/catalog'), query: {} })
|
||||||
|
} else {
|
||||||
|
router.push({ query: {} })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text search (for filtering within current grid)
|
// Text search (for filtering within current grid)
|
||||||
|
|||||||
@@ -1,13 +1,44 @@
|
|||||||
<template>
|
<template>
|
||||||
<div></div>
|
<CatalogPage
|
||||||
|
:items="[]"
|
||||||
|
:loading="false"
|
||||||
|
:total-count="0"
|
||||||
|
:with-map="false"
|
||||||
|
map-id="main-catalog-map"
|
||||||
|
>
|
||||||
|
<template #searchBar>
|
||||||
|
<UnifiedSearchBar
|
||||||
|
:active-tokens="activeTokens"
|
||||||
|
:available-chips="availableChips"
|
||||||
|
:select-mode="selectMode"
|
||||||
|
:search-query="searchQuery"
|
||||||
|
@start-select="startSelect"
|
||||||
|
@cancel-select="cancelSelect"
|
||||||
|
@edit-token="editFilter"
|
||||||
|
@remove-token="removeFilter"
|
||||||
|
@update:search-query="searchQuery = $event"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #empty>
|
||||||
|
<CatalogHero @start-select="startSelect" />
|
||||||
|
</template>
|
||||||
|
</CatalogPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup lang="ts">
|
||||||
// Redirect to unified catalog
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
layout: 'topnav'
|
layout: 'topnav'
|
||||||
})
|
})
|
||||||
|
|
||||||
const localePath = useLocalePath()
|
const {
|
||||||
await navigateTo(localePath('/catalog'), { replace: true })
|
selectMode,
|
||||||
|
searchQuery,
|
||||||
|
activeTokens,
|
||||||
|
availableChips,
|
||||||
|
startSelect,
|
||||||
|
cancelSelect,
|
||||||
|
removeFilter,
|
||||||
|
editFilter
|
||||||
|
} = useCatalogSearch()
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user