1- import { OpenInNew } from '@mui/icons-material' ;
1+ import { Download , OpenInNew } from '@mui/icons-material' ;
22import { Box , Button , Link , List , ListItemButton , ListItemText , Typography } from '@mui/material' ;
33import NiiVueVisualizer from 'components/Visualizer/NiiVueVisualizer' ;
44import { MetaAnalysisReturn , NeurovaultFile , ResultReturn } from 'neurosynth-compose-typescript-sdk' ;
55import MetaAnalysisResultStatusAlert from './MetaAnalysisResultStatusAlert' ;
66import useGetMetaAnalysisResultById from 'hooks/metaAnalyses/useGetMetaAnalysisResultById' ;
7- import { useState } from 'react' ;
7+ import { useEffect , useState } from 'react' ;
88import StateHandlerComponent from 'components/StateHandlerComponent/StateHandlerComponent' ;
99import useGetNeurovaultImages , { INeurovault } from 'hooks/metaAnalyses/useGetNeurovault' ;
10+ import DisplayParsedNiMareFile from './DisplayParsedNiMareFile' ;
11+ import ImageIcon from '@mui/icons-material/Image' ;
1012
1113const DisplayMetaAnalysisResults : React . FC < {
1214 metaAnalysis : MetaAnalysisReturn | undefined ;
@@ -28,17 +30,21 @@ const DisplayMetaAnalysisResults: React.FC<{
2830 isLoading : neurovaultFilesIsLoading ,
2931 isError : neurovaultFilesIsError ,
3032 } = useGetNeurovaultImages ( neurovaultFileURLs ) ;
31- console . log ( { neurovaultFiles } ) ;
3233 const [ selectedNeurovaultImage , setSelectedNeurovaultImage ] = useState < INeurovault > ( ) ;
3334
35+ useEffect ( ( ) => {
36+ if ( ! neurovaultFiles ) return ;
37+ setSelectedNeurovaultImage ( neurovaultFiles [ 0 ] ) ;
38+ } , [ neurovaultFiles ] ) ;
39+
3440 return (
3541 < StateHandlerComponent
3642 isLoading = { isLoading || neurovaultFilesIsLoading }
3743 isError = { isError || neurovaultFilesIsError }
3844 >
3945 < MetaAnalysisResultStatusAlert metaAnalysis = { props . metaAnalysis } metaAnalysisResult = { data } />
40- < Box display = "flex" sx = { { height : '100%' } } >
41- < Box sx = { { width : '27%' , height : '100%' , maxHeight : '448px ' , overflowY : 'auto' } } >
46+ < Box display = "flex" sx = { { height : '100%' , minHeight : '600px' } } >
47+ < Box sx = { { width : '27%' , maxHeight : '600px ' , overflowY : 'auto' } } >
4248 < List sx = { { padding : 0 } } >
4349 { ( neurovaultFiles || [ ] ) . map ( ( neurovaultFile ) => (
4450 < ListItemButton
@@ -54,32 +60,62 @@ const DisplayMetaAnalysisResults: React.FC<{
5460 < Box
5561 sx = { {
5662 width : '73%' ,
57- backgroundColor : '#f0f0f0 ' ,
63+ // backgroundColor: '#0000000a ',
5864 padding : '1.5rem' ,
65+ paddingTop : 0 ,
5966 borderTopRightRadius : '0px' ,
6067 borderBottomRightRadius : '8' ,
61- maxHeight : '448px' ,
6268 } }
6369 >
70+ < Box sx = { { marginBottom : '1rem' } } >
71+ < DisplayParsedNiMareFile nimareFileName = { selectedNeurovaultImage ?. name } />
72+ </ Box >
6473 { selectedNeurovaultImage ?. file ? (
65- < NiiVueVisualizer imageURL = { selectedNeurovaultImage . file } />
74+ < >
75+ < NiiVueVisualizer imageURL = { selectedNeurovaultImage . file } />
76+ < Box display = "flex" alignItems = "center" justifyContent = "space-between" >
77+ < Button
78+ component = { Link }
79+ sx = { { marginTop : '0.5rem' } }
80+ href = {
81+ neurovaultLink . includes ( '/api' )
82+ ? neurovaultLink . replace ( / \/ a p i / , '' )
83+ : neurovaultLink
84+ }
85+ variant = "contained"
86+ rel = "noreferrer"
87+ size = "small"
88+ target = "_blank"
89+ disableElevation
90+ >
91+ Open in neurovault
92+ < OpenInNew sx = { { marginLeft : '4px' } } fontSize = "small" />
93+ </ Button >
94+ < Box >
95+ < Button
96+ size = "small"
97+ variant = "contained"
98+ endIcon = { < Download /> }
99+ sx = { { marginTop : '0.5rem' , marginRight : '0.5rem' } }
100+ >
101+ Download nifti
102+ </ Button >
103+ < Button
104+ size = "small"
105+ variant = "contained"
106+ endIcon = { < ImageIcon /> }
107+ sx = { { marginTop : '0.5rem' } }
108+ >
109+ Download image
110+ </ Button >
111+ </ Box >
112+ </ Box >
113+ </ >
66114 ) : (
67115 < Typography color = "warning.dark" > No image selected</ Typography >
68116 ) }
69117 </ Box >
70118 </ Box >
71- < Button
72- component = { Link }
73- sx = { { marginTop : '1rem' , marginBottom : '2rem' } }
74- href = { neurovaultLink . includes ( '/api' ) ? neurovaultLink . replace ( / \/ a p i / , '' ) : neurovaultLink }
75- variant = "contained"
76- rel = "noreferrer"
77- target = "_blank"
78- disableElevation
79- >
80- Open in neurovault
81- < OpenInNew sx = { { marginLeft : 'px' } } />
82- </ Button >
83119 </ StateHandlerComponent >
84120 ) ;
85121} ;
0 commit comments