diff --git a/src/PrerenderProduct.js b/src/PrerenderProduct.js
index ceee0c7..08dda0f 100644
--- a/src/PrerenderProduct.js
+++ b/src/PrerenderProduct.js
@@ -13,6 +13,7 @@ const {
} = require('@mui/material');
const Footer = require('./components/Footer.js').default;
const { Logo } = require('./components/header/index.js');
+const ProductImage = require('./components/ProductImage.js').default;
// Utility function to clean product names by removing trailing number in parentheses
const cleanProductName = (name) => {
@@ -170,50 +171,11 @@ class PrerenderProduct extends React.Component {
},
// Product Image Section
React.createElement(
- Box,
+ ProductImage,
{
- sx: {
- width: { xs: "100%", sm: "555px" },
- maxWidth: "100%",
- minHeight: "400px",
- background: "#f8f8f8",
- display: "flex",
- flexDirection: "column",
- alignItems: "center",
- justifyContent: "center",
- }
- },
- !product.pictureList && React.createElement(
- CardMedia,
- {
- component: 'img',
- height: '400',
- image: '/assets/images/nopicture.jpg',
- alt: product.name,
- sx: { objectFit: 'cover' }
- }
- ),
- product.pictureList && React.createElement(
- Box,
- { sx: { position: 'relative', display: 'inline-block' } },
- React.createElement(
- CardMedia,
- {
- component: 'img',
- height: '400',
- image: mainImage,
- alt: product.name,
- sx: {
- objectFit: 'contain',
- cursor: 'pointer',
- transition: 'transform 0.2s ease-in-out',
- '&:hover': {
- transform: 'scale(1.02)'
- }
- }
- }
- )
- )
+ product: product,
+ isPrerender: true
+ }
),
// Product Details Section
React.createElement(
diff --git a/src/components/ProductDetailPage.js b/src/components/ProductDetailPage.js
index 43d72a9..582f4aa 100644
--- a/src/components/ProductDetailPage.js
+++ b/src/components/ProductDetailPage.js
@@ -4,6 +4,7 @@ import { Link } from "react-router-dom";
import parse from "html-react-parser";
import AddToCartButton from "./AddToCartButton.js";
import Images from "./Images.js";
+import ProductImage from "./ProductImage.js";
import { withI18n } from "../i18n/withTranslation.js";
import ArticleQuestionForm from "./ArticleQuestionForm.js";
import ArticleRatingForm from "./ArticleRatingForm.js";
@@ -669,38 +670,15 @@ class ProductDetailPage extends Component {
boxShadow: "0 2px 8px rgba(0,0,0,0.08)",
}}
>
-
- {!product.pictureList && (
-
- )}
- {product.pictureList && (
-
- )}
-
+
{/* Product Details */}
{
+ // For prerender, use static image path
+ const getImagePath = (pictureList) => {
+ if (!pictureList || !pictureList.trim()) {
+ return '/assets/images/nopicture.jpg';
+ }
+ return `/assets/images/prod${pictureList.split(',')[0].trim()}.jpg`;
+ };
+
+ // Container styling - same for both versions
+ const containerSx = {
+ width: { xs: "100%", sm: "555px" },
+ maxWidth: "100%",
+ minHeight: "400px",
+ background: "#f8f8f8",
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ justifyContent: "center",
+ };
+
+ if (isPrerender) {
+ // Prerender version - use CardMedia with static paths
+ return (
+
+ {!product.pictureList && (
+
+ )}
+ {product.pictureList && (
+
+
+
+ )}
+
+ );
+ }
+
+ // SPA version - use existing Images component
+ return (
+
+ {!product.pictureList && (
+
+ )}
+ {product.pictureList && (
+
+ )}
+
+ );
+};
+
+export default ProductImage;
\ No newline at end of file