Skip to content

Commit

Permalink
Disable/Enable the tutorials menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
Vijaykv5 committed Oct 23, 2024
1 parent f8c177f commit a6c001c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/tutorial/tutorial.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { showModal } from '@openmrs/esm-framework';
import { showModal, useConfig } from '@openmrs/esm-framework';
import { type Config } from '../config-schema';

const Tutorial = () => {
const { t } = useTranslation();
const config = useConfig() as Config;
const showTutorial = config?.showTutorial;

const handleOpenModal = () => {
const dispose = showModal('tutorial-modal', {
Expand All @@ -12,11 +15,7 @@ const Tutorial = () => {
});
};

return (
<>
<div onClick={handleOpenModal}>{t('tutorials', 'Tutorials')}</div>
</>
);
return <>{showTutorial && <div onClick={handleOpenModal}>{t('tutorials', 'Tutorials')}</div>}</>;
};

export default Tutorial;

0 comments on commit a6c001c

Please sign in to comment.