From 166c404ff62127b650ca15cad92793ce495b98dd Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Thu, 22 Jan 2026 11:08:57 +0700 Subject: [PATCH] Main page shows hero, redirects to /catalog on first selection --- app/composables/useCatalogSearch.ts | 20 ++++++++++++-- app/pages/index.vue | 41 +++++++++++++++++++++++++---- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/app/composables/useCatalogSearch.ts b/app/composables/useCatalogSearch.ts index caea158..0f08f2f 100644 --- a/app/composables/useCatalogSearch.ts +++ b/app/composables/useCatalogSearch.ts @@ -157,6 +157,13 @@ export function useCatalogSearch() { return 'hero' }) + // Check if we're on the main page (not /catalog) + const localePath = useLocalePath() + const isMainPage = computed(() => { + const catalogPath = localePath('/catalog') + return !route.path.startsWith(catalogPath) + }) + // Navigation helpers const updateQuery = (updates: Partial) => { const newQuery = { ...route.query } @@ -169,7 +176,12 @@ export function useCatalogSearch() { } }) - router.push({ query: newQuery }) + // If on main page and adding filters, navigate to /catalog + if (isMainPage.value && Object.keys(newQuery).length > 0) { + router.push({ path: localePath('/catalog'), query: newQuery }) + } else { + router.push({ query: newQuery }) + } } const startSelect = (type: SelectMode) => { @@ -197,7 +209,11 @@ export function useCatalogSearch() { } const clearAll = () => { - router.push({ query: {} }) + if (isMainPage.value) { + router.push({ path: localePath('/catalog'), query: {} }) + } else { + router.push({ query: {} }) + } } // Text search (for filtering within current grid) diff --git a/app/pages/index.vue b/app/pages/index.vue index fc07b32..c816b89 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -1,13 +1,44 @@ -