From 03485b77a50137036993e8c62748afd67b4dc78a Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Thu, 15 Jan 2026 11:18:57 +0700 Subject: [PATCH] Refactor: use topnav layout + CatalogPage component - Remove catalog.vue layout and useCatalogLayout.ts (broken provide/inject) - All catalog/clientarea list pages now use topnav layout - Pages use CatalogPage component for SearchBar + Map functionality - Clean architecture: layout handles nav, component handles features --- app/composables/useCatalogLayout.ts | 71 ----- app/layouts/catalog.vue | 338 ----------------------- app/pages/catalog/hubs/index.vue | 203 +++++--------- app/pages/catalog/offers/index.vue | 140 ++++------ app/pages/catalog/suppliers/index.vue | 105 +++---- app/pages/clientarea/addresses/index.vue | 149 ++++------ app/pages/clientarea/offers/index.vue | 245 +++++++--------- app/pages/clientarea/orders/index.vue | 242 +++++++--------- 8 files changed, 401 insertions(+), 1092 deletions(-) delete mode 100644 app/composables/useCatalogLayout.ts delete mode 100644 app/layouts/catalog.vue diff --git a/app/composables/useCatalogLayout.ts b/app/composables/useCatalogLayout.ts deleted file mode 100644 index 0c05b72..0000000 --- a/app/composables/useCatalogLayout.ts +++ /dev/null @@ -1,71 +0,0 @@ -import type { Ref, ComputedRef, Component, VNode } from 'vue' - -export interface CatalogFilter { - id: string - label: string -} - -export interface CatalogMapItem { - uuid: string - name?: string - latitude: number - longitude: number - [key: string]: any -} - -export interface CatalogHoveredItem { - latitude: number - longitude: number -} - -export interface SubNavItem { - label: string - path: string -} - -export interface CatalogLayoutData { - // SubNavigation (optional - if provided, overrides default catalog nav) - subNavItems?: SubNavItem[] - - // SearchBar - searchQuery: Ref - activeFilters: ComputedRef | Ref - displayedCount: ComputedRef | Ref - totalCount: ComputedRef | Ref - onSearch: () => void - onRemoveFilter: (id: string) => void - // Filter slot - can be a component, render function, or VNode - filterComponent?: Component | (() => VNode | VNode[]) - // Header slot - optional component to render above the list (e.g. "Add" button) - headerComponent?: Component | (() => VNode | VNode[]) - - // Map - mapItems: ComputedRef | Ref - mapId: string - pointColor: string - hoveredItemId: Ref - hoveredItem: ComputedRef | Ref - onMapSelect: (uuid: string) => void - onBoundsChange?: (bounds: any) => void - searchWithMap: Ref - - // Clustering (optional) - useServerClustering?: boolean - clusteredNodes?: ComputedRef | Ref -} - -const CATALOG_LAYOUT_KEY = Symbol('catalogLayout') - -/** - * Provide catalog layout data from page to layout - */ -export const provideCatalogLayout = (data: CatalogLayoutData) => { - provide(CATALOG_LAYOUT_KEY, data) -} - -/** - * Inject catalog layout data in layout from page - */ -export const useCatalogLayoutData = (): CatalogLayoutData | undefined => { - return inject(CATALOG_LAYOUT_KEY) -} diff --git a/app/layouts/catalog.vue b/app/layouts/catalog.vue deleted file mode 100644 index 1b1d757..0000000 --- a/app/layouts/catalog.vue +++ /dev/null @@ -1,338 +0,0 @@ - - - diff --git a/app/pages/catalog/hubs/index.vue b/app/pages/catalog/hubs/index.vue index c9a99b1..9a5494c 100644 --- a/app/pages/catalog/hubs/index.vue +++ b/app/pages/catalog/hubs/index.vue @@ -1,57 +1,90 @@