Skip to content

Commit

Permalink
Fix empty button intents on encounter list (#1833)
Browse files Browse the repository at this point in the history
  • Loading branch information
CynthiaKamau authored Apr 11, 2024
1 parent 1ce904a commit de655b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const EncounterList: React.FC<EncounterListProps> = ({
const { encounters, isLoading, onFormSave } = useEncounterRows(patientUuid, encounterType, filter);
const { moduleName, workspaceWindowSize, displayText, hideFormLauncher } = launchOptions;

const defaultActions = useMemo(
const defaultActions = useMemo(
() => [
{
label: t('viewEncounter', 'View'),
Expand All @@ -91,7 +91,7 @@ export const EncounterList: React.FC<EncounterListProps> = ({
if (!isLoadingFormsJson) {
const formsWithFilteredIntents = formsJson.map((form) => {
const descriptor = formList.find((formDescriptor) => formDescriptor.name === form.name);
// handle excluded intents
// handle excluded intents
if (descriptor?.excludedIntents?.length) {
form['availableIntents'] = form['availableIntents'].filter(
(intentEntry) => !descriptor.excludedIntents.includes(intentEntry.intent),
Expand Down Expand Up @@ -217,7 +217,7 @@ export const EncounterList: React.FC<EncounterListProps> = ({
}, [encounters, pageSize, constructPaginatedTableRows, currentPage]);

const formLauncher = useMemo(() => {
if (forms.length == 1 && !forms[0]['availableIntents']?.length) {
if (forms.length == 1 && !forms[0]['availableIntents']?.length) {
// we only have one form with no intents
// just return the "Add" button
return (
Expand All @@ -243,7 +243,7 @@ export const EncounterList: React.FC<EncounterListProps> = ({
</Button>
);
} else if (forms.length && !(hideFormLauncher ?? isDead)) {
return () => (
return (
<OHRIFormLauncherWithIntent
formJsonList={forms}
launchForm={(formJson, intent) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-ohri-pmtct-app/src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const configSchema = {
_type: Type.Object,
_description: 'List of uuids for PMTCT forms.',
_default: {
antenatal: '',
antenatal: '5255a535-2acb-3f44-bd0a-3f80595dece1',
labourAndDelivery: '1e5614d6-5306-11e6-beb8-9e71128cae77',
motherPostnatal: 'e6b67aa4-6c59-4470-8ad5-b994efeda553',
infantPostnatal: '5022c5d7-ea45-47ce-bd65-1ba1d8ad2467',
Expand Down

0 comments on commit de655b9

Please sign in to comment.