Skip to content

Commit

Permalink
Remove text from combined export; change simple export button to more…
Browse files Browse the repository at this point in the history
… visible with text
  • Loading branch information
ShootingStar91 committed Aug 17, 2024
1 parent 104a846 commit 64e7db4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
12 changes: 1 addition & 11 deletions frontend/src/components/TableView/TableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,23 +153,13 @@ export const TableView = <T extends MRT_RowData>({
)}
{combinedExport && (
<Box sx={{ margin: '1em', maxWidth: '20em' }}>
<p>
Click here to export a list of the localities shown in the table combined with each species found in those
localities as a comma separated csv-file. Notice, that the export may take a while. The combined
locality-species export is currently always sorted by the id&apos;s, but it only contains the localities
filtered in the table.{' '}
</p>
<p>
You can also export only the localities of the table by clicking the download icon in the right-top corner
of the table.
</p>
<Box sx={{ display: 'flex', gap: '0.4em' }}>
<Button
variant="contained"
disabled={exportIsLoading}
onClick={() => void combinedExport(table.getSortedRowModel().rows.map(d => d.original.lid as number))}
>
Locality & Species export
Export localities with their species
</Button>
{exportIsLoading && <CircularProgress />}
</Box>
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/components/TableView/helpers.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Box, IconButton } from '@mui/material'
import { Box, Button } from '@mui/material'
import {
MRT_RowData,
MRT_ShowHideColumnsButton,
MRT_TableInstance,
MRT_ToggleFullScreenButton,
} from 'material-react-table'
import { mkConfig, generateCsv, download } from 'export-to-csv'
import FileDownloadIcon from '@mui/icons-material/FileDownload'
import { AcceptedData } from 'node_modules/export-to-csv/output/lib/types'

export type ExportFn<T> = (data: T) => { [k: string]: AcceptedData }
Expand Down Expand Up @@ -41,8 +40,8 @@ export const renderCustomToolbar = <T extends MRT_RowData>({ table }: { table: M
<Box>
<MRT_ShowHideColumnsButton table={table} />
<MRT_ToggleFullScreenButton table={table} />
<IconButton onClick={() => exportRows(table)}>
<FileDownloadIcon htmlColor="grey" />
</IconButton>
<Button onClick={() => exportRows(table)} variant="contained">
Export table
</Button>
</Box>
)

0 comments on commit 64e7db4

Please sign in to comment.