feat(catalog): hide per-level category filter on vehicle page

The new cross-tree catalog search sits directly above the top-level grid on
the vehicle page, so the grid's own "Kategori ara…" filter was a redundant
second search box. Add a hideFilter prop to CategoryGrid and set it there;
catalog-browse and deep category levels (no global search) keep the filter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-27 13:35:50 +03:00
parent 8718b08415
commit f7d5f03572
2 changed files with 6 additions and 2 deletions

View File

@@ -25,6 +25,9 @@ interface CategoryGridProps {
brandName?: string;
parentId?: string;
variantSearch?: { body?: string; engine?: string; gearbox?: string };
/** Hide the per-level "Kategori ara…" filter — used where a broader
* cross-tree catalog search already sits above the grid. */
hideFilter?: boolean;
}
export function CategoryGrid({
@@ -34,6 +37,7 @@ export function CategoryGrid({
brandName,
parentId,
variantSearch,
hideFilter,
}: CategoryGridProps) {
const { t } = useTranslation();
const queryClient = useQueryClient();
@@ -58,7 +62,7 @@ export function CategoryGrid({
const visibleCategories = trimmedFilter
? categories.filter((c) => c.name.toLocaleLowerCase("tr").includes(trimmedFilter))
: categories;
const showFilter = categories.length > 8;
const showFilter = !hideFilter && categories.length > 8;
// Prefetch schema images for leaf categories in batches of 2
useEffect(() => {

View File

@@ -239,7 +239,7 @@ function VehicleDetailPage() {
))}
</div>
) : viewMode === "grid" ? (
<CategoryGrid categories={categoryTree || []} vehicleId={id} />
<CategoryGrid categories={categoryTree || []} vehicleId={id} hideFilter />
) : viewMode === "tree" ? (
<CategoryTree categories={categoryTree || []} vehicleId={id} />
) : (