1- import { Button } from '@/components/ui/button' ;
21import { useEffect , useRef , useState } from 'react' ;
32import { pythonCode } from '@/assets/bias-detection-python-code' ;
43import { usePython } from '@/components/pyodide/use-python' ;
54import BiasSettings from '@/components/BiasSettings' ;
6- import { ChevronDown , Share } from 'lucide-react' ;
75import { csvReader } from '@/components/CSVReader' ;
86import { cn } from '@/lib/utils' ;
97import ComponentMapper from '@/components/componentMapper' ;
10- import { downloadFile } from '@/lib/download-file' ;
118import { useReactToPrint } from 'react-to-print' ;
129import Measuring from '@/components/icons/measuring.svg?react' ;
1310import { ClusterInfo } from '@/components/bias-detection-interfaces/cluster-export' ;
1411import { BiasDetectionParameters } from '@/components/bias-detection-interfaces/BiasDetectionParameters' ;
1512import { CSVData } from '@/components/bias-detection-interfaces/csv-data' ;
1613import { useTranslation } from 'react-i18next' ;
1714import LanguageSwitcher from '@/components/ui/languageSwitcher' ;
18- import {
19- DropdownMenu ,
20- DropdownMenuContent ,
21- DropdownMenuItem ,
22- DropdownMenuTrigger ,
23- } from '@/components/ui/dropdown-menu' ;
2415import { LoadingState } from '@/components/LoadingState' ;
16+ import { ExportButton } from '@/components/bias-detection/export-button' ;
2517
2618const PAGE_STYLE = `
2719 @page {
@@ -166,47 +158,12 @@ export default function BiasDetection() {
166158 >
167159 { initialised && data . data . length > 0 && result . length > 0 && (
168160 < div className = "ml-auto flex flex-row gap-2 hideonprint" >
169- < DropdownMenu >
170- < DropdownMenuTrigger asChild >
171- < Button
172- variant = "outline"
173- size = "sm"
174- className = "p-4 text-sm"
175- >
176- { t ( 'downloadButton' ) }
177- < ChevronDown className = "relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180" />
178- </ Button >
179- </ DropdownMenuTrigger >
180- < DropdownMenuContent align = "end" >
181- < DropdownMenuItem
182- onClick = { ( ) => reactToPrintFn ( ) }
183- >
184- < Share className = "size-3.5 mr-2" />
185- { t ( 'biasSettings.exportToPDF' ) }
186- </ DropdownMenuItem >
187- { clusterInfo && (
188- < DropdownMenuItem
189- onClick = { ( ) => {
190- downloadFile (
191- JSON . stringify (
192- {
193- fileName : data . fileName ,
194- ...clusterInfo ,
195- } ,
196- null ,
197- 2
198- ) ,
199- `${ data . fileName . replace ( '.csv' , '' ) || 'cluster-info' } -${ clusterInfo . date . toISOString ( ) } .json` ,
200- 'application/json'
201- ) ;
202- } }
203- >
204- < Share className = "size-3.5 mr-2" />
205- { t ( 'biasSettings.exportToJSON' ) }
206- </ DropdownMenuItem >
207- ) }
208- </ DropdownMenuContent >
209- </ DropdownMenu >
161+ < ExportButton
162+ buttonAlign = { 'right' }
163+ clusterInfo = { clusterInfo }
164+ reactToPrintFn = { reactToPrintFn }
165+ data = { data }
166+ />
210167 </ div >
211168 ) }
212169
@@ -228,6 +185,17 @@ export default function BiasDetection() {
228185 < div className = "flex-1" />
229186 </ >
230187 ) }
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+ ) }
231199 </ div >
232200 </ main >
233201 ) ;
0 commit comments