diff --git a/apps/nar-v3/src/components/DataFileCard.jsx b/apps/nar-v3/src/components/DataFileCard.jsx index c70d237..8f8db12 100644 --- a/apps/nar-v3/src/components/DataFileCard.jsx +++ b/apps/nar-v3/src/components/DataFileCard.jsx @@ -25,7 +25,7 @@ import KeyValueTable from "./KeyValueTable"; import styles from "../styles"; function DataFileCard(props) { - const fileObj = props.fileObj; + const fileObj = props.fileObjects[props.index]; if (fileObj) { const data = { @@ -46,11 +46,27 @@ function DataFileCard(props) { return ( <> - -

File {fileObj.name}

+ + + {props.index > 0 ? ( + props.setIndex(props.index - 1)} /> + ) : ( + "" + )} + + +

File {fileObj.name}

- -
+ +
+ + {props.index < props.fileObjects.length - 1 ? ( + props.setIndex(props.index + 1)} /> + ) : ( + "" + )} + + ); } else { diff --git a/apps/nar-v3/src/components/DatasetCard.jsx b/apps/nar-v3/src/components/DatasetCard.jsx index 85f5289..ecd8f3a 100644 --- a/apps/nar-v3/src/components/DatasetCard.jsx +++ b/apps/nar-v3/src/components/DatasetCard.jsx @@ -37,6 +37,7 @@ function DatasetCard(props) { const [subjectIndex, _setSubjectIndex] = useState(0); const [sliceIndex, _setSliceIndex] = useState(0); + const [fileIndex, _setFileIndex] = useState(0); const setSubjectIndex = (index) => { if (index >= 0 && index < subjects.length) { @@ -114,12 +115,22 @@ function DatasetCard(props) { const getDataFiles = (subjectIndex, sliceIndex) => { const recordingActivity = getRecordingActivity(subjectIndex, sliceIndex); if (recordingActivity) { - return recordingActivity.output[0]; + return recordingActivity.output; } else { return null; } }; + const setFileIndex = (index) => { + const dataFiles = getDataFiles(subjectIndex, sliceIndex); + if ( + index >= 0 && + index < dataFiles.length + ) { + _setFileIndex(index); + } + }; + const formatAuthors = (dataset) => { const authors = dataset.author.length > 0 ? dataset.author : dataset.isVersionOf.author; return authors.map((person) => `${person.givenName} ${person.familyName}`).join(", "); @@ -186,7 +197,7 @@ function DatasetCard(props) { stimulation={getStimulationActivity(subjectIndex, sliceIndex)} /> - + ) : ( ""