diff --git a/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.component.js b/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.component.js index faf83dfe91..4fcd1e4b96 100644 --- a/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.component.js +++ b/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.component.js @@ -17,11 +17,16 @@ export const OverflowMenuComponent = ({ displayChangelog, teiId, programAPI, + readOnlyMode, }: PlainProps) => { const [actionsIsOpen, setActionsIsOpen] = useState(false); const [deleteModalIsOpen, setDeleteModalIsOpen] = useState(false); const [changelogIsOpen, setChangelogIsOpen] = useState(false); + if (readOnlyMode && !displayChangelog) { + return null; + } + return ( <> )} - + {!readOnlyMode && ( + + )} } /> diff --git a/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.container.js b/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.container.js index 38d17ad0c0..de55532883 100644 --- a/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.container.js +++ b/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.container.js @@ -13,6 +13,7 @@ export const OverflowMenu = ({ displayChangelog, teiId, programAPI, + readOnlyMode, }: Props) => { const { hasAuthority } = useAuthorities({ authorities: ['F_TEI_CASCADE_DELETE'] }); @@ -27,6 +28,7 @@ export const OverflowMenu = ({ displayChangelog={displayChangelog} teiId={teiId} programAPI={programAPI} + readOnlyMode={readOnlyMode} /> ); }; diff --git a/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.types.js b/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.types.js index 84ea57e86a..4be3b9eff0 100644 --- a/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.types.js +++ b/src/core_modules/capture-core/components/WidgetProfile/OverflowMenu/OverflowMenu.types.js @@ -9,6 +9,7 @@ export type Props = {| displayChangelog: boolean, teiId: string, programAPI: any, + readOnlyMode: boolean, |}; export type PlainProps = {| @@ -21,4 +22,5 @@ export type PlainProps = {| displayChangelog: boolean, teiId: string, programAPI: any, + readOnlyMode: boolean, |}; diff --git a/src/core_modules/capture-core/components/WidgetProfile/WidgetProfile.component.js b/src/core_modules/capture-core/components/WidgetProfile/WidgetProfile.component.js index 4379a7b768..26ac54e7b6 100644 --- a/src/core_modules/capture-core/components/WidgetProfile/WidgetProfile.component.js +++ b/src/core_modules/capture-core/components/WidgetProfile/WidgetProfile.component.js @@ -171,6 +171,7 @@ const WidgetProfilePlain = ({ trackedEntityData={clientAttributesWithSubvalues} teiId={teiId} programAPI={program} + readOnlyMode={readOnlyMode || false} />