diff --git a/src/frontend/src/components/IndividualProject/Contributions/TableSection/index.tsx b/src/frontend/src/components/IndividualProject/Contributions/TableSection/index.tsx index 7279bbeb..96b5a7c9 100644 --- a/src/frontend/src/components/IndividualProject/Contributions/TableSection/index.tsx +++ b/src/frontend/src/components/IndividualProject/Contributions/TableSection/index.tsx @@ -1,6 +1,8 @@ import DataTable from '@Components/common/DataTable'; +import Icon from '@Components/common/Icon'; import { useTypedSelector } from '@Store/hooks'; import { useMemo } from 'react'; +import { toast } from 'react-toastify'; const contributionsDataColumns = [ { @@ -15,6 +17,41 @@ const contributionsDataColumns = [ header: 'Task Status', accessorKey: 'task_state', }, + { header: 'Image count', accessorKey: 'image_count' }, + + { + header: 'Orthophoto', + accessorKey: 'assets_url', + cell: ({ row }: any) => { + const handleDownloadResult = () => { + const { original: rowData } = row; + if (!rowData?.assets_url) return; + try { + const link = document.createElement('a'); + link.href = rowData?.assets_url; + link.download = 'assets.zip'; + document.body.appendChild(link); + link.click(); + link.remove(); + } catch (error) { + toast.error(`There wan an error while downloading file ${error}`); + } + }; + + return ( +
{}} + onClick={() => handleDownloadResult()} + > +
Download
+ +
+ ); + }, + }, ]; export default function TableSection() { @@ -30,6 +67,8 @@ export default function TableSection() { user: curr?.name || '-', task_mapped: `Task# ${curr?.project_task_index}`, task_state: curr?.state, + assets_url: curr?.assets_url, + image_count: curr?.image_count, }, ]; }, []);