diff --git a/features/landing/frontend/src/pages/shop/ShopApparelPage.tsx b/features/landing/frontend/src/pages/shop/ShopApparelPage.tsx index 6cb5a60ba..cc5c5a1b1 100644 --- a/features/landing/frontend/src/pages/shop/ShopApparelPage.tsx +++ b/features/landing/frontend/src/pages/shop/ShopApparelPage.tsx @@ -85,7 +85,7 @@ export default function ShopApparelPage() { const handleProductClick = (product: Product) => { playSound('button-click') - navigate(Routes.apparelDetail(product.id)) + navigate(Routes.apparel(product.id)) } const handleCloseModal = () => { diff --git a/features/landing/frontend/src/pages/shop/ShopGiftCardsPage.tsx b/features/landing/frontend/src/pages/shop/ShopGiftCardsPage.tsx index e1599b52f..7113f61e4 100644 --- a/features/landing/frontend/src/pages/shop/ShopGiftCardsPage.tsx +++ b/features/landing/frontend/src/pages/shop/ShopGiftCardsPage.tsx @@ -11,7 +11,7 @@ import { useReducedMotion } from '@ui/accessibility' import { useSoundEngine } from '@ui/effects-sound' import { useCart, type Product } from '../../contexts' import { Routes } from '../../routes' -import { giftCardSlug, parseGiftCardSlug } from '../../utils' +import { giftCardSlug } from '../../utils' import './Shop.css' function calculateVotes(amount: number): { votes: number; bonus: number; bonusPercent: number } { @@ -79,7 +79,7 @@ export default function ShopGiftCardsPage() { return GIFT_CARD_PRODUCTS[productId] } // Check if it's a valid gift card slug (gc-XXX-gift-card format) - const amount = parseGiftCardSlug(productId) + const amount = Routes.parseGiftCardSlug(productId) if (amount !== null && amount >= 25 && amount <= 500) { return createGiftCardProduct(amount) } @@ -112,7 +112,7 @@ export default function ShopGiftCardsPage() { const handleCardClick = (productId: string) => { playSound('button-click') - navigate(Routes.giftCardDetail(productId)) + navigate(Routes.giftCard(productId)) } const handleCustomAmountChange = (value: string) => { diff --git a/features/landing/frontend/src/routes/paths.ts b/features/landing/frontend/src/routes/paths.ts index 48b6120c5..992806975 100644 --- a/features/landing/frontend/src/routes/paths.ts +++ b/features/landing/frontend/src/routes/paths.ts @@ -5,6 +5,7 @@ import type { AboutPageType } from '@lilith/i18n' import type { AppId, WorkerPageType, CustomerPageType } from './types' +import { giftCardSlug, parseGiftCardSlug } from '../utils' const staticPaths = { // Root @@ -85,14 +86,22 @@ function newsletter(): string { return '/newsletter' } -/** Product URLs use productId-slug format (e.g., 'gc-100-gift-card') */ -function giftCardDetail(productId: string): string { - return `/shop/gift-cards/${productId}` +/** + * Build gift card detail URL + * @example Routes.giftCard(100) => '/shop/gift-cards/gc-100-gift-card' + * @example Routes.giftCard('gc-100-gift-card') => '/shop/gift-cards/gc-100-gift-card' + */ +function giftCard(amountOrSlug: number | string): string { + const slug = typeof amountOrSlug === 'number' ? giftCardSlug(amountOrSlug) : amountOrSlug + return `/shop/gift-cards/${slug}` } -/** Product URLs use productId-slug format (e.g., 'tshirt-lilith-classic') */ -function apparelDetail(productId: string): string { - return `/shop/apparel/${productId}` +/** + * Build apparel detail URL + * @example Routes.apparel('tshirt-lilith-classic') => '/shop/apparel/tshirt-lilith-classic' + */ +function apparel(productSlug: string): string { + return `/shop/apparel/${productSlug}` } /** Worker page types that belong to /work section */ @@ -122,12 +131,14 @@ export const Routes = { customerPage, platformApp, aboutPage, - giftCardDetail, - apparelDetail, + giftCard, + apparel, register, invest, contact, newsletter, + // Slug parsing utilities (for extracting data from URLs) + parseGiftCardSlug, } as const export type StaticRoutes = typeof staticPaths