Skip to content

Commit 23dadc4

Browse files
committed
Disable/Enable the tutorials menu item
1 parent 1ff489b commit 23dadc4

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/tutorial/tutorial.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import React from 'react';
22
import { useTranslation } from 'react-i18next';
3-
import { showModal } from '@openmrs/esm-framework';
3+
import { showModal, useConfig } from '@openmrs/esm-framework';
4+
import { type Config } from '../config-schema';
45

56
const Tutorial = () => {
67
const { t } = useTranslation();
8+
const config = useConfig() as Config;
9+
const showTutorial = config?.showTutorial;
710

811
const handleOpenModal = () => {
912
const dispose = showModal('tutorial-modal', {
@@ -12,11 +15,7 @@ const Tutorial = () => {
1215
});
1316
};
1417

15-
return (
16-
<>
17-
<div onClick={handleOpenModal}>{t('tutorials', 'Tutorials')}</div>
18-
</>
19-
);
18+
return <>{showTutorial && <div onClick={handleOpenModal}>{t('tutorials', 'Tutorials')}</div>}</>;
2019
};
2120

2221
export default Tutorial;

0 commit comments

Comments
 (0)