Files
webapp/app/pages/catalog/hubs/index.vue
Ruslan Bakiev b8de322dd2
All checks were successful
Build Docker Image / build (push) Successful in 3m45s
Unify layouts and create CatalogPage component
- MainNavigation: center tabs on page (absolute positioning)
- SubNavigation: align left instead of center
- Create CatalogPage universal component for list+map pages
- Migrate catalog pages (offers, suppliers, hubs) to CatalogPage
- Remove PageHeader from clientarea pages (redundant with navigation)
- Add topnav layout to supplier detail page

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 09:38:53 +07:00

83 lines
1.8 KiB
Vue

<template>
<CatalogPage
:items="items"
:loading="isLoading"
map-id="hubs-map"
point-color="#10b981"
:selected-id="selectedHubId"
@select="onSelectHub"
>
<template #filters>
<CatalogFilters :filters="filters" v-model="selectedFilter" />
</template>
<template #card="{ item }">
<template v-for="country in getCountryForHub(item)" :key="country.name">
<Text v-if="isFirstInCountry(item)" weight="semibold" class="mb-2">{{ country.name }}</Text>
</template>
<HubCard :hub="item" />
</template>
<template #pagination>
<PaginationLoadMore
:shown="items.length"
:total="total"
:can-load-more="canLoadMore"
:loading="isLoadingMore"
@load-more="loadMore"
/>
</template>
<template #empty>
<Text tone="muted">{{ t('catalogHubsSection.empty.no_hubs') }}</Text>
</template>
</CatalogPage>
</template>
<script setup lang="ts">
definePageMeta({
layout: 'topnav'
})
const { t } = useI18n()
const {
items,
total,
selectedFilter,
filters,
isLoading,
isLoadingMore,
itemsByCountry,
canLoadMore,
loadMore,
init
} = useCatalogHubs()
// Selected hub for map highlighting
const selectedHubId = ref<string>()
const onSelectHub = (hub: any) => {
selectedHubId.value = hub.uuid
}
// Helper to get country for hub
const getCountryForHub = (hub: any) => {
return itemsByCountry.value.filter(c => c.hubs.some(h => h.uuid === hub.uuid))
}
// Check if this hub is first in its country group
const isFirstInCountry = (hub: any) => {
for (const country of itemsByCountry.value) {
if (country.hubs[0]?.uuid === hub.uuid) return true
}
return false
}
await init()
useHead(() => ({
title: t('catalogHubsSection.header.title')
}))
</script>