@@ -385,6 +385,9 @@ function MapCard ({ report, reportFilter, archived, authEnabled }) {
385385
386386 const { previewUrl, previewLoading, previewError, setPreviewLoading, setPreviewError } = useMapPreview ( report , isVisible )
387387 const centerCoordinates = getMapCenterCoordinates ( report . mapConfig )
388+ const showArchiveAction = reportFilter === 'my'
389+ const showEditAction = report . canWrite && ! report . archived
390+ const showFooterActions = showArchiveAction || showEditAction
388391
389392 const handleEdit = ( e ) => {
390393 e . stopPropagation ( )
@@ -452,23 +455,29 @@ function MapCard ({ report, reportFilter, archived, authEnabled }) {
452455 { getRelativeTime ( modifiedDate ) }
453456 </ div >
454457 </ div >
455- < div className = { styles . mapCardDivider } />
456- < div className = { styles . mapFooterActions } >
457- { reportFilter === 'my' ? < ArchiveReportButton report = { report } /> : < span /> }
458- { report . canWrite && ! report . archived
459- ? (
460- < Button
461- type = 'default'
462- size = 'small'
463- icon = { < EditOutlined /> }
464- onClick = { handleEdit }
465- className = { styles . mapActionButton }
466- title = 'Edit'
467- > Edit
468- </ Button >
469- )
470- : null }
471- </ div >
458+ { showFooterActions
459+ ? (
460+ < >
461+ < div className = { styles . mapCardDivider } data-testid = 'map-card-divider' />
462+ < div className = { styles . mapFooterActions } data-testid = 'map-card-footer-actions' >
463+ { showArchiveAction ? < ArchiveReportButton report = { report } /> : null }
464+ { showEditAction
465+ ? (
466+ < Button
467+ type = 'default'
468+ size = 'small'
469+ icon = { < EditOutlined /> }
470+ onClick = { handleEdit }
471+ className = { styles . mapActionButton }
472+ title = 'Edit'
473+ > Edit
474+ </ Button >
475+ )
476+ : null }
477+ </ div >
478+ </ >
479+ )
480+ : null }
472481 </ div >
473482 </ div >
474483 </ div >
0 commit comments