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

View File

@@ -308,7 +308,6 @@ export function useCatalogSearch() {
}) })
const lastViewMode = useState<MapViewMode>('catalog-last-view-mode', () => 'offers') const lastViewMode = useState<MapViewMode>('catalog-last-view-mode', () => 'offers')
const setMapViewMode = (mode: MapViewMode) => { const setMapViewMode = (mode: MapViewMode) => {
if (selectMode.value) {
const newSelectMode: SelectMode = mode === 'hubs' ? 'hub' const newSelectMode: SelectMode = mode === 'hubs' ? 'hub'
: mode === 'suppliers' ? 'supplier' : mode === 'suppliers' ? 'supplier'
: 'product' : 'product'
@@ -316,9 +315,6 @@ export function useCatalogSearch() {
view: mode === 'offers' ? null : mode, view: mode === 'offers' ? null : mode,
select: newSelectMode select: newSelectMode
}) })
return
}
updateQuery({ view: mode === 'offers' ? null : mode })
} }
// Drawer state for list view // Drawer state for list view
@@ -368,10 +364,14 @@ export function useCatalogSearch() {
}) })
const setCatalogMode = (newMode: CatalogMode) => { const setCatalogMode = (newMode: CatalogMode) => {
const defaultSelect: SelectMode = selectMode.value
|| (mapViewMode.value === 'hubs' ? 'hub'
: mapViewMode.value === 'suppliers' ? 'supplier'
: 'product')
if (newMode === 'explore') { if (newMode === 'explore') {
updateQuery({ mode: newMode, qty: null }) updateQuery({ mode: newMode, qty: null, select: defaultSelect })
} else { } 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 = () => { const onSearch = () => {
// Navigate to catalog page if not there // Navigate to catalog page if not there
if (!route.path.includes('/catalog')) { 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) // Trigger search by incrementing the counter (page watches this)
searchTrigger.value++ searchTrigger.value++

View File

@@ -17,7 +17,7 @@
</IconCircle> </IconCircle>
<Heading :level="2">{{ t('catalogProduct.not_found.title') }}</Heading> <Heading :level="2">{{ t('catalogProduct.not_found.title') }}</Heading>
<Text tone="muted">{{ t('catalogProduct.not_found.subtitle') }}</Text> <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') }} {{ t('catalogProduct.actions.back_to_catalog') }}
</Button> </Button>
</Stack> </Stack>

View File

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