Gate shop/blog filters behind CompanySettings toggles; fix blog filter z-index bug

Fixed: blog category filter bar was rendering behind the featured-post
card — that card pulls itself up (-mt-8, z-10) to overlap the hero's
bottom edge (its original design), but inserting the filter bar
between the hero and that card meant the same pull now overlapped the
filter bar instead, with the card's stacking rendering on top. Given
relative z-20 to stay above that overlap regardless. Also bumped the
inactive chip's background to bg-bg-muted — border-border on bg-base
is only a ~2% lightness difference, nearly invisible as a pill outline.

Both filters (shop price, blog category) now gated behind new
CompanySettings toggles (shopFilterEnabled/blogFilterEnabled), same
off-by-default pattern as wishlistEnabled/searchEnabled.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Marco
2026-07-30 23:07:49 +00:00
parent fc8a1d4201
commit f5b898a69a
3 changed files with 56 additions and 11 deletions
+31
View File
@@ -1039,6 +1039,37 @@ export async function getSearchEnabled(): Promise<boolean> {
return data.docs?.[0]?.searchEnabled ?? false;
}
// Same pattern as getWishlistEnabled()/getSearchEnabled() — gates the
// shop overview's price-range filter (ProductGrid.tsx/PriceRangeFilter.tsx).
export async function getShopFilterEnabled(): Promise<boolean> {
const params = new URLSearchParams({ "where[tenant.slug][equals]": TENANT_SLUG, limit: "1" });
const res = await fetch(`${PAYLOAD_URL}/api/company-settings?${params}`, {
headers: { "x-order-service-secret": process.env.ORDER_SERVICE_SECRET || "" },
next: { revalidate: 60 },
});
if (!res.ok) {
console.error(`getShopFilterEnabled: Payload returned ${res.status} ${res.statusText}`);
return false;
}
const data: { docs?: { shopFilterEnabled?: boolean }[] } = await res.json();
return data.docs?.[0]?.shopFilterEnabled ?? false;
}
// Same pattern — gates the blog overview's category filter (blog/page.tsx).
export async function getBlogFilterEnabled(): Promise<boolean> {
const params = new URLSearchParams({ "where[tenant.slug][equals]": TENANT_SLUG, limit: "1" });
const res = await fetch(`${PAYLOAD_URL}/api/company-settings?${params}`, {
headers: { "x-order-service-secret": process.env.ORDER_SERVICE_SECRET || "" },
next: { revalidate: 60 },
});
if (!res.ok) {
console.error(`getBlogFilterEnabled: Payload returned ${res.status} ${res.statusText}`);
return false;
}
const data: { docs?: { blogFilterEnabled?: boolean }[] } = await res.json();
return data.docs?.[0]?.blogFilterEnabled ?? false;
}
export type SeoSettings = {
defaultTitle: string | null;
titleTemplate: string | null;