Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(chore) Bump carbon version and clean up some redundant components #1851

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const config = {
collectCoverage: true,
coverageThreshold: {
global: {
statements: 0,
branches: 0,
functions: 0,
lines: 0,
Expand All @@ -22,7 +23,7 @@ const config = {
'!**/e2e/**',
],
transform: {
'^.+\\.tsx?$': '@swc/jest',
'^.+\\.(j|t)sx?$': '@swc/jest',
},
transformIgnorePatterns: ['/node_modules/(?!@openmrs)'],
moduleDirectories: ['node_modules', '__mocks__', 'tools', __dirname],
Expand All @@ -32,13 +33,12 @@ const config = {
'^@carbon/charts-react$': path.resolve(__dirname, '__mocks__', '@carbon__charts-react.ts'),
'^dexie$': require.resolve('dexie'),
'^lodash-es/(.*)$': 'lodash/$1',
'^lodash-es$': 'lodash',
'^react-i18next$': path.resolve(__dirname, '__mocks__', 'react-i18next.js'),
'^uuid$': path.resolve(__dirname, 'node_modules', 'uuid', 'dist', 'index.js'),
},
testEnvironment: 'jsdom',
testPathIgnorePatterns: [
"/node_modules/",
"/e2e/" // Ignore the e2e directory containing Playwright tests
]
testPathIgnorePatterns: [path.resolve(__dirname, 'node_modules'), path.resolve(__dirname, 'e2e')],
};

module.exports = config;
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"webpack-dev-server": "^4.8.1"
},
"resolutions": {
"@carbon/react": "1.17.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may not have full context on what's happening here, why was this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its an older version and is used by default

"@types/react": "^18.0.14",
"@types/react-dom": "^18.0.5"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export const OTable: React.FC<TableProps> = ({ tableHeaders, tableRows }) => {
{...getHeaderProps({
header,
isSortable: header.isSortable,
})}>
})}
>
{header.header?.content ?? header.header}
</TableHeader>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export const TableEmptyState: React.FC<{ tableHeaders: Array<{ key: string; head
{...getHeaderProps({
header,
isSortable: header.isSortable,
})}>
})}
>
{header.header?.content ?? header.header}
</TableHeader>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ import { navigate, showModal, showSnackbar } from '@openmrs/esm-framework';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { EmptyState } from '../empty-state/empty-state.component';
import { FormLauncherWithIntent } from '../ohri-form-launcher/ohri-form-launcher.component';
import styles from './encounter-list.scss';
import { OTable } from '../data-table/o-table.component';
import { Button, Link, OverflowMenu, OverflowMenuItem, Pagination, DataTableSkeleton } from '@carbon/react';
import {
Button,
Link,
OverflowMenu,
OverflowMenuItem,
Pagination,
DataTableSkeleton,
MenuButton,
MenuItem,
} from '@carbon/react';
import { Add } from '@carbon/react/icons';
import { FormSchema } from '@openmrs/openmrs-form-engine-lib';
import { deleteEncounter, launchEncounterForm } from './helpers';
Expand Down Expand Up @@ -213,7 +221,8 @@ export const EncounterList: React.FC<EncounterListProps> = ({
} else {
column.link?.getUrl && navigate({ to: column.link.getUrl() });
}
}}>
}}
>
{val}
</Link>
);
Expand Down Expand Up @@ -283,29 +292,38 @@ export const EncounterList: React.FC<EncounterListProps> = ({
workspaceWindowSize,
patientUuid,
);
}}>
}}
>
{displayText}
</Button>
);
} else if (forms.length && !(hideFormLauncher ?? isDead)) {
return (
<FormLauncherWithIntent
formJsonList={forms}
launchForm={(formJson, intent) =>
launchEncounterForm(
formJson,
moduleName,
'add',
onFormSave,
null,
'',
intent,
workspaceWindowSize,
patientUuid,
)
}
title={displayText}
/>
<MenuButton label={t('add', 'Add')} kind="ghost" menuAlignment="bottom-end">
{formsJson
.filter((formJson) => formJson.availableIntents.length > 0)
.map((filteredItem) =>
filteredItem.availableIntents.map((intent, index) => (
<MenuItem
key={index}
label={intent.display}
onClick={() =>
launchEncounterForm(
filteredItem,
moduleName,
'add',
onFormSave,
null,
'',
intent,
workspaceWindowSize,
patientUuid,
)
}
/>
)),
)}
</MenuButton>
);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ export const MultipleEncounterList: React.FC<MultipleEncounterListProps> = ({
} else {
column.link?.getUrl && navigate({ to: column.link.getUrl() });
}
}}>
}}
>
{val}
</Link>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export const AddPatientToListOverflowMenuItem: React.FC<{
onClick={() => setIsOpen(true)}
style={{
maxWidth: '100vw',
}}>
}}
>
<span className="cds--overflow-menu-options__option-content">
{displayText || t('startHTSSession', 'Start HTS Session')}
</span>
Expand Down Expand Up @@ -167,7 +168,8 @@ export const AddPatientToListModal: React.FC<{
selectedList == null ||
isSubmitting ||
(selectedList == 'none' && currentMemberships.length == 0)
}>
}
>
<div style={{ paddingLeft: '1rem', marginBottom: '2rem' }}>
<p style={{ marginBottom: '1rem' }}>Currently added to the list(s) below</p>
{isLoading ? loader : alreadySubscribedLists}
Expand All @@ -180,7 +182,8 @@ export const AddPatientToListModal: React.FC<{
legendText=""
name="patient-lists"
orientation="vertical"
onChange={(selected) => setSelectedList(selected.toString())}>
onChange={(selected) => setSelectedList(selected.toString())}
>
{availableLists}
</RadioButtonGroup>
)}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const FormLauncherEmpty: React.FC<{
onClick={(e) => {
e.preventDefault();
launchForm();
}}>
}}
>
{t('add', 'New')}
</Button>
</div>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading