diff --git a/src/components/Images.js b/src/components/Images.js index cad40d3..1727641 100644 --- a/src/components/Images.js +++ b/src/components/Images.js @@ -52,13 +52,8 @@ class Images extends Component { pics.push(bildId); this.loadPic(this.props.fullscreenOpen ? 'large' : 'medium',bildId,newMainPic); }else{ - // For prerender or when sockets unavailable, use static path - if (!this.props.socket && !this.props.socketB) { - pics.push(`/assets/images/prod${bildId}.jpg`); - } else { - pics.push(bildId); - this.loadPic(this.props.fullscreenOpen ? 'large' : 'medium',bildId,newMainPic); - } + pics.push(bildId); + this.loadPic(this.props.fullscreenOpen ? 'large' : 'medium',bildId,newMainPic); } }else{ if(window.tinyPicCache[bildId]){ @@ -67,13 +62,8 @@ class Images extends Component { pics.push(window.mediumPicCache[bildId]); this.loadPic('tiny',bildId,newMainPic); }else{ - // For prerender or when sockets unavailable, use static path - if (!this.props.socket && !this.props.socketB) { - pics.push(`/assets/images/prod${bildId}.jpg`); - } else { - pics.push(null); - this.loadPic('tiny',bildId,pics.length-1); - } + pics.push(null); + this.loadPic('tiny',bildId,pics.length-1); } } } @@ -85,9 +75,6 @@ class Images extends Component { } loadPic = (size,bildId,index) => { - // Skip loading if sockets are not available (e.g., during prerender) - if (!this.props.socketB) return; - this.props.socketB.emit('getPic', { bildId, size }, (res) => { if(res.success){ const url = URL.createObjectURL(new Blob([res.imageBuffer], { type: 'image/jpeg' })); @@ -112,6 +99,35 @@ class Images extends Component { } render() { + // Prerender detection - if no sockets, render simple CardMedia with static path + if (!this.props.socketB) { + const getImagePath = (pictureList) => { + if (!pictureList || !pictureList.trim()) { + return '/assets/images/nopicture.jpg'; + } + return `/assets/images/prod${pictureList.split(',')[0].trim()}.jpg`; + }; + + return ( + + + + ); + } + + // SPA version - full functionality return ( <> {this.state.pics[this.state.mainPic] && (