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

opd package on the ohri clinical views #1827

Merged
merged 5 commits into from
Apr 8, 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"start:pmtct": "openmrs develop --backend https://ohri-namibia-dev.globalhealthapp.net --sources 'packages/esm-ohri-pmtct-app/'",
"start:form-render": "openmrs develop --backend https://ohri-dev.globalhealthapp.net --sources packages/esm-form-render-app",
"start:tb": "openmrs develop --backend https://ohri-dev.globalhealthapp.net --sources packages/esm-tb-app",
"start:opd": "openmrs develop --backend https://ohri-dev.globalhealthapp.net --sources packages/esm-opd-app",
"prettier": "prettier --fix --config prettier.config.js --write \"packages/**/*.{ts,tsx}\"",
"prepare": "husky install",
"test": "jest --config jest.config.js --verbose false --passWithNoTests",
Expand Down
55 changes: 55 additions & 0 deletions packages/esm-opd-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@ohri/openmrs-esm-ohri-opd-app",
"version": "2.2.0",
"description": "opd active visits",
"browser": "dist/openmrs-esm-ohri-opd-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",
"ohri",
"opd"
],
"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",
"@ohri/esm-patient-chart-app": "7.1.0-2"
},
"peerDependencies": {
"@ohri/esm-patient-chart-app": "7.1.0-2",
"@openmrs/esm-framework": "5.x",
"@openmrs/esm-patient-common-lib": "6.x",
"dayjs": "1.x",
"react": "18.x",
"react-i18next": "11.x",
"swr": "2.x"
},
"devDependencies": {
"@ohri/esm-patient-chart-app": "7.1.0-2",
"webpack": "^5.88.2"
}
}
1 change: 1 addition & 0 deletions packages/esm-opd-app/src/config-schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const configSchema = {};
12 changes: 12 additions & 0 deletions packages/esm-opd-app/src/dashboard.meta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const opdFolderMeta = {
title: 'OPD',
slotName: 'opd-slot',
isExpanded: false,
};

export const activeVisitDashboardMeta = {
slot: 'patient-chart-active-visit-dashboard-slot',
columns: 1,
path: 'Active Visits',
title: 'Active Visits',
};
21 changes: 21 additions & 0 deletions packages/esm-opd-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-opd-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';
30 changes: 30 additions & 0 deletions packages/esm-opd-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle, registerFeatureFlag } from '@openmrs/esm-framework';
import { opdFolderMeta } from './dashboard.meta';
import { createDashboardGroup, createDashboardLink } from '@openmrs/esm-patient-common-lib';
import { configSchema } from './config-schema';
import { activeVisitDashboardMeta } from '@ohri/esm-patient-chart-app/src/dashboard.meta';

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

require('./root.scss');

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

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

export function startupApp() {
defineConfigSchema(moduleName, configSchema);
}

export const opdPatientChartDashboard = getSyncLifecycle(createDashboardGroup(opdFolderMeta), options);

export const activeVisitDashboardLink = getSyncLifecycle(
createDashboardLink({
...activeVisitDashboardMeta,
moduleName,
}),
{ featureName: 'active-visit', moduleName },
);
116 changes: 116 additions & 0 deletions packages/esm-opd-app/src/root.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';

$ui-01: #f4f4f4;
$ui-02: #ffffff;
$ui-03: #e0e0e0;
$ui-05: #161616;
$ui-background: #ffffff;
$color-gray-70: #525252;
$color-blue-60-2: #0f62fe;
$color-yellow-50: #feecae;
$inverse-support-03: #f1c21b;
$warning-background: #fff8e1;
$openmrs-background-grey: #f4f4f4;
$danger: #da1e28;
$interactive-01: #0f62fe;
$brand-teal-01: #3197D9;
$ohri-input-width: 22.313rem;
$ohri-home-background: #ededed;
$button-primary: #0078A6;

.productiveHeading01 {
@include type.type-style("heading-compact-01");
}

.productiveHeading02 {
@include type.type-style("heading-compact-02");
}

.productiveHeading03 {
@include type.type-style("heading-03");
}

.productiveHeading04 {
@include type.type-style("heading-04");
}

.productiveHeading05 {
@include type.type-style("heading-05");
}

.productiveHeading06 {
@include type.type-style("heading-06");
}

.bodyShort01 {
@include type.type-style("body-compact-01");
}

.helperText01 {
@include type.type-style("helper-text-01");
}

.bodyShort02 {
@include type.type-style("body-compact-02");
}

.bodyLong01 {
@include type.type-style("body-01");
}

.bodyLong02 {
@include type.type-style("body-02");
}

.label01 {
@include type.type-style("label-01");
}

.text02 {
color: $text-02;
}

aside {
background-color: $ui-02 !important;
}

// Login Overrides

div[class*='-esm-login__styles__center'] > img {
width: 140px; // design has 120px
}

:global(.tab-12rem) > button {
width: 12rem !important;
}

:global(.tab-14rem) > button {
width: 14rem !important;
}

:global(.tab-16rem) > button {
width: 16rem !important;
}

:global(.cds--overflow-menu) > div {
width: 15rem !important;
}

nav :global(.cds--accordion__title) {
color: #525252;
font-weight: 600 !important;
}

nav :global(.cds--accordion__content) {
padding-bottom: 0 !important;
padding-top: 0 !important;
}

nav :global(.cds--accordion__content) > a {
background-color: #cecece !important;
color: #161616 !important;
border-left-color: var(--brand-01) !important;
font: bolder;
}
38 changes: 38 additions & 0 deletions packages/esm-opd-app/src/routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "https://json.openmrs.org/routes.schema.json",
"backendDependencies": {
"webservices.rest": "^2.24.0"
},
"pages": [
],
"extensions": [
{
"name": "opd",
"slot": "patient-chart-dashboard-slot",
"component": "opdPatientChartDashboard",
"order": 25,
"meta": {
"path": "OPD",
"slot": "opd-slot",
"isExpanded": false
}
},
{
"name": "active-visit-summary-dashboard",
"component": "activeVisitDashboardLink",
"slot": "opd-slot",
"meta": {
"slot": "patient-chart-active-visit-dashboard-slot",
"columns": 1,
"path": "Active Visits"
}
},
{
"name": "opd-summary-ext",
"slot": "opd-summary-slot",
"component": "opdSummaryDashboard"
}


]
}
15 changes: 15 additions & 0 deletions packages/esm-opd-app/src/setupTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import '@testing-library/jest-dom';

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();
1 change: 1 addition & 0 deletions packages/esm-opd-app/translations/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
28 changes: 28 additions & 0 deletions packages/esm-opd-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-opd-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;
Loading
Loading