@@ -287,8 +287,9 @@ export default function ContentContextualMenu(props: Readonly<ContentContextualM
287
287
) ;
288
288
289
289
const noCreationInProgress = useCallback ( ( ) => selectedElements . every ( ( el ) => el . hasMetadata ) , [ selectedElements ] ) ;
290
+ const isSingleElement = selectedElements . length === 1 ;
290
291
291
- const allowsDuplicateAndCopy = useCallback ( ( ) => {
292
+ const allowsDuplicate = useCallback ( ( ) => {
292
293
const allowedTypes = [
293
294
ElementType . CASE ,
294
295
ElementType . STUDY ,
@@ -307,11 +308,10 @@ export default function ContentContextualMenu(props: Readonly<ContentContextualM
307
308
] ;
308
309
309
310
const hasMetadata = selectedElements [ 0 ] ?. hasMetadata ;
310
- const isSingleElement = selectedElements . length === 1 ;
311
311
const isAllowedType = allowedTypes . includes ( selectedElements [ 0 ] ?. type ) ;
312
312
313
313
return hasMetadata && isSingleElement && isAllowedType && directoryWritable ;
314
- } , [ selectedElements , directoryWritable ] ) ;
314
+ } , [ selectedElements , isSingleElement , directoryWritable ] ) ;
315
315
316
316
const allowsCreateNewStudyFromCase = useCallback (
317
317
( ) =>
@@ -394,15 +394,15 @@ export default function ContentContextualMenu(props: Readonly<ContentContextualM
394
394
} ) ;
395
395
}
396
396
397
- if ( allowsDuplicateAndCopy ( ) ) {
397
+ if ( allowsDuplicate ( ) ) {
398
398
menuItems . push ( {
399
399
messageDescriptorId : 'duplicate' ,
400
400
callback : duplicateItem ,
401
401
icon : < FileCopyTwoToneIcon fontSize = "small" data-testid = "DuplicateIcon" /> ,
402
402
} ) ;
403
403
}
404
404
405
- if ( directoryReadable ) {
405
+ if ( directoryReadable && isSingleElement ) {
406
406
menuItems . push ( {
407
407
messageDescriptorId : 'copy' ,
408
408
callback : copyItem ,
@@ -462,30 +462,31 @@ export default function ContentContextualMenu(props: Readonly<ContentContextualM
462
462
463
463
if ( menuItems . length === 0 ) {
464
464
menuItems . push ( {
465
- messageDescriptorId : noCreationInProgress ( ) ? 'notElementCreator ' : 'elementCreationInProgress' ,
465
+ messageDescriptorId : noCreationInProgress ( ) ? 'noActionAvailable ' : 'elementCreationInProgress' ,
466
466
icon : < DoNotDisturbAltIcon fontSize = "small" /> ,
467
467
disabled : true ,
468
468
} ) ;
469
469
}
470
470
471
471
return menuItems ;
472
472
} , [
473
- allowsConvertFilterIntoExplicitNaming ,
473
+ selectedElements ,
474
+ directoryWritable ,
474
475
allowsCreateNewStudyFromCase ,
476
+ allowsDuplicate ,
477
+ directoryReadable ,
478
+ isSingleElement ,
475
479
allowsDownload ,
480
+ enableDeveloperMode ,
481
+ allowsExportCase ,
476
482
allowsSpreadsheetCollection ,
477
- allowsDuplicateAndCopy ,
483
+ allowsConvertFilterIntoExplicitNaming ,
484
+ handleOpenDialog ,
485
+ duplicateItem ,
478
486
copyItem ,
479
487
downloadElements ,
480
- duplicateItem ,
481
488
handleCloseDialog ,
482
- handleOpenDialog ,
483
489
noCreationInProgress ,
484
- selectedElements ,
485
- directoryReadable ,
486
- directoryWritable ,
487
- allowsExportCase ,
488
- enableDeveloperMode ,
489
490
] ) ;
490
491
491
492
const renderDialog = ( ) => {
0 commit comments