Skip to content

Commit

Permalink
Merge branch 'main' into PORTALS-3363
Browse files Browse the repository at this point in the history
  • Loading branch information
kianamcc authored Dec 21, 2024
2 parents 17fe066 + bfe45c0 commit e6de061
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/synapse-react-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "synapse-react-client",
"version": "3.3.32",
"version": "3.3.33",
"private": false,
"type": "module",
"main": "./dist/index.cjs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const EntityUpload = forwardRef(function EntityUpload(
).length

function uploadFileList(fileList: ArrayLike<File>) {
if (uploadDestination?.projectStorageLocationUsage.isOverLimit) {
if (uploadDestination?.projectStorageLocationUsage?.isOverLimit) {
displayToast(
'Cannot upload files because the storage limit has been exceeded.',
'danger',
Expand All @@ -145,7 +145,7 @@ export const EntityUpload = forwardRef(function EntityUpload(
return (
<div>
<EntityUploadPromptDialog activePrompts={activePrompts} />
{uploadDestination && (
{uploadDestination?.projectStorageLocationUsage && (
<ProjectStorageLimitAlert
usage={uploadDestination.projectStorageLocationUsage}
didUploadsExceedLimit={didUploadsExceedStorageLimit}
Expand All @@ -164,7 +164,7 @@ export const EntityUpload = forwardRef(function EntityUpload(
border: '1px dashed #D9D9D9',
backgroundColor: 'grey.100',
textAlign: 'center',
...(uploadDestination?.projectStorageLocationUsage.isOverLimit
...(uploadDestination?.projectStorageLocationUsage?.isOverLimit
? disabledUploadPaneSx
: {}),
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
SxProps,
Tooltip,
Typography,
useMediaQuery,
useTheme,
} from '@mui/material'
import { BUNDLE_MASK_LAST_UPDATED_ON } from '../../../utils/SynapseConstants'
import {
Expand All @@ -29,6 +31,11 @@ export type CreatedByModifiedByProps = {
}

function Separator() {
const theme = useTheme()
const isSmallScreen = useMediaQuery(theme.breakpoints.down('sm'))
if (isSmallScreen) {
return null
}
return (
<Typography variant={'breadcrumb1'} sx={{ color: 'grey.700' }}>
/
Expand Down Expand Up @@ -103,14 +110,25 @@ export function CreatedByModifiedBy(props: CreatedByModifiedByProps) {
}

return (
<Box sx={{ bgcolor: 'grey.100', py: '10px' }}>
<Box
sx={theme => ({
bgcolor: 'grey.100',
py: '10px',
[theme.breakpoints.down('sm')]: {
p: '24px 40px',
},
})}
>
<Breadcrumbs
separator={<Separator />}
sx={{
sx={theme => ({
'& .MuiBreadcrumbs-ol': {
justifyContent: 'center',
[theme.breakpoints.down('sm')]: {
gap: '4px',
},
},
}}
})}
>
<ConditionalWrapper condition={!entity} wrapper={Skeleton}>
<Typography
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,13 @@ describe('willUploadsExceedStorageLimit', () => {
),
).toEqual(true)
})

test('undefined usage', () => {
const usage = undefined

const pendingUploadsInBytes = 0
expect(
willUploadsExceedStorageLimit([], usage, pendingUploadsInBytes),
).toEqual(false)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import { ProjectStorageLocationUsage } from '@sage-bionetworks/synapse-types'
*/
export function willUploadsExceedStorageLimit(
files: ArrayLike<File>,
usage: ProjectStorageLocationUsage,
usage: ProjectStorageLocationUsage | undefined,
pendingUploadsInBytes: number,
): boolean {
if (usage == null) {
return false
}
if (usage.isOverLimit) {
return true
}
Expand Down
2 changes: 1 addition & 1 deletion packages/synapse-types/src/File/UploadDestination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface UploadDestination {
uploadType: UploadType
/* If set, the client should show this banner every time an upload is initiated */
banner?: string
projectStorageLocationUsage: ProjectStorageLocationUsage
projectStorageLocationUsage?: ProjectStorageLocationUsage
}

/**
Expand Down

0 comments on commit e6de061

Please sign in to comment.