Skip to content

Commit

Permalink
fixes to care and treatment setup
Browse files Browse the repository at this point in the history
  • Loading branch information
pirupius committed Sep 13, 2023
1 parent 9f28b9e commit f2aa0f4
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 69 deletions.
25 changes: 1 addition & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
16 changes: 7 additions & 9 deletions src/care-and-treatment/tabs/tab-one.component.tsx
Original file line number Diff line number Diff line change
@@ -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 <EmptyStateComingSoon headerTitle={"Tab One"} />;
return <Tile> Tab One </Tile>;
return (
<>
<EmptyStateComingSoon displayText={title} headerTitle={title} />
</>
);
};

export default TabOne;
19 changes: 8 additions & 11 deletions src/care-and-treatment/tabs/tab-three.component.tsx
Original file line number Diff line number Diff line change
@@ -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 <EmptyStateComingSoon headerTitle={"Tab Three"} />;
return <Tile> Tab Three </Tile>;
return (
<>
<EmptyStateComingSoon displayText={title} headerTitle={title} />
</>
);
};

export default TabThree;
15 changes: 7 additions & 8 deletions src/care-and-treatment/tabs/tab-two.component.tsx
Original file line number Diff line number Diff line change
@@ -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 <EmptyStateComingSoon headerTitle={"Tab One"} />;
return <Tile> Tab Two </Tile>;
return (
<>
<EmptyStateComingSoon displayText={title} headerTitle={title} />
</>
);
};

export default TabTwo;
18 changes: 6 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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({
Expand Down
6 changes: 3 additions & 3 deletions src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 19 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f2aa0f4

Please sign in to comment.