refactor: update image rendering logic in MainPageLayout to load images conditionally based on opacity for improved performance

This commit is contained in:
sebseb7
2025-07-23 09:38:41 +02:00
parent 72010c410e
commit 23dbdec432

View File

@@ -612,11 +612,11 @@ const MainPageLayout = () => {
justifyContent: "center", justifyContent: "center",
}} }}
> >
{/* Image loaded only when needed */}
{getOpacity(pageType) === 1 && (
<img <img
src={box.image} src={box.image}
alt={box.title} alt={box.title}
fetchPriority="high"
loading="eager"
style={{ style={{
maxWidth: "100%", maxWidth: "100%",
maxHeight: "100%", maxHeight: "100%",
@@ -627,6 +627,7 @@ const MainPageLayout = () => {
transform: "translate(-50%, -50%)", transform: "translate(-50%, -50%)",
}} }}
/> />
)}
<Box <Box
sx={{ sx={{
position: "absolute", position: "absolute",