Skip to content

Commit

Permalink
OHRI-2016 TB microfrontend (#1690)
Browse files Browse the repository at this point in the history
* OHRI-2016 TB microfrontend

* updates yarn.lock
  • Loading branch information
pirupius authored Nov 21, 2023
1 parent a2f87be commit 530a2ac
Show file tree
Hide file tree
Showing 15 changed files with 223 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/esm-tb-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# esm-tb-app

The Tuberclosis app tracks and manages patients on TB treatment. It provides a clinical dashboard with an overall view of patients as well as patient workflows.

49 changes: 49 additions & 0 deletions packages/esm-tb-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "@ohri/openmrs-esm-ohri-tb-app",
"version": "2.0.2",
"description": "Tuberclosis microfrontend for OpenMRS HIV Reference Implementation (OHRI)",
"browser": "dist/openmrs-esm-ohri-tb-app.js",
"main": "src/index.ts",
"license": "MIT",
"homepage": "https://github.com/UCSF-IGHS/openmrs-esm-ohri#readme",
"scripts": {
"start": "openmrs develop",
"serve": "webpack serve --mode=development",
"debug": "npm run serve",
"build": "webpack --mode production",
"analyze": "webpack --mode=production --env.analyze=true",
"lint": "eslint src --ext tsx",
"typescript": "tsc",
"prepublishOnly": "npm run build",
"extract-translations": "i18next 'src/**/*.component.tsx'"
},
"browserslist": [
"extends browserslist-config-openmrs"
],
"keywords": [
"openmrs"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/UCSF-IGHS/openmrs-esm-ohri.git"
},
"bugs": {
"url": "https://github.com/UCSF-IGHS/openmrs-esm-ohri/issues"
},
"dependencies": {
"@carbon/react": "^1.13.0"
},
"peerDependencies": {
"@openmrs/esm-framework": "5.x",
"@openmrs/esm-patient-common-lib": "5.x",
"dayjs": "^1.8.16",
"react": "^18.2.0",
"react-i18next": "^11.18.6"
},
"devDependencies": {
"webpack": "^5.74.0"
}
}
1 change: 1 addition & 0 deletions packages/esm-tb-app/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const sampleConstant = 'xxxxxxxxxxxx';
4 changes: 4 additions & 0 deletions packages/esm-tb-app/src/dashboard.meta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const tuberclosisMeta = {
title: 'Tuberclosis',
slotName: 'tuberclosis-slot',
};
21 changes: 21 additions & 0 deletions packages/esm-tb-app/src/dashboard.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@import "./root.scss";

.noMarker {
list-style-type: none;
}

.noMarker ul li a {
padding-left: 40px !important;
font: lighter;
}

.currentNavItem > a {
background-color: #cecece !important;
color: #161616 !important;
border-left-color: var(--brand-01) !important;
font: bolder;
}

.hide {
display: none;
}
2 changes: 2 additions & 0 deletions packages/esm-tb-app/src/declarations.d.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module '*.css';
declare module '*.scss';
17 changes: 17 additions & 0 deletions packages/esm-tb-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework';
import { createDashboardGroup, createDashboardLink } from '@openmrs/esm-patient-common-lib';

export const importTranslation = require.context('../translations', false, /.json$/, 'lazy');

require('./root.scss');

export const moduleName = '@ohri/openmrs-esm-ohri-tb-app';

const options = {
featureName: 'ohri-tb',
moduleName,
};

export function startupApp() {
defineConfigSchema(moduleName, {});
}
3 changes: 3 additions & 0 deletions packages/esm-tb-app/src/root.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
10 changes: 10 additions & 0 deletions packages/esm-tb-app/src/routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://json.openmrs.org/routes.schema.json",
"backendDependencies": {
"webservices.rest": "^2.24.0"
},
"pages": [
],
"extensions": [
]
}
15 changes: 15 additions & 0 deletions packages/esm-tb-app/src/setupTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import '@testing-library/jest-dom/extend-expect';

declare global {
interface Window {
openmrsBase: string;
spaBase: string;
}
}

const { getComputedStyle } = window;
window.getComputedStyle = (element) => getComputedStyle(element);
window.openmrsBase = '/openmrs';
window.spaBase = '/spa';
window.getOpenmrsSpaBase = () => '/openmrs/spa/';
window.HTMLElement.prototype.scrollIntoView = jest.fn();
34 changes: 34 additions & 0 deletions packages/esm-tb-app/src/views/common.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@use "@carbon/styles/scss/spacing";
@import "../root.scss";

.widgetContainer {
background-color: $ui-background;
}

.widgetHeaderContainer {
display: flex;
justify-content: space-between;
align-items: center;
padding: spacing.$spacing-04 0 spacing.$spacing-04 spacing.$spacing-05;
}

.widgetHeaderContainer > h4:after {
content: "";
display: block;
width: 2rem;
padding-top: 0.188rem;
border-bottom: 0.375rem solid var(--brand-01);
}

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

.tabContainer div[role="tabpanel"] {
padding: 0 !important;
}

.tabContainer li button {
width: 100% !important;
}
3 changes: 3 additions & 0 deletions packages/esm-tb-app/translations/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tuberclosis": "Tuberclosis"
}
28 changes: 28 additions & 0 deletions packages/esm-tb-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"esModuleInterop": true,
"module": "esnext",
"allowSyntheticDefaultImports": true,
"jsx": "react",
"skipLibCheck": true,
"moduleResolution": "node",
"lib": [
"dom",
"es5",
"scripthost",
"es2015",
"es2015.promise",
"es2016.array.include",
"es2018",
"es2020"
],
"resolveJsonModule": true,
"noEmit": true,
"target": "esnext",
"paths": {
"@openmrs/*": [
"./node_modules/@openmrs/*"
]
}
}
}
17 changes: 17 additions & 0 deletions packages/esm-tb-app/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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])/
: /(node_modules[^\\@openmrs\/esm\-patient\-common\-lib])/;

// Temporary fix to resolve webpack issues with imports from the commons library
config.overrides.resolve = {
extensions: ['.tsx', '.ts', '.jsx', '.js', '.scss'],
alias: {
'@openmrs/esm-framework': '@openmrs/esm-framework/src/internal',
'@ohri/openmrs-esm-ohri-commons-lib': path.resolve(__dirname, '../esm-commons-lib/src/index'),
'@openmrs/openmrs-form-engine-lib': '@openmrs/openmrs-form-engine-lib/src/index',
},
};
module.exports = config;
15 changes: 15 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3770,6 +3770,21 @@ __metadata:
languageName: unknown
linkType: soft

"@ohri/openmrs-esm-ohri-tb-app@workspace:packages/esm-tb-app":
version: 0.0.0-use.local
resolution: "@ohri/openmrs-esm-ohri-tb-app@workspace:packages/esm-tb-app"
dependencies:
"@carbon/react": ^1.13.0
webpack: ^5.74.0
peerDependencies:
"@openmrs/esm-framework": 5.x
"@openmrs/esm-patient-common-lib": 5.x
dayjs: ^1.8.16
react: ^18.2.0
react-i18next: ^11.18.6
languageName: unknown
linkType: soft

"@ohri/openmrs-esm-ohri@workspace:.":
version: 0.0.0-use.local
resolution: "@ohri/openmrs-esm-ohri@workspace:."
Expand Down

0 comments on commit 530a2ac

Please sign in to comment.