diff --git a/src/components/DatasetDetailPage/MetaDataPanel.tsx b/src/components/DatasetDetailPage/MetaDataPanel.tsx index 388dca2..e7c6435 100644 --- a/src/components/DatasetDetailPage/MetaDataPanel.tsx +++ b/src/components/DatasetDetailPage/MetaDataPanel.tsx @@ -1,3 +1,4 @@ +import ParticipantsPreview from "./ParticipantsPreview"; import ArrowCircleRightIcon from "@mui/icons-material/ArrowCircleRight"; import { Box, @@ -190,13 +191,23 @@ const MetaDataPanel: React.FC = ({ })()} - - - Subjects - - - {dbViewInfo?.rows?.[0]?.value?.subj?.length ?? "N/A"} - + + + + Subjects + + + {dbViewInfo?.rows?.[0]?.value?.subj?.length ?? "N/A"} + + + diff --git a/src/components/DatasetDetailPage/ParticipantsPreview.tsx b/src/components/DatasetDetailPage/ParticipantsPreview.tsx new file mode 100644 index 0000000..877d664 --- /dev/null +++ b/src/components/DatasetDetailPage/ParticipantsPreview.tsx @@ -0,0 +1,97 @@ +import { makeParticipantsTable } from "../../utils/DatasetDetailPageFunctions/participants"; +import { + Box, + Button, + Dialog, + DialogContent, + DialogTitle, + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableRow, + Paper, +} from "@mui/material"; +import { Colors } from "design/theme"; +import React, { useMemo, useState } from "react"; + +type Props = { + datasetDocument: any; +}; + +const ParticipantsPreview: React.FC = ({ datasetDocument }) => { + const [open, setOpen] = useState(false); + + const table = useMemo(() => { + const part = datasetDocument?.["participants.tsv"]; + return makeParticipantsTable(part); + }, [datasetDocument]); + + if (!table) return null; // No participants.tsv found + + return ( + <> + + + + + setOpen(false)} + maxWidth="md" + fullWidth + > + participants.tsv + + + + + + {table.columns.map((col) => ( + + {col.replace(/_/g, " ")} + + ))} + + + + {table.rows.map((row, rowIdx) => ( + + {table.columns.map((col) => ( + {row[col]} + ))} + + ))} + +
+
+
+
+ + ); +}; + +export default ParticipantsPreview; diff --git a/src/components/SearchPage/DatabaseCard.tsx b/src/components/SearchPage/DatabaseCard.tsx index 025be91..263c84d 100644 --- a/src/components/SearchPage/DatabaseCard.tsx +++ b/src/components/SearchPage/DatabaseCard.tsx @@ -39,7 +39,7 @@ const DatabaseCard: React.FC = ({ }) => { const dispatch = useAppDispatch(); const dbInfo = useAppSelector((state: RootState) => state.neurojson.dbInfo); - console.log("dbInfo", dbInfo); + // console.log("dbInfo", dbInfo); useEffect(() => { if (dbId) { dispatch(fetchDbInfo(dbId.toLowerCase())); diff --git a/src/pages/UpdatedDatasetDetailPage.tsx b/src/pages/UpdatedDatasetDetailPage.tsx index e5516b9..a56e0d0 100644 --- a/src/pages/UpdatedDatasetDetailPage.tsx +++ b/src/pages/UpdatedDatasetDetailPage.tsx @@ -6,6 +6,7 @@ import DescriptionIcon from "@mui/icons-material/Description"; import ExpandLess from "@mui/icons-material/ExpandLess"; import ExpandMore from "@mui/icons-material/ExpandMore"; import HomeIcon from "@mui/icons-material/Home"; +import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined"; import { Box, Typography, @@ -682,7 +683,7 @@ const UpdatedDatasetDetailPage: React.FC = () => { return ( <> - + */} + + {/* Breadcrumb Navigation (Home → Database → Dataset) */} + + {/* Home Icon Button */} + + + + » + + + {/* Database Name (Clickable) */} + + + + » + + + {/* Dataset Name (_id field) */} + + {docId} + + {
)} - {/* Breadcrumb Navigation (Home → Database → Dataset) */} - - {/* Home Icon Button */} - - - - » - - - {/* Database Name (Clickable) */} - - - - » - - - {/* Dataset Name (_id field) */} - - {docId} - - + > + + AI Summary + + + AI Summary is generated using an AI tool that identifies + the related paper and extracts its key content to create a + concise summary. + + } + arrow + placement="right" + slotProps={{ + tooltip: { + sx: { + bgcolor: Colors.white, + border: `1px solid ${Colors.lightGray}`, + boxShadow: 3, + fontSize: "0.875rem", + }, + }, + arrow: { + sx: { + color: Colors.white, + "&::before": { + border: `1px solid ${Colors.lightGray}`, // subtle arrow border + }, + }, + }, + }} + > + + +
- {/* ai summary */} - {aiSummary && } + + + )} { 0 && cols.every((k) => Array.isArray(part[k])); + const arrayCols = Object.keys(part).filter((k) => Array.isArray(part[k])); + + if (arrayCols.length > 0) { + const n = Math.max(...arrayCols.map((k) => part[k].length)); + const rows = Array.from({ length: n }, (_, i) => { + const r: any = { id: i + 1 }; + arrayCols.forEach((k) => (r[k] = part[k][i] ?? "")); + return r; + }); + return { columns: arrayCols, rows }; + } + + // Case B: array-of-objects fallback + if (Array.isArray(part)) { + const allCols = new Set(); + part.forEach((r: any) => + Object.keys(r || {}).forEach((k) => allCols.add(k)) + ); + const columns = Array.from(allCols); + const rows = part.map((r: any, i: number) => ({ id: i + 1, ...(r || {}) })); + return { columns, rows }; + } + + return null; +}