File tree Expand file tree Collapse file tree 4 files changed +32
-26
lines changed
Expand file tree Collapse file tree 4 files changed +32
-26
lines changed Original file line number Diff line number Diff line change @@ -647,6 +647,10 @@ def run():
647647 'key': 'biasAnalysis.conclusionDescriptionHigherAverage' if p_val < 0.05 else 'biasAnalysis.conclusionNoSignificance'
648648 }))
649649
650+ setResult(json.dumps({
651+ 'type': 'export-button',
652+ }))
653+
650654
651655 setResult(json.dumps({
652656 'type': 'heading',
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import TextValueSelect from './composed-components/TextValueSelect';
1414import { createArrayFromPythonDictionary } from './createArrayFromPythonDictionary' ;
1515import ClusterCategoriesDistributionAccordeonContent from './composed-components/ClusterCategoriesDistributionAccordeonContent' ;
1616import ClusterNumericalVariableDistributionAccordeonContent from './composed-components/ClusterNumericalVariableDistributionAccordeonContent' ;
17+ import { ReactNode } from 'react' ;
1718
1819interface Comparison {
1920 key : string ;
@@ -23,9 +24,11 @@ interface Comparison {
2324export default function ComponentMapper ( {
2425 items,
2526 data,
27+ exportButton,
2628} : {
2729 items : string [ ] ;
2830 data : CSVData ;
31+ exportButton ?: ReactNode ;
2932} ) {
3033 const { t } = useTranslation ( ) ;
3134 const components = items
@@ -34,6 +37,14 @@ export default function ComponentMapper({
3437 const resultItem = JSON . parse ( r ) ;
3538
3639 switch ( resultItem . type ) {
40+ case 'export-button' : {
41+ if ( exportButton ) {
42+ return (
43+ < Fragment key = { index } > { exportButton } </ Fragment >
44+ ) ;
45+ }
46+ return null ;
47+ }
3748 case 'data-set-preview' :
3849 return (
3950 < Fragment key = { index } >
Original file line number Diff line number Diff line change 1- import { useEffect , useState } from 'react' ;
1+ import { Fragment , useEffect , useState } from 'react' ;
22import { useTranslation } from 'react-i18next' ;
33import ErrorBoundary from '../ErrorBoundary' ;
44import FilterSelect from '../ui/FilterSelect' ;
@@ -71,7 +71,7 @@ const ClusterCategoriesDistributionAccordeonContent = ({
7171 }
7272 ) ;
7373 return (
74- < >
74+ < Fragment key = { index } >
7575 { categorieFilter === chart . selectFilterGroup ||
7676 ( ! categorieFilter &&
7777 chart . selectFilterGroup === defaultCategory ) ||
@@ -98,7 +98,7 @@ const ClusterCategoriesDistributionAccordeonContent = ({
9898 />
9999 </ >
100100 ) : null }
101- </ >
101+ </ Fragment >
102102 ) ;
103103 } ) }
104104 </ ErrorBoundary >
Original file line number Diff line number Diff line change @@ -156,19 +156,21 @@ export default function BiasDetection() {
156156 loading && 'overflow-hidden'
157157 ) }
158158 >
159- { initialised && data . data . length > 0 && result . length > 0 && (
160- < div className = "ml-auto flex flex-row gap-2 hideonprint" >
161- < ExportButton
162- buttonAlign = { 'right' }
163- clusterInfo = { clusterInfo }
164- reactToPrintFn = { reactToPrintFn }
165- data = { data }
166- />
167- </ div >
168- ) }
169-
170159 { result . length > 0 ? (
171- < ComponentMapper items = { result } data = { data } />
160+ < ComponentMapper
161+ items = { result }
162+ data = { data }
163+ exportButton = {
164+ < div className = "flex flex-row gap-2 hideonprint justify-start" >
165+ < ExportButton
166+ buttonAlign = { 'left' }
167+ clusterInfo = { clusterInfo }
168+ reactToPrintFn = { reactToPrintFn }
169+ data = { data }
170+ />
171+ </ div >
172+ }
173+ />
172174 ) : loading ? (
173175 < LoadingState
174176 loadingMessageKey = { loadingMessage }
@@ -185,17 +187,6 @@ export default function BiasDetection() {
185187 < div className = "flex-1" />
186188 </ >
187189 ) }
188-
189- { initialised && data . data . length > 0 && result . length > 0 && (
190- < div className = "flex flex-row gap-2 hideonprint" >
191- < ExportButton
192- buttonAlign = { 'center' }
193- clusterInfo = { clusterInfo }
194- reactToPrintFn = { reactToPrintFn }
195- data = { data }
196- />
197- </ div >
198- ) }
199190 </ div >
200191 </ main >
201192 ) ;
You can’t perform that action at this time.
0 commit comments