--- import Layout from '../layouts/Layout.astro'; import ProductCard from '../components/ProductCard.astro'; import BrandCarousel from '../components/BrandCarousel.astro'; import SearchBar from '../components/SearchBar.tsx'; import RecentlyViewed from '../components/RecentlyViewed.tsx'; import SneakerOfTheDay from '../components/SneakerOfTheDay.astro'; import UspStrip from '../components/UspStrip.astro'; import ForYouSection from '../components/ForYouSection.tsx'; import DealsForYouSection from '../components/DealsForYouSection.tsx'; import StyleQuiz from '../components/StyleQuiz.tsx'; import { getTrendingFromDB, getPriceDropsFromDB, getProductCount, getShopCount, getPopularModels } from '../lib/products'; import { getBlogPosts } from '../lib/blog'; import { getUserFromRequest, getUserFromCookie } from '../lib/user-auth'; const spGender = Astro.cookies.get('sp_gender')?.value || undefined; // Hierarchical size filtering: check advanced mode cookie and user profile const user = await getUserFromCookie(Astro.cookies); const advancedOn = Astro.cookies.get('sp_size_mode')?.value === 'on'; const userId = (advancedOn && user?.id) ? user.id : undefined; const spSize = userId ? undefined : (Astro.cookies.get('sp_size')?.value || undefined); const trending = await getTrendingFromDB(8, spSize, spGender, userId); const priceDrops = await getPriceDropsFromDB(8, spSize, spGender, userId); const totalProductsRaw = await getProductCount(); const totalShops = await getShopCount(); // Round to nice number: 726508 → "726.000" const roundedK = Math.floor(totalProductsRaw / 1000); const totalProducts = `${roundedK}.000`; const popularModels = await getPopularModels(16); const { posts: latestPosts } = await getBlogPosts({ limit: 2 }); const categoryLabels: Record = { guides: 'Koopgids', deals: 'Deals', comparisons: 'Vergelijking', trends: 'Trends', }; ---