cars: brand logos everywhere (search cards, brand grid, model headers), stricter logo matching + curated fixes, logo refresh in cars-photos
All checks were successful
Deploy production / deploy (push) Successful in 2m24s

This commit is contained in:
2026-10-24 17:37:43 +00:00
parent fac49b57ba
commit 8442d59b68
14 changed files with 664 additions and 42 deletions

View File

@@ -49,6 +49,7 @@ const cardColumns = {
name: carModels.name,
brandSlug: carBrands.slug,
brandName: carBrands.name,
brandLogo: carBrands.logo,
firstYear: carModels.firstYear,
lastYear: carModels.lastYear,
fuels: carModels.fuels,
@@ -102,8 +103,18 @@ export async function searchCars(f: CarFilters): Promise<{ cars: CarCard[]; tota
return { cars, total };
}
export type BrandTile = {
slug: string;
name: string;
models: number;
nlCount: number;
country: string | null;
logo: string | null;
};
type Overview = {
brands: { slug: string; name: string; models: number }[];
/** Alphabetical (for the filter); `byNl` has the same brands, most common in NL first. */
brands: BrandTile[];
byNl: BrandTile[];
stats: { brands: number; models: number; variants: number; nlCars: number };
};
let overviewCache: { at: number; value: Overview } | null = null;
@@ -113,7 +124,14 @@ export async function carOverview(): Promise<Overview> {
if (overviewCache && Date.now() - overviewCache.at < 600_000) return overviewCache.value;
const [brands, [counts]] = await Promise.all([
db
.select({ slug: carBrands.slug, name: carBrands.name, models: carBrands.modelCount })
.select({
slug: carBrands.slug,
name: carBrands.name,
models: carBrands.modelCount,
nlCount: carBrands.nlCount,
country: carBrands.country,
logo: carBrands.logo
})
.from(carBrands)
.orderBy(asc(carBrands.name)),
db
@@ -126,6 +144,9 @@ export async function carOverview(): Promise<Overview> {
]);
const value = {
brands,
byNl: [...brands].sort(
(a, b) => b.nlCount - a.nlCount || b.models - a.models || a.name.localeCompare(b.name)
),
stats: {
brands: brands.length,
models: counts.models,