Add URL params for InfoPanel tab and product (infoTab, infoProduct)
All checks were successful
Build Docker Image / build (push) Successful in 3m39s

This commit is contained in:
Ruslan Bakiev
2026-01-26 15:55:25 +07:00
parent 8354102895
commit f973784257
3 changed files with 66 additions and 24 deletions

View File

@@ -43,12 +43,14 @@
:related-hubs="relatedHubs"
:related-suppliers="relatedSuppliers"
:related-offers="relatedOffers"
:selected-product="selectedProduct"
:selected-product="infoProduct ?? null"
:current-tab="infoTab"
:loading="infoLoading"
@close="onInfoClose"
@add-to-filter="onInfoAddToFilter"
@open-info="onInfoOpenRelated"
@select-product="(uuid: string | null) => uuid && selectInfoProduct(uuid)"
@select-product="onInfoSelectProduct"
@update:current-tab="setInfoTab"
/>
<!-- Quote results: show offers after search -->
@@ -105,6 +107,8 @@ const {
catalogMode,
selectMode,
infoId,
infoTab,
infoProduct,
productId,
supplierId,
hubId,
@@ -116,6 +120,8 @@ const {
cancelSelect,
openInfo,
closeInfo,
setInfoTab,
setInfoProduct,
setLabel
} = useCatalogSearch()
@@ -231,11 +237,22 @@ watch([filterByBounds, currentMapBounds], ([enabled, bounds]) => {
watch(infoId, async (info) => {
if (info) {
await loadInfo(info.type, info.uuid)
// If URL has infoProduct, load offers for it
if (infoProduct.value) {
await selectInfoProduct(infoProduct.value)
}
} else {
clearInfo()
}
}, { immediate: true })
// Watch infoProduct URL param to load offers when it changes
watch(infoProduct, async (productUuid) => {
if (productUuid && infoId.value) {
await selectInfoProduct(productUuid)
}
})
// Related points for Info mode (shown on map)
const relatedPoints = computed(() => {
if (!infoId.value) return []
@@ -418,6 +435,11 @@ const onInfoOpenRelated = (type: 'hub' | 'supplier' | 'offer', uuid: string) =>
openInfo(type, uuid)
}
// Handle product selection in InfoPanel - update URL which triggers loading
const onInfoSelectProduct = (uuid: string | null) => {
setInfoProduct(uuid)
}
// Search for offers
const onSearch = async () => {
if (!canSearch.value) return