diff --git a/frontend/src/pages/ProductDetailPage.tsx b/frontend/src/pages/ProductDetailPage.tsx index 739f206..6361bc0 100644 --- a/frontend/src/pages/ProductDetailPage.tsx +++ b/frontend/src/pages/ProductDetailPage.tsx @@ -57,7 +57,7 @@ export default function ProductDetailPage() { const [isValidated, setIsValidated] = useState(false) const [hasCatalogError, setHasCatalogError] = useState(false) - const [meta, setMeta] = useState<{ badge: string; archs: string[]; active: boolean }>({ badge: '', archs: [], active: true }) + const [meta, setMeta] = useState<{ badge: string; archs: string[]; active: boolean }>({ badge: '', archs: [], active: false }) const [related, setRelated] = useState<{ id: string; label: string }[]>([]) // Load product name + build string @@ -67,9 +67,15 @@ export default function ProductDetailPage() { setIsValidated(false) setHasCatalogError(false) setProductName('') - setMeta({ badge: '', archs: [], active: true }) + setMeta({ badge: '', archs: [], active: false }) setRelated([]) + if (productId && !/^\d+$/.test(productId)) { + setIsNotFound(true) + setProductName('Invalid Product ID') + return + } + fetch('/data/products.json') .then(r => { if (!r.ok) throw new Error('Failed to fetch catalog') @@ -89,14 +95,17 @@ export default function ProductDetailPage() { const name = product.name setProductName(name) - setMeta({ badge: product.badge || '', archs: product.archs || [], active: product.active !== false }) + const isActive = product.active !== false + setMeta({ badge: product.badge || '', archs: product.archs || [], active: isActive }) setRelated((product.related || []).map(rId => ({ id: rId, label: data[rId]?.name || `Product ${rId}` }))) - setIsValidated(true) + if (isActive) { + setIsValidated(true) + } // Dynamic SEO injection document.title = `${name} ISO Download | Windows ISO Downloader` @@ -217,7 +226,23 @@ export default function ProductDetailPage() { {/* Main card */}
- {hasCatalogError ? ( + {!productName && !isNotFound && !hasCatalogError ? ( +
+
+ + Loading catalog... +
+
+
+
+
+
+
+ ) : hasCatalogError ? (

Network Error

diff --git a/frontend/src/pages/ProductsPage.tsx b/frontend/src/pages/ProductsPage.tsx index 76f16e8..827ccdb 100644 --- a/frontend/src/pages/ProductsPage.tsx +++ b/frontend/src/pages/ProductsPage.tsx @@ -24,7 +24,7 @@ export default function ProductsPage() { .then(r => r.json()) .then((data: Record) => { const activeProducts = Object.entries(data) - .filter(([_, product]) => product.active !== false) + .filter(([, product]) => product.active !== false) .map(([id, product]) => ({ id, name: product.name })) setProducts(activeProducts) })