diff --git a/src/config-schema.ts b/src/config-schema.ts index e182f9a..f0dcc49 100644 --- a/src/config-schema.ts +++ b/src/config-schema.ts @@ -1,10 +1,10 @@ import { Type } from '@openmrs/esm-framework'; export const configSchema = { - showTutorial: { + enableTutorials: { _type: Type.Boolean, _default: false, - _description: 'Enable or Disable Onboarding Walkthrough', + _description: 'Enable or Disable Onboarding Walkthroughs', }, tutorialData: { _type: Type.Array, @@ -614,7 +614,7 @@ export const configSchema = { }; export type Config = { - showTutorial: boolean; + enableTutorials: boolean; tutorialData: { title: string; description: string; diff --git a/src/tutorial/tutorial.tsx b/src/tutorial/tutorial.tsx index a148bf2..62c5a95 100644 --- a/src/tutorial/tutorial.tsx +++ b/src/tutorial/tutorial.tsx @@ -1,10 +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?.enableTutorials; const handleOpenModal = () => { const dispose = showModal('tutorial-modal', { onClose: () => dispose(), @@ -12,11 +14,7 @@ const Tutorial = () => { }); }; - return ( - <> -
{t('tutorials', 'Tutorials')}
- - ); + return showTutorial ?
{t('tutorials', 'Tutorials')}
: null; }; export default Tutorial;