From f2aa0f4080623fc4441a59723882db31690491bf Mon Sep 17 00:00:00 2001 From: pirupius Date: Wed, 13 Sep 2023 11:41:09 +0300 Subject: [PATCH] fixes to care and treatment setup --- README.md | 25 +------------------ package.json | 3 ++- .../tabs/tab-one.component.tsx | 16 ++++++------ .../tabs/tab-three.component.tsx | 19 ++++++-------- .../tabs/tab-two.component.tsx | 15 ++++++----- src/index.ts | 18 +++++-------- src/routes.json | 6 ++--- webpack.config.js | 20 ++++++++++++++- yarn.lock | 1 + 9 files changed, 54 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index 6e0c6d5..48bbfe7 100644 --- a/README.md +++ b/README.md @@ -11,27 +11,4 @@ yarn # to install dependencies yarn start # to run the dev server ``` -Once it is running, a browser window -should open with the OpenMRS 3 application. Log in and then navigate to `/openmrs/spa/root`. - -## Adapting the code - -1. Start by finding and replacing all instances of "template" with the name - of your microfrontend. -2. Update `index.ts` as appropriate, at least changing the feature name and the page name and route. -3. Rename the `root.*` family of files to have the name of your first page. -4. Delete the contents of the objects in `config-schema`. Start filling them back in once you have a clear idea what will need to be configured. -5. Delete the `greeter` and `patient-getter` directories, and the contents of `root.component.tsx`. -6. Delete the contents of `translations/en.json`. -7. Open up `.github/workflows` and adapt it to your needs. If you're writing - a microfrontend that will be managed by the community, you might be able to - just replace all instances of `template` with your microfrontend's name. - However, if you're writing a microfrontend for a specific organization or - implementation, you will probably need to configure GitHub Actions differently. -8. Delete the contents of this README and write a short explanation of what - you intend to build. Links to planning or design documents can be very helpful. - -At this point, you should be able to write your first page as a React application. - -Check out the [Medication dispensing app](https://github.com/openmrs/openmrs-esm-dispensing-app) for an example of a non-trivial app built using the Template. - +Once it is running, it will open the browser window diff --git a/package.json b/package.json index e4c8cfd..ab56334 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "main": "src/index.ts", "source": true, "scripts": { - "start": "openmrs develop --backend https://o3.openmrs.org/", + "start": "openmrs develop --backend http://197.243.94.19:8080", "serve": "webpack serve --mode=development", "build": "webpack --mode production", "analyze": "webpack --mode=production --env analyze=true", @@ -61,6 +61,7 @@ "@openmrs/esm-framework": "next", "@openmrs/esm-patient-common-lib": "next", "@openmrs/esm-styleguide": "next", + "@openmrs/openmrs-form-engine-lib": "next", "@swc/cli": "^0.1.62", "@swc/core": "^1.3.68", "@swc/jest": "^0.2.26", diff --git a/src/care-and-treatment/tabs/tab-one.component.tsx b/src/care-and-treatment/tabs/tab-one.component.tsx index 6d77281..38c46ec 100644 --- a/src/care-and-treatment/tabs/tab-one.component.tsx +++ b/src/care-and-treatment/tabs/tab-one.component.tsx @@ -1,19 +1,17 @@ -import { Tile } from "@carbon/react"; import React from "react"; import { useTranslation } from "react-i18next"; -// import { -// EmptyStateComingSoon, -// EncounterListProps, -// PatientChartProps, -// } from "@ohri/openmrs-esm-ohri-commons-lib"; +import { EmptyStateComingSoon } from "@ohri/openmrs-esm-ohri-commons-lib"; const TabOne: React.FC<{ patientUuid: string }> = ({ patientUuid }) => { const { t } = useTranslation(); - const headerTitle = t("tabOne", "Tab One"); + const title = t("tabOne", "Tab One"); - // return ; - return Tab One ; + return ( + <> + + + ); }; export default TabOne; diff --git a/src/care-and-treatment/tabs/tab-three.component.tsx b/src/care-and-treatment/tabs/tab-three.component.tsx index c98ac37..3431ef0 100644 --- a/src/care-and-treatment/tabs/tab-three.component.tsx +++ b/src/care-and-treatment/tabs/tab-three.component.tsx @@ -1,20 +1,17 @@ -import { Tile } from "@carbon/react"; import React from "react"; +import { EmptyStateComingSoon } from "@ohri/openmrs-esm-ohri-commons-lib"; import { useTranslation } from "react-i18next"; -// import { -// EmptyStateComingSoon, -// PatientChartProps, -// } from "@ohri/openmrs-esm-ohri-commons-lib"; -const TabThree: React.FC<{ - patientUuid: string; -}> = ({ patientUuid }) => { +const TabThree: React.FC<{ patientUuid: string }> = ({ patientUuid }) => { const { t } = useTranslation(); - const headerTitle = t("tabThree", "Tab Three"); + const title = t("tabThree", "Tab Three"); - // return ; - return Tab Three ; + return ( + <> + + + ); }; export default TabThree; diff --git a/src/care-and-treatment/tabs/tab-two.component.tsx b/src/care-and-treatment/tabs/tab-two.component.tsx index 3764dcf..5d0f4d2 100644 --- a/src/care-and-treatment/tabs/tab-two.component.tsx +++ b/src/care-and-treatment/tabs/tab-two.component.tsx @@ -1,18 +1,17 @@ -import { Tile } from "@carbon/react"; import React from "react"; +import { EmptyStateComingSoon } from "@ohri/openmrs-esm-ohri-commons-lib"; import { useTranslation } from "react-i18next"; -// import { -// EmptyStateComingSoon, -// PatientChartProps, -// } from "@ohri/openmrs-esm-ohri-commons-lib"; const TabTwo: React.FC<{ patientUuid: string }> = ({ patientUuid }) => { const { t } = useTranslation(); - const headerTitle = t("tabTwo", "Tab Two"); + const title = t("tabTwo", "Tab Two"); - // return ; - return Tab Two ; + return ( + <> + + + ); }; export default TabTwo; diff --git a/src/index.ts b/src/index.ts index 8794862..1eb5f24 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,10 +8,7 @@ import { createOHRIPatientChartSideNavLink, patientChartDivider_dashboardMeta, } from "@ohri/openmrs-esm-ohri-commons-lib"; -import { - createDashboardGroup, - createDashboardLink, -} from "@openmrs/esm-patient-common-lib"; +import { createDashboardLink } from "@openmrs/esm-patient-common-lib"; const moduleName = "@ohri/openmrs-esm-rwanda"; @@ -31,14 +28,11 @@ export function startupApp() { defineConfigSchema(moduleName, configSchema); } -// export const clinicalViewsDivider = getSyncLifecycle( -// createDashboardLink({ -// path: "clinical-views", -// title: "Clinical Views", -// moduleName, -// }), -// options -// ); +// clinical views divider +export const clinicalViewsDivider = getSyncLifecycle( + createOHRIPatientChartSideNavLink({ title: "Clinical Views", moduleName }), + options +); export const careAndTreatmentDashboardLink = getSyncLifecycle( createDashboardLink({ diff --git a/src/routes.json b/src/routes.json index e6f9bc4..29df4e4 100644 --- a/src/routes.json +++ b/src/routes.json @@ -9,15 +9,15 @@ "extensions": [ { "name": "clinical-views-divider", - "slot": "patient-chart-dashboard-slot", "component": "clinicalViewsDivider", - "order": 20 + "slot": "patient-chart-dashboard-slot", + "order": 15 }, { "name": "care-and-treatment-link", "slot": "patient-chart-dashboard-slot", "component": "careAndTreatmentDashboardLink", - "order": 21, + "order": 16, "meta": { "slot": "care-and-treatment-slot", "columns": 1, diff --git a/webpack.config.js b/webpack.config.js index f729685..fe838f2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1 +1,19 @@ -module.exports = require("openmrs/default-webpack-config"); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const path = require("path"); +const config = (module.exports = require("openmrs/default-webpack-config")); +config.scriptRuleConfig.exclude = + path.sep == "/" + ? /(node_modules[^/@openmrs/esm\-patient\-common\-lib, ^/@ohri/openmrs\-esm\-ohri\-commons\-lib])/ + : /(node_modules[^\\@openmrs/esm\-patient\-common\-lib, ^\\@ohri/openmrs\-esm\-ohri\-commons\-lib])/; +config.overrides.resolve = { + extensions: [".tsx", ".ts", ".jsx", ".js", ".scss"], + alias: { + "@openmrs/esm-framework": "@openmrs/esm-framework/src/internal", + "@openmrs/openmrs-form-engine-lib": + "@openmrs/openmrs-form-engine-lib/src/index", + "@ohri/openmrs-esm-ohri-commons-lib": + "@ohri/openmrs-esm-ohri-commons-lib/src/index", + }, +}; + +module.exports = config; diff --git a/yarn.lock b/yarn.lock index 334486e..814541f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5361,6 +5361,7 @@ __metadata: "@openmrs/esm-framework": next "@openmrs/esm-patient-common-lib": next "@openmrs/esm-styleguide": next + "@openmrs/openmrs-form-engine-lib": next "@swc/cli": ^0.1.62 "@swc/core": ^1.3.68 "@swc/jest": ^0.2.26