diff --git a/frontend/src/components/ResultGrid.tsx b/frontend/src/components/ResultGrid.tsx index a3aa790..09ad8da 100644 --- a/frontend/src/components/ResultGrid.tsx +++ b/frontend/src/components/ResultGrid.tsx @@ -299,6 +299,7 @@ const ResultGrid: React.FC = ({ activePgroup }) => { return ( handleDetailPanelHeightChange(params.row.id, height)} // Pass callback for dynamic height /> ); diff --git a/frontend/src/components/RunDetails.tsx b/frontend/src/components/RunDetails.tsx index 02cbf63..b0914a3 100644 --- a/frontend/src/components/RunDetails.tsx +++ b/frontend/src/components/RunDetails.tsx @@ -5,18 +5,23 @@ import { AccordionDetails, Typography, Grid, + Modal, + Box } from '@mui/material'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import './SampleImage.css'; interface RunDetailsProps { run: ExperimentParameters; + basePath: string; onHeightChange?: (height: number) => void; // Callback to notify the parent about height changes } -const RunDetails: React.FC = ({ run, onHeightChange }) => { +const RunDetails: React.FC = ({ run, onHeightChange, basePath }) => { const containerRef = useRef(null); // Ref to track component height const [currentHeight, setCurrentHeight] = useState(0); + const [modalOpen, setModalOpen] = useState(false); // For modal state + const [selectedImage, setSelectedImage] = useState(null); // Tracks the selected image for the modal const { beamline_parameters, images } = run; const { synchrotron, beamline, detector } = beamline_parameters; @@ -49,8 +54,20 @@ const RunDetails: React.FC = ({ run, onHeightChange }) => { }; }, [containerRef]); + const handleImageClick = (imagePath: string) => { + setSelectedImage(imagePath); + setModalOpen(true); // Open the modal when the image is clicked + }; + + const closeModal = () => { + setSelectedImage(null); // Clear the current image + setModalOpen(false); + }; + + return (
= ({ run, onHeightChange }) => { alignItems: 'flex-start', }} > - {/* Main Details Section */} + + {/* Main Details Section */}
Run {run.run_number} Details @@ -144,17 +162,23 @@ const RunDetails: React.FC = ({ run, onHeightChange }) => { Associated Images {images && images.length > 0 ? ( - + {images.map((img) => ( - -
+ +
handleImageClick(`${basePath || ''}${img.filepath}`)} // Open modal with image + style={{ + cursor: 'pointer', + }} + > {img.comment @@ -168,6 +192,35 @@ const RunDetails: React.FC = ({ run, onHeightChange }) => { )}
+ + {/* Modal for Zoomed Image */} + + + {selectedImage && ( + Zoomed + )} + +
); }; diff --git a/frontend/src/components/SampleImage.css b/frontend/src/components/SampleImage.css index ba545b9..e42d575 100644 --- a/frontend/src/components/SampleImage.css +++ b/frontend/src/components/SampleImage.css @@ -13,4 +13,11 @@ .image-container { overflow: visible; /* Ensures zoomed images are not cropped by the parent */ -} \ No newline at end of file +} + +/* Disable zoom effect specifically in the details panel */ +.details-panel .zoom-image:hover { + transform: none; /* Disable scaling */ + z-index: 1; /* Reset any z-index adjustment */ + border: none; /* Reset border effect */ +}