Hide category cards for empty categories. Changed seoLink to slug on Category interface.

This commit is contained in:
David Ball 2024-07-13 00:50:09 -04:00
parent 0392a5a79c
commit ceb7672194
12 changed files with 166 additions and 166 deletions

View File

@ -9,7 +9,7 @@ const { category } = Astro.props;
---
<li class="link-card">
<a href={`/category/${category.seoLink}`}>
<a href={`/category/${category.slug}`}>
{category.imageUrl !== undefined && <img src={category.imageUrl} alt={category.category} />}
<h2>
{category.category}

View File

@ -1,5 +1,5 @@
import { type Product } from '../products/product';
import { getCategoryIdForSeoLink } from '../categories';
import { getCategoryIdForSlug } from '../categories';
export const BRAND_STORE_SLUG = 'coast';
@ -10,7 +10,7 @@ export const CoastStoreProducts: Product[] = [
brandStoreSlug: BRAND_STORE_SLUG,
name: 'Durable 8" Spot/Flood LED flashlight',
callout: `House numbers can be tricky to locate late in the evening.`,
categoryId: getCategoryIdForSeoLink('safety-equipment')!,
categoryId: getCategoryIdForSlug('safety-equipment')!,
description: `
**Light Up Your Delivery Route**

View File

@ -1,5 +1,5 @@
import { type Product } from '../products/product';
import { getCategoryIdForSeoLink } from '../categories';
import { getCategoryIdForSlug } from '../categories';
export const BRAND_STORE_SLUG = 'first-aid-only';
@ -7,7 +7,7 @@ export const FirstAidOnlyStoreProducts: Product[] = [
{
amazonLink: 'https://www.amazon.com/First-Aid-Only-Weatherproof-Plastic/dp/B001SG76MU?crid=17746AVZ2R4TK&dib=eyJ2IjoiMSJ9.nehq12VwBTB17Vyx1YODXq7JYQbnOM8xv6AZRadSceLpsk33o-ES3M7UnJMkq0usrVmB1uKgdw9rxtPf7wcS1fHI_DhXIkjp7ujnBf0xvt-SjW3Xw__yU6NvYnSUmSfQzcqj49ZMu893KSypCAIPiLZ0gHo9HbRPicFsuJVBOCv5aOQoBqlLRymArai_8k9lUwtCxAfhfiDjUGk6K3s_S6IFWUP88Ff8mbyU5lkVRtbE4dRTCp-wNjM6HpxqZPSZ0A3_-PPl75PlgjsmUXIkxArreEPatqaHwyJ13X-DCQU.CWOEqmjYxSJ7yRXLCgtz9iGOSGJD53MSoPw6jzAWx7Q&dib_tag=se&keywords=first+aid+kit&qid=1720746463&sprefix=first+aid+kit%2Caps%2C95&sr=8-3-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1&linkCode=ll1&tag=dashersupply-20&linkId=385f21e08641ef9ce7ad55aebe2d30cf&language=en_US&ref_=as_li_ss_tl',
slug: 'B001SG76MU',
categoryId: getCategoryIdForSeoLink('safety-equipment')!,
categoryId: getCategoryIdForSlug('safety-equipment')!,
name: "57-pc First Aid Kit (small)",
tags: ['safety','first-aid'],
brandStoreSlug: BRAND_STORE_SLUG,

View File

@ -1,5 +1,5 @@
import { type Product } from '../products/product';
import { getCategoryIdForSeoLink } from '../categories';
import { getCategoryIdForSlug } from '../categories';
export const BRAND_STORE_SLUG = 'rubbermaid';
@ -9,7 +9,7 @@ export const RubbermaidStoreProducts: Product[] = [
amazonLink: 'https://www.amazon.com/Rubbermaid-Commercial-Deluxe-Cleaning-FG315488BLA/dp/B00006ICOT?crid=23IAS1CUMM6QG&dib=eyJ2IjoiMSJ9.WRH21whjlnubmVRL4HRNIccU9p3CC9B9pvd9LCCkzqxXQggwnV0UNwmgHs868sL9Jr_1cfUHxsHCU7sTT28EMZOCdxoGo-ylie7hWbrQ75ab9SFUJMawaE14LhyNFAQ69j45EtR9kd0njMvXY9WDrBWj61TMpe6K1vl0BC-kWFz8iQqZgrRsgLNN5jbuF83nWOddYMTMZFxQXuvyPUG13LwYmOe17iPUBa03FNecKl0.-fxaqjBgRSTfoIeqegQhb9rz9lE9LJTt475JTTi0J3A&dib_tag=se&keywords=drink+carrier&qid=1719716583&sprefix=drink+carrier%2Caps%2C162&sr=8-3&linkCode=ll1&tag=dashersupply-20&linkId=1a29425189155a3bbe240c193bd1589e&language=en_US&ref_=as_li_ss_tl',
// amazonLink: 'https://www.amazon.com/Rubbermaid-Commercial-Deluxe-Cleaning-FG315488BLA/dp/B00006ICOT?crid=23IAS1CUMM6QG&dib=eyJ2IjoiMSJ9.WRH21whjlnubmVRL4HRNIccU9p3CC9B9pvd9LCCkzqxXQggwnV0UNwmgHs868sL9Jr_1cfUHxsHCU7sTT28EMZOCdxoGo-ylie7hWbrQ75ab9SFUJMawaE14LhyNFAQ69j45EtR9kd0njMvXY9WDrBWj61TMpe6K1vl0BC-kWFz8iQqZgrRsgLNN5jbuF83nWOddYMTMZFxQXuvyPUG13LwYmOe17iPUBa03FNecKl0.-fxaqjBgRSTfoIeqegQhb9rz9lE9LJTt475JTTi0J3A&dib_tag=se&keywords=drink+carrier&qid=1719716583&sprefix=drink+carrier%2Caps%2C162&sr=8-3&linkCode=ll1&tag=radspazzyspaz-20&linkId=50dbc148d6ed4c95a175ce34d86775f8&language=en_US&ref_=as_li_ss_tl',
tags: ['drink carrier'],
categoryId: getCategoryIdForSeoLink('delivery-gear')!,
categoryId: getCategoryIdForSlug('delivery-gear')!,
name: 'Industrial Drink Carrier',
brandStoreSlug: BRAND_STORE_SLUG,
callout: 'Running out of cup holders? Spilling drinks? Juggling the struggle?',

View File

@ -1,5 +1,5 @@
import { type Product } from '../products/product';
import { getCategoryIdForSeoLink } from '../categories';
import { getCategoryIdForSlug } from '../categories';
export const BRAND_STORE_SLUG = 'vortex-optics';
@ -10,7 +10,7 @@ export const VortexOpticsStoreProducts: Product[] = [
callout: 'Out in the sticks? Am I in the right place or is this a wrong turn?',
amazonLink: 'https://www.amazon.com/dp/B07V3LB5DN?social_share=cm_sw_r_cso_cp_apin_dp_1S8QG7ATMWQXHEPZZJMA&starsLeft=1&fbclid=IwZXh0bgNhZW0CMTEAAR0r1pSlSIglwL42EFH5z3urFfzpT1EnEmxsTc589_C-QjkKpQYBl0m10wc_aem_tfAE9o8HXXadzB6BWVN-Sg&th=1&linkCode=ll1&tag=dashersupply-20&linkId=418648d02fea89d3cf2fad9645fe9f6e&language=en_US&ref_=as_li_ss_tl',
brandStoreSlug: BRAND_STORE_SLUG,
categoryId: getCategoryIdForSeoLink('safety-equipment')!,
categoryId: getCategoryIdForSlug('safety-equipment')!,
tags: ['safety', 'outdoor'],
description: `
Let's just say you're pulling up and you're not sure if it's the right place. When you need a closer look, look no further than

View File

@ -11,9 +11,9 @@ export interface Category {
*/
category: string;
/**
* SEO-optimized link for Product Category.
* URL slug for Product Category.
*/
seoLink: string;
slug: string;
/**
* Image for the category.
*/
@ -49,72 +49,71 @@ export const ALL_CATEGORIES: Category[] = [
{
id: StaticCategory.nextId(),
category: "Vehicle Essentials",
seoLink: "vehicle-essentials",
slug: "vehicle-essentials",
imageUrl: "/assets/vehicle-essentials.png",
description: "Essential items for your vehicle to ensure smooth deliveries.",
},
{
id: StaticCategory.nextId(),
category: "Delivery Gear",
seoLink: "delivery-gear",
slug: "delivery-gear",
imageUrl: "/assets/delivery-gear-3.jpg",
description: "Gear to help you deliver food efficiently and keep it in top condition.",
},
{
id: StaticCategory.nextId(),
category: "Personal Items",
seoLink: "personal-items",
slug: "personal-items",
imageUrl: "/assets/personal-items.jpg",
description: "Personal essentials to keep you comfortable and prepared on the go.",
},
{
id: StaticCategory.nextId(),
category: "Safety Equipment",
seoLink: "safety-equipment",
slug: "safety-equipment",
imageUrl: "/assets/safety-equipment.jpg",
description: "Safety gear to protect you during deliveries.",
},
{
id: StaticCategory.nextId(),
category: "Tech Gadgets",
seoLink: "tech-gadgets",
slug: "tech-gadgets",
imageUrl: "/assets/tech-gadgets.jpg",
description: "Technology tools to enhance your efficiency and connectivity.",
},
{
id: StaticCategory.nextId(),
category: "Biking Gear",
seoLink: "biking-gear",
slug: "biking-gear",
imageUrl: "/assets/biking-gear.jpg",
description: "Equipment for Dashers who deliver by bike.",
},
{
id: StaticCategory.nextId(),
category: "Comfort and Convenience",
seoLink: "comfort-convenience",
slug: "comfort-convenience",
imageUrl: "/assets/comfort-convenience.png",
description: "Items to increase comfort and convenience during deliveries.",
},
{
id: StaticCategory.nextId(),
category: "Health and Wellness",
seoLink: "health-wellness",
slug: "health-wellness",
imageUrl: "/assets/wearable-tech.jpg",
description: "Products to help you stay healthy and well during your shifts.",
},
{
id: StaticCategory.nextId(),
category: "Miscellaneous",
seoLink: "misc",
slug: "misc",
imageUrl: "/assets/misc.jpg",
description: "Various other items that can be useful for Dashers.",
}
].sort((a, b) => a.seoLink.localeCompare(b.seoLink));
].sort((a, b) => a.slug.localeCompare(b.slug));
export function getCategoryIdForSeoLink(seoLink: string): number|null {
console.log('getCategoryIdForSeoLink looking for ', seoLink, 'in', ALL_CATEGORIES);
export function getCategoryIdForSlug(slug: string): number|null {
for (const category of ALL_CATEGORIES) {
if (category.seoLink == seoLink) {
if (category.slug == slug) {
return category.id;
}
};

View File

@ -1,4 +1,4 @@
import { getCategoryIdForSeoLink } from '../categories';
// import { getCategoryIdForSlug } from '../categories';
import { type Product } from './product';
import { ALL_BRAND_PRODUCTS } from '../brands';
@ -6,138 +6,142 @@ import { ALL_BRAND_PRODUCTS } from '../brands';
* A list of all the products.
*/
export const ALL_PRODUCTS: Product[] = [
...ALL_BRAND_PRODUCTS
// {
// productDetails:
// }
// {
// name: 'Car Phone Mount',
// description: "Essential for navigation.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ1234',
// tags: ['phone mount', 'navigation', 'car'],
// categoryId: getCategoryIdForSeoLink('vehicle-essentials')!,
// },
// {
// name: 'Car Charger',
// description: "Keep your phone charged during long shifts.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ5678',
// tags: ['charger', 'car', 'accessory'],
// categoryId: getCategoryIdForSeoLink('vehicle-essentials')!,
// },
// {
// name: 'Insulated Delivery Bag',
// description: "Keep food at the right temperature.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ9101',
// tags: ['delivery bag', 'insulated', 'food'],
// categoryId: getCategoryIdForSeoLink('delivery-gear')!,
// },
// {
// name: 'Drink Carrier',
// description: "Securely transport multiple beverages.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ1213',
// tags: ['drink carrier', 'beverages', 'delivery'],
// categoryId: getCategoryIdForSeoLink('delivery-gear')!,
// },
// {
// name: 'Portable Phone Charger',
// description: "Backup power for your phone.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ1415',
// tags: ['phone charger', 'portable', 'backup'],
// categoryId: getCategoryIdForSeoLink('personal-items')!,
// },
// {
// name: 'Comfortable Clothing',
// description: "Weather-appropriate attire.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ1617',
// tags: ['clothing', 'comfortable', 'weather'],
// categoryId: getCategoryIdForSeoLink('personal-items')!,
// },
// {
// name: 'Reflective Vest',
// description: "Increase visibility, especially for night deliveries.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ1819',
// tags: ['reflective vest', 'safety', 'visibility'],
// categoryId: getCategoryIdForSeoLink('safety-equipment')!,
// },
// {
// name: 'First Aid Kit',
// description: "Be prepared for minor injuries.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ2021',
// tags: ['first aid', 'safety', 'kit'],
// categoryId: getCategoryIdForSeoLink('safety-equipment')!,
// },
// {
// name: 'Smartphone',
// description: "Reliable phones with good battery life and performance.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ2223',
// tags: ['smartphone', 'tech', 'battery life'],
// categoryId: getCategoryIdForSeoLink('tech-gadgets')!,
// },
// {
// name: 'Bluetooth Headset',
// description: "For hands-free communication.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ2425',
// tags: ['bluetooth headset', 'communication', 'hands-free'],
// categoryId: getCategoryIdForSeoLink('tech-gadgets')!,
// },
// {
// name: 'Bike Lock',
// description: "Secure your bike while making deliveries.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ2627',
// tags: ['bike lock', 'security', 'biking'],
// categoryId: getCategoryIdForSeoLink('biking-gear')!,
// },
// {
// name: 'Bike Lights',
// description: "For visibility and safety during night rides.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ2829',
// tags: ['bike lights', 'visibility', 'night'],
// categoryId: getCategoryIdForSeoLink('biking-gear')!,
// },
// {
// name: 'Portable Cooler',
// description: "Keep drinks and snacks cold during shifts.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ3031',
// tags: ['cooler', 'portable', 'convenience'],
// categoryId: getCategoryIdForSeoLink('comfort-convenience')!,
// },
// {
// name: 'Sunshade',
// description: "Protect your car's interior and keep it cool.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ3233',
// tags: ['sunshade', 'car', 'protection'],
// categoryId: getCategoryIdForSeoLink('comfort-convenience')!,
// },
// {
// name: 'Fitness Tracker',
// description: "Monitor your activity and health.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ3435',
// tags: ['fitness tracker', 'health', 'activity'],
// categoryId: getCategoryIdForSeoLink('health-wellness')!,
// },
// {
// name: 'Healthy Snacks',
// description: "Convenient, healthy snacks for long shifts.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ3637',
// tags: ['healthy snacks', 'convenience', 'health'],
// categoryId: getCategoryIdForSeoLink('health-wellness')!,
// },
// {
// name: 'Flashlight',
// description: "Handy for night deliveries.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ3839',
// tags: ['flashlight', 'night', 'deliveries'],
// categoryId: getCategoryIdForSeoLink('misc')!,
// },
// {
// name: 'Multi-tool',
// description: "Useful for various minor fixes and adjustments.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ4041',
// tags: ['multi-tool', 'utility', 'fixes'],
// categoryId: getCategoryIdForSeoLink('misc')!
// }
...ALL_BRAND_PRODUCTS
// {
// productDetails:
// }
// {
// name: 'Car Phone Mount',
// description: "Essential for navigation.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ1234',
// tags: ['phone mount', 'navigation', 'car'],
// categoryId: getCategoryIdForSeoLink('vehicle-essentials')!,
// },
// {
// name: 'Car Charger',
// description: "Keep your phone charged during long shifts.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ5678',
// tags: ['charger', 'car', 'accessory'],
// categoryId: getCategoryIdForSeoLink('vehicle-essentials')!,
// },
// {
// name: 'Insulated Delivery Bag',
// description: "Keep food at the right temperature.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ9101',
// tags: ['delivery bag', 'insulated', 'food'],
// categoryId: getCategoryIdForSeoLink('delivery-gear')!,
// },
// {
// name: 'Drink Carrier',
// description: "Securely transport multiple beverages.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ1213',
// tags: ['drink carrier', 'beverages', 'delivery'],
// categoryId: getCategoryIdForSeoLink('delivery-gear')!,
// },
// {
// name: 'Portable Phone Charger',
// description: "Backup power for your phone.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ1415',
// tags: ['phone charger', 'portable', 'backup'],
// categoryId: getCategoryIdForSeoLink('personal-items')!,
// },
// {
// name: 'Comfortable Clothing',
// description: "Weather-appropriate attire.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ1617',
// tags: ['clothing', 'comfortable', 'weather'],
// categoryId: getCategoryIdForSeoLink('personal-items')!,
// },
// {
// name: 'Reflective Vest',
// description: "Increase visibility, especially for night deliveries.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ1819',
// tags: ['reflective vest', 'safety', 'visibility'],
// categoryId: getCategoryIdForSeoLink('safety-equipment')!,
// },
// {
// name: 'First Aid Kit',
// description: "Be prepared for minor injuries.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ2021',
// tags: ['first aid', 'safety', 'kit'],
// categoryId: getCategoryIdForSeoLink('safety-equipment')!,
// },
// {
// name: 'Smartphone',
// description: "Reliable phones with good battery life and performance.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ2223',
// tags: ['smartphone', 'tech', 'battery life'],
// categoryId: getCategoryIdForSeoLink('tech-gadgets')!,
// },
// {
// name: 'Bluetooth Headset',
// description: "For hands-free communication.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ2425',
// tags: ['bluetooth headset', 'communication', 'hands-free'],
// categoryId: getCategoryIdForSeoLink('tech-gadgets')!,
// },
// {
// name: 'Bike Lock',
// description: "Secure your bike while making deliveries.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ2627',
// tags: ['bike lock', 'security', 'biking'],
// categoryId: getCategoryIdForSeoLink('biking-gear')!,
// },
// {
// name: 'Bike Lights',
// description: "For visibility and safety during night rides.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ2829',
// tags: ['bike lights', 'visibility', 'night'],
// categoryId: getCategoryIdForSeoLink('biking-gear')!,
// },
// {
// name: 'Portable Cooler',
// description: "Keep drinks and snacks cold during shifts.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ3031',
// tags: ['cooler', 'portable', 'convenience'],
// categoryId: getCategoryIdForSeoLink('comfort-convenience')!,
// },
// {
// name: 'Sunshade',
// description: "Protect your car's interior and keep it cool.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ3233',
// tags: ['sunshade', 'car', 'protection'],
// categoryId: getCategoryIdForSeoLink('comfort-convenience')!,
// },
// {
// name: 'Fitness Tracker',
// description: "Monitor your activity and health.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ3435',
// tags: ['fitness tracker', 'health', 'activity'],
// categoryId: getCategoryIdForSeoLink('health-wellness')!,
// },
// {
// name: 'Healthy Snacks',
// description: "Convenient, healthy snacks for long shifts.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ3637',
// tags: ['healthy snacks', 'convenience', 'health'],
// categoryId: getCategoryIdForSeoLink('health-wellness')!,
// },
// {
// name: 'Flashlight',
// description: "Handy for night deliveries.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ3839',
// tags: ['flashlight', 'night', 'deliveries'],
// categoryId: getCategoryIdForSeoLink('misc')!,
// },
// {
// name: 'Multi-tool',
// description: "Useful for various minor fixes and adjustments.",
// amazonLink: 'https://www.amazon.com/dp/B08XYZ4041',
// tags: ['multi-tool', 'utility', 'fixes'],
// categoryId: getCategoryIdForSeoLink('misc')!
// }
];
export function getProductsForCategoryId(categoryId: number) {
return ALL_PRODUCTS.filter((product) => product.categoryId === categoryId);
}
// import { CheerioCrawler, type CheerioCrawlingContext, log } from 'crawlee';
// import { extractProductDetails } from '../../scraper/amazon';
@ -175,4 +179,4 @@ export const ALL_PRODUCTS: Product[] = [
// // // // 'https://www.amazon.com/dp/B07V3LB5DN?social_share=cm_sw_r_cso_cp_apin_dp_1S8QG7ATMWQXHEPZZJMA&starsLeft=1&fbclid=IwZXh0bgNhZW0CMTEAAR0r1pSlSIglwL42EFH5z3urFfzpT1EnEmxsTc589_C-QjkKpQYBl0m10wc_aem_tfAE9o8HXXadzB6BWVN-Sg&th=1&linkCode=ll1&tag=radspazzyspaz-20&linkId=983adc5be8c6bbb0c0f42676c76b4f6e&language=en_US&ref_=as_li_ss_tl',
// // 'https://www.amazon.com/Polysteel-600-Waterproof-Flashlight-Stainless/dp/B00SJRDIN2?crid=29BV6TGKIV7U4&dib=eyJ2IjoiMSJ9.z_qqGdUikpKLO62rjeDuDoQDki7kToAVTM2kBLri4vs25y739Ll_nFVMziV7A5ZnYGQQYNujGdg5igViybnULLsVCa_T6qCk9HUVk7GuD30Jp0FrydoVV9zm-m-E9Zhi7vGbjJdDxUmYXypCL_GaGT6O6K4gf2P94QITVfbbBrjNT74VL9ZdRfs9ucPUSjkoTNLCMXcAXf4fXnJqniXk4PyFks_YYcZ9K8IDN4Fp-puEBc5lhdIp2hY4ugsmMD2v9zYNTvaTD1EaAnXVA_UXIrGwSTdg3Q2cWoqWF6sw6mo.z0JvreFTZ58D14a2IuwCSDybpR9x_CTUBSRrNlP9aZs&dib_tag=se&keywords=coast+flash+light&qid=1720695258&s=sporting-goods&sprefix=coast+flash+light%2Csporting%2C83&sr=1-27&linkCode=ll1&tag=dashersupply-20&linkId=9cfd6086ba43fac649f6884f72c7c844&language=en_US&ref_=as_li_ss_tl',
// 'https://www.amazon.com/First-Aid-Only-Weatherproof-Plastic/dp/B001SG76MU?crid=17746AVZ2R4TK&dib=eyJ2IjoiMSJ9.nehq12VwBTB17Vyx1YODXq7JYQbnOM8xv6AZRadSceLpsk33o-ES3M7UnJMkq0usrVmB1uKgdw9rxtPf7wcS1fHI_DhXIkjp7ujnBf0xvt-SjW3Xw__yU6NvYnSUmSfQzcqj49ZMu893KSypCAIPiLZ0gHo9HbRPicFsuJVBOCv5aOQoBqlLRymArai_8k9lUwtCxAfhfiDjUGk6K3s_S6IFWUP88Ff8mbyU5lkVRtbE4dRTCp-wNjM6HpxqZPSZ0A3_-PPl75PlgjsmUXIkxArreEPatqaHwyJ13X-DCQU.CWOEqmjYxSJ7yRXLCgtz9iGOSGJD53MSoPw6jzAWx7Q&dib_tag=se&keywords=first+aid+kit&qid=1720746463&sprefix=first+aid+kit%2Caps%2C95&sr=8-3-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1&linkCode=ll1&tag=dashersupply-20&linkId=385f21e08641ef9ce7ad55aebe2d30cf&language=en_US&ref_=as_li_ss_tl',
// ]);
// ]);

View File

@ -40,5 +40,4 @@ export interface Product {
* Product Details.
*/
amazonProductDetails?: AmazonProductDetails;
}
}

View File

@ -28,7 +28,6 @@ export function getStaticPaths() {
}
}});
}
console.log(getStaticPaths());
const formatAsCurrency = (amount: number) => amount.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
@ -40,7 +39,7 @@ const brand: Brand = ALL_BRANDS.find(b => b.slug === product.brandStoreSlug)!;
<Layout title=`${product?.name} - Dasher Supply`>
<main>
<h1 class="center"><a href="/"><span class="text-gradient">Dasher Supply</span></a> &gt; <a href={`/category/${category.seoLink}`}>{category.category}</a> &gt; {product.name}</h1>
<h1 class="center"><a href="/"><span class="text-gradient">Dasher Supply</span></a> &gt; <a href={`/category/${category.slug}`}>{category.category}</a> &gt; {product.name}</h1>
<p class="instructions">
{product?.callout || category.description}
</p>

View File

@ -28,7 +28,6 @@ export function getStaticPaths() {
}
}});
}
console.log(getStaticPaths());
const { brandLookup } = Astro.params;
const brand: Brand = ALL_BRANDS.find(b => b.slug === brandLookup)!;

View File

@ -10,14 +10,13 @@ type CategoryStaticPath = { params: { categoryLookup: string }};
export function getStaticPaths() {
return ALL_CATEGORIES.map<CategoryStaticPath>((category) => { return {
params: {
categoryLookup: category.seoLink
categoryLookup: category.slug
}
}});
}
console.log(getStaticPaths());
const { categoryLookup } = Astro.params;
const category = ALL_CATEGORIES.find(c => c.seoLink === categoryLookup)!;
const category = ALL_CATEGORIES.find(c => c.slug === categoryLookup)!;
const categoryProducts = ALL_PRODUCTS.filter(p => p.categoryId === category.id)!;
---

View File

@ -4,6 +4,7 @@ import CategoryCard from '../components/CategoryCard.astro';
import BrandCard from '../components/BrandCard.astro';
import { ALL_CATEGORIES } from '../data/categories';
import { ALL_BRANDS } from '../data/brands';
import { getProductsForCategoryId } from '../data/products';
---
<Layout title="Dasher Supply">
@ -13,7 +14,7 @@ import { ALL_BRANDS } from '../data/brands';
Your one-stop shop for all your after-market Dasher supplies.
</p>
<ul role="list" class="link-card-grid">
{ALL_CATEGORIES.map(category => (
{ALL_CATEGORIES.filter(category => getProductsForCategoryId(category.id)?.length > 0).map(category => (
<CategoryCard
category={category}
/>
@ -101,7 +102,7 @@ import { ALL_BRANDS } from '../data/brands';
}
.link-card-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
grid-template-columns: repeat(auto-fit, minmax(48ch, 1fr));
gap: 2rem;
padding: 0;
}