Redesign header - move search bar into main navigation
All checks were successful
Build Docker Image / build (push) Successful in 3m10s

- Move search input with tokens into center of header
- Remove tabs (Search, Catalog, Orders, Seller)
- Icons (bot, globe, user) remain on right side
- Chips for filter selection below input
- Delete GlobalSearchBar.vue and UnifiedSearchBar.vue
- Share searchQuery via useState across composable calls
- Simplify main page to just show hero
This commit is contained in:
Ruslan Bakiev
2026-01-22 11:22:44 +07:00
parent 13325825d7
commit 584a423e86
7 changed files with 160 additions and 407 deletions

View File

@@ -2,7 +2,7 @@
<div class="min-h-screen flex flex-col bg-base-300">
<!-- Fixed Header Container (MainNav + SubNav) - slides up on scroll -->
<div class="fixed top-0 left-0 right-0 z-40" :style="headerStyle">
<!-- Main Navigation (Logo + Tabs + User) -->
<!-- Main Navigation (Logo + Search + User) -->
<MainNavigation
:session-checked="sessionChecked"
:logged-in="isLoggedIn"
@@ -12,10 +12,19 @@
:theme="theme"
:user-data="userData"
:is-seller="isSeller"
:active-tokens="activeTokens"
:available-chips="availableChips"
:select-mode="selectMode"
:search-query="searchQuery"
@toggle-theme="toggleTheme"
@sign-out="onClickSignOut"
@sign-in="signIn()"
@switch-team="switchToTeam"
@start-select="startSelect"
@cancel-select="cancelSelect"
@edit-token="editFilter"
@remove-token="removeFilter"
@update:search-query="searchQuery = $event"
/>
<!-- Sub Navigation (section-specific tabs) - only for non-catalog sections -->
@@ -25,9 +34,6 @@
/>
</div>
<!-- Global Search Bar - only on home page, in document flow -->
<GlobalSearchBar v-if="showSearch" class="border-b border-base-300 mt-16" />
<!-- Page content - padding-top compensates for fixed header -->
<main class="flex-1 flex flex-col min-h-0 px-3 lg:px-6" :style="mainStyle">
<slot />
@@ -41,6 +47,18 @@ const siteUrl = runtimeConfig.public.siteUrl || 'https://optovia.ru/'
const { signIn, signOut, loggedIn, fetch: fetchSession } = useAuth()
const route = useRoute()
// Catalog search state
const {
selectMode,
searchQuery,
activeTokens,
availableChips,
startSelect,
cancelSelect,
removeFilter,
editFilter
} = useCatalogSearch()
// Collapsible header for catalog pages
const { headerOffset, isCollapsed } = useScrollCollapse(118)
@@ -101,9 +119,6 @@ const isCatalogSection = computed(() => {
route.path.startsWith('/ru/catalog')
})
// Show search bar only on main page
const showSearch = computed(() => isHomePage.value)
// Collapsible header logic - only for pages with SubNav
const hasSubNav = computed(() => !isHomePage.value && !isCatalogSection.value)
const canCollapse = computed(() => hasSubNav.value)
@@ -116,10 +131,10 @@ const headerStyle = computed(() => {
})
// Main content padding-top to compensate for fixed header
// 64px = MainNav only (home, catalog)
// 118px = MainNav + SubNav (orders, seller, settings)
// 90px = MainNav with search (2 rows: top 56px + chips 34px)
// 144px = MainNav + SubNav (orders, seller, settings)
const mainStyle = computed(() => ({
paddingTop: (isHomePage.value || isCatalogSection.value) ? '64px' : '118px'
paddingTop: (isHomePage.value || isCatalogSection.value) ? '90px' : '144px'
}))
// Provide collapsed state to child components (CatalogPage needs it for map positioning)