fix: Findagram brands page crash and PWA icon errors

- Fix mapBrandForUI to use correct 'brand' field from API response
- Add null check in Brands.jsx filter to prevent crash on undefined names
- Fix BrandPenetrationService sps.brand_name -> sps.brand_name_raw
- Remove missing logo192.png and logo512.png from PWA manifest

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Kelly
2025-12-10 13:06:23 -07:00
parent 37cc8956c5
commit 53445fe72a
4 changed files with 13 additions and 21 deletions

View File

@@ -7,16 +7,6 @@
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",

View File

@@ -373,10 +373,12 @@ export function mapCategoryForUI(apiCategory) {
* Map API brand to UI-compatible format
*/
export function mapBrandForUI(apiBrand) {
// API returns 'brand' field (see /api/v1/brands endpoint)
const brandName = apiBrand.brand || apiBrand.brand_name || '';
return {
id: apiBrand.brand_name,
name: apiBrand.brand_name,
slug: apiBrand.brand_name?.toLowerCase().replace(/\s+/g, '-'),
id: brandName,
name: brandName,
slug: brandName ? brandName.toLowerCase().replace(/\s+/g, '-') : '',
logo: apiBrand.brand_logo_url || null,
productCount: parseInt(apiBrand.product_count || 0, 10),
dispensaryCount: parseInt(apiBrand.dispensary_count || 0, 10),

View File

@@ -27,7 +27,7 @@ const Brands = () => {
}, []);
const filteredBrands = brands.filter((brand) =>
brand.name.toLowerCase().includes(searchQuery.toLowerCase())
brand.name && brand.name.toLowerCase().includes(searchQuery.toLowerCase())
);
// Group brands alphabetically