Skip to content

Commit

Permalink
(fix) Fix predefined configuration key in extension configuration to …
Browse files Browse the repository at this point in the history
…dynamic key based on slot or widget
  • Loading branch information
CynthiaKamau committed Oct 7, 2024
1 parent f55f55d commit 839c85e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,12 @@ const InteractiveBuilder = ({ schema, onSchemaChange }: InteractiveBuilderProps)
<div className={styles.packageLabel}>{navGroupTitle}</div>
<div className={styles.subHeading}>{t('clinicalViewMenus', 'Clinical View Submenus')}</div>
{submenuConfig ? (
submenuConfig.add.map((submenuKey) => {
const submenuDetails = submenuConfig.configure[submenuKey];
submenuConfig.add?.map((submenuKey) => {
const submenuDetails = submenuConfig?.configure[submenuKey];
const subMenuSlot = submenuDetails?.slot;
const subMenuSlotDetails = getSubMenuSlotDetails(schema, subMenuSlot);
const configurationKey =
typeof subMenuSlotDetails?.configure === 'object' && Object.keys(subMenuSlotDetails?.configure)?.[0];
return (
<Accordion key={submenuKey}>
<AccordionItem title={submenuDetails?.title}>
Expand All @@ -149,7 +151,7 @@ const InteractiveBuilder = ({ schema, onSchemaChange }: InteractiveBuilderProps)
)}
</p>

{subMenuSlotDetails?.configure?.[submenuDetails?.slot]?.tabDefinitions?.map((tabDefinition) => (
{subMenuSlotDetails?.configure?.[configurationKey]?.tabDefinitions?.map((tabDefinition) => (
<Tile className={styles.tileContainer}>
<div className={styles.editStatusIcon}>
<Button
Expand All @@ -168,24 +170,24 @@ const InteractiveBuilder = ({ schema, onSchemaChange }: InteractiveBuilderProps)
{tabDefinition?.columns.map((column) => (
<div className={styles.tileContent}>
<p className={styles.content}>
{t('title', 'Title')} : {column.title}
{t('title', 'Title')} : {column.title ?? '--'}
</p>
<p className={styles.content}>
{t('concept', 'Concept')} : {column.concept}
{t('concept', 'Concept')} : {column.concept ?? '--'}
</p>
<p className={styles.content}>
{column.isDate && (
<>
{t('date', 'Date')} : {column.isDate}
{t('date', 'Date')} : {column.isDate.toString() ?? '--'}
</>
)}{' '}
)}
</p>
<p className={styles.content}>
{column.isLink && (
<>
{t('link', 'Link')} : {column.isLink}
{t('link', 'Link')} : {column.isLink.toString() ?? '--'}
</>
)}{' '}
)}
</p>
</div>
))}
Expand All @@ -201,7 +203,7 @@ const InteractiveBuilder = ({ schema, onSchemaChange }: InteractiveBuilderProps)
</Tile>
))}

{subMenuSlotDetails?.configure[submenuDetails?.slot]?.tilesDefinitions?.map((tileDefinition) => (
{subMenuSlotDetails?.configure[configurationKey]?.tilesDefinitions?.map((tileDefinition) => (
<Tile className={styles.tileContainer}>
<div className={styles.editStatusIcon}>
<Button
Expand All @@ -218,10 +220,10 @@ const InteractiveBuilder = ({ schema, onSchemaChange }: InteractiveBuilderProps)
{tileDefinition?.columns.map((column) => (
<div className={styles.tileContent}>
<p className={styles.content}>
{t('title', 'Title')} : {column.title}
{t('title', 'Title')} : {column.title ?? '--'}
</p>
<p className={styles.content}>
{t('concept', 'Concept')} : {column.concept}
{t('concept', 'Concept')} : {column.concept ?? '--'}
</p>
</div>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@

.tileContainer {
margin: layout.$spacing-03 0 layout.$spacing-03;
width:fit-content
}

.tileContent {
Expand Down
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,8 @@ export enum DefinitionTypes {
TAB_DEFINITION = 'tabDefinitions',
TILE_DEFINITION = 'tilesDefinitions',
}

export enum WidgetTypes {
ENCOUNTER_LIST_TABLE_TABS = 'encounter-list-table-tabs',
PROGRAM_SUMMARY = 'program-summary',
}

0 comments on commit 839c85e

Please sign in to comment.