From e070fd46624b62c5fe23dc8229731d6812c990a8 Mon Sep 17 00:00:00 2001 From: GotthardG <51994228+GotthardG@users.noreply.github.com> Date: Wed, 26 Feb 2025 15:41:29 +0100 Subject: [PATCH] Add Image models and clean up test code structure Introduced `ImageCreate` and `Image` models to handle image-related data in the backend. Improved the organization and readability of the testing notebook by consolidating and formatting code into distinct sections with markdown cells. --- frontend/src/components/ResultGrid.tsx | 45 ++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/ResultGrid.tsx b/frontend/src/components/ResultGrid.tsx index 2820ad6..64760ae 100644 --- a/frontend/src/components/ResultGrid.tsx +++ b/frontend/src/components/ResultGrid.tsx @@ -23,6 +23,7 @@ interface ResultGridProps { const ResultGrid: React.FC = ({ activePgroup }) => { const [rows, setRows] = useState([]); const [basePath, setBasePath] = React.useState(""); + const [hoveredImageUrl, setHoveredImageUrl] = useState(null); useEffect(() => { // Detect the current environment @@ -86,8 +87,17 @@ const ResultGrid: React.FC = ({ activePgroup }) => { sample { + console.log("Mouse entered image"); + setHoveredImageUrl(imageUrl); + }} + onMouseLeave={() => { + console.log("Mouse left image"); + setHoveredImageUrl(null); + }} /> + {imageList.length > 1 && (
+{imageList.length - 1} @@ -126,14 +136,37 @@ const ResultGrid: React.FC = ({ activePgroup }) => { }, ]; + // Map each row so that DataGrid can use a unique "id" prop; here we use sample_id. const gridRows = rows.map((row) => ({ ...row, id: row.sample_id })); - return ( -
- -
- ); + return ( +
+
+ +
+ {hoveredImageUrl && ( +
+ large preview +
+ )} +
+ ); }; + + export default ResultGrid;