-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1536 from nickgros/PORTALS-2651-download-table
- Loading branch information
Showing
16 changed files
with
448 additions
and
462 deletions.
There are no files selected for viewing
8 changes: 3 additions & 5 deletions
8
packages/synapse-react-client/src/components/DownloadCart/AvailableForDownloadTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
import { useSynapseContext } from '../../utils' | ||
import DownloadListTable, { DownloadListTableProps } from './DownloadListTable' | ||
import DownloadListTable from './DownloadListTable' | ||
import { SynapseErrorBoundary } from '../error/ErrorBanner' | ||
|
||
/** | ||
* Table of the files added to the Download Cart that are currently available for download. | ||
*/ | ||
export default function AvailableForDownloadTable( | ||
props: DownloadListTableProps, | ||
) { | ||
export default function AvailableForDownloadTable() { | ||
const { accessToken } = useSynapseContext() | ||
if (!accessToken) { | ||
return <></> | ||
} | ||
return ( | ||
<SynapseErrorBoundary> | ||
{props.filesStatistics && <DownloadListTable {...props} />} | ||
<DownloadListTable /> | ||
</SynapseErrorBoundary> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 12 additions & 15 deletions
27
packages/synapse-react-client/src/components/DownloadCart/DownloadListStats.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
import { useGetDownloadListStatistics } from '../../synapse-queries/index' | ||
import DownloadDetails from './DownloadDetails' | ||
|
||
export type DownloadListStatsProps = { | ||
numFiles: number | ||
numPackagableFiles: number | ||
numBytes: number | ||
} | ||
export default function DownloadListStats() { | ||
const { data } = useGetDownloadListStatistics({ throwOnError: true }) | ||
|
||
export default function DownloadListStats(props: DownloadListStatsProps) { | ||
const { numFiles, numPackagableFiles, numBytes } = props | ||
if (!data) { | ||
return null | ||
} | ||
|
||
return ( | ||
<div> | ||
<DownloadDetails | ||
numFiles={numFiles} | ||
numPackagableFiles={numPackagableFiles} | ||
numBytes={numBytes} | ||
></DownloadDetails> | ||
{ | ||
// also have access to fileStats.numberOfFilesRequiringAction | ||
// and fileStats.totalNumberOfFiles | ||
} | ||
numBytes={data.sumOfFileSizesAvailableForDownload} | ||
numPackagableFiles={ | ||
data.numberOfFilesAvailableForDownloadAndEligibleForPackaging | ||
} | ||
numFiles={data.numberOfFilesAvailableForDownload} | ||
/> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.