Keep select param on navigation and toggles
All checks were successful
Build Docker Image / build (push) Successful in 5m5s

This commit is contained in:
Ruslan Bakiev
2026-02-07 12:14:00 +07:00
parent 1f60062d15
commit 481a38b3a1
5 changed files with 17 additions and 17 deletions

View File

@@ -3,7 +3,7 @@
<!-- Header with back button -->
<div class="p-4 border-b border-base-300">
<NuxtLink
:to="localePath('/catalog')"
:to="localePath('/catalog?select=product')"
class="btn btn-sm btn-ghost gap-2"
>
<Icon name="lucide:arrow-left" size="18" />

View File

@@ -308,17 +308,13 @@ export function useCatalogSearch() {
})
const lastViewMode = useState<MapViewMode>('catalog-last-view-mode', () => 'offers')
const setMapViewMode = (mode: MapViewMode) => {
if (selectMode.value) {
const newSelectMode: SelectMode = mode === 'hubs' ? 'hub'
: mode === 'suppliers' ? 'supplier'
: 'product'
updateQuery({
view: mode === 'offers' ? null : mode,
select: newSelectMode
})
return
}
updateQuery({ view: mode === 'offers' ? null : mode })
const newSelectMode: SelectMode = mode === 'hubs' ? 'hub'
: mode === 'suppliers' ? 'supplier'
: 'product'
updateQuery({
view: mode === 'offers' ? null : mode,
select: newSelectMode
})
}
// Drawer state for list view
@@ -368,10 +364,14 @@ export function useCatalogSearch() {
})
const setCatalogMode = (newMode: CatalogMode) => {
const defaultSelect: SelectMode = selectMode.value
|| (mapViewMode.value === 'hubs' ? 'hub'
: mapViewMode.value === 'suppliers' ? 'supplier'
: 'product')
if (newMode === 'explore') {
updateQuery({ mode: newMode, qty: null })
updateQuery({ mode: newMode, qty: null, select: defaultSelect })
} else {
updateQuery({ mode: newMode })
updateQuery({ mode: newMode, select: defaultSelect })
}
}

View File

@@ -333,7 +333,7 @@ const searchTrigger = useState<number>('catalog-search-trigger', () => 0)
const onSearch = () => {
// Navigate to catalog page if not there
if (!route.path.includes('/catalog')) {
router.push({ path: localePath('/catalog'), query: { ...route.query, mode: 'quote' } })
router.push({ path: localePath('/catalog'), query: { ...route.query, mode: 'quote', select: 'product' } })
}
// Trigger search by incrementing the counter (page watches this)
searchTrigger.value++

View File

@@ -17,7 +17,7 @@
</IconCircle>
<Heading :level="2">{{ t('catalogProduct.not_found.title') }}</Heading>
<Text tone="muted">{{ t('catalogProduct.not_found.subtitle') }}</Text>
<Button @click="navigateTo(localePath('/catalog'))">
<Button @click="navigateTo(localePath('/catalog?select=product'))">
{{ t('catalogProduct.actions.back_to_catalog') }}
</Button>
</Stack>

View File

@@ -11,7 +11,7 @@
</Stack>
<Stack direction="row" gap="3">
<Button :as="'NuxtLink'" :to="localePath('/catalog')" variant="ghost">
<Button :as="'NuxtLink'" :to="localePath('/catalog?select=product')" variant="ghost">
{{ t('searchPage.cta.catalog') }}
</Button>
<Button :as="'NuxtLink'" :to="localePath('/clientarea/orders')" variant="outline">