diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f676172..ed16606 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,6 @@ -name: Node.js CI +name: UgandaEMR CI on: - workflow_dispatch: # enables the workflow to be triggered manually push: branches: [main] pull_request: @@ -9,11 +8,10 @@ on: release: types: - created - env: - ESM_NAME: "@ugandaemr/esm-template-app" - JS_NAME: "esm-ugandaemr-template-app.js" - + ESM_NAME: "@ugandaemr/esm-data-entry-statistics-app" + JS_NAME: "esm-data-entry-statistics-app.js" + jobs: build: runs-on: ubuntu-latest @@ -30,10 +28,17 @@ jobs: node-version: "18.x" registry-url: "https://registry.npmjs.org" + - name: Cache dependencies + id: cache + uses: actions/cache@v3 + with: + path: "**/node_modules" + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' run: yarn install --immutable - + - name: Setup local cache server for Turborepo uses: felixmosh/turborepo-gh-artifacts@v2 with: @@ -58,55 +63,51 @@ jobs: if: ${{ github.event_name == 'push' }} steps: - - run: echo "Uncomment the lines below and delete this one." - # - uses: actions/checkout@v3 - - # - name: Download Artifacts - # uses: actions/download-artifact@v3 - - # - name: Setup Node.js - # uses: actions/setup-node@v3 - # with: - # node-version: "18.x" - # registry-url: "https://registry.npmjs.org" - - # - name: Cache dependencies - # id: cache - # uses: actions/cache@v3 - # with: - # path: "**/node_modules" - # key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} - - # - name: Install dependencies - # if: steps.cache.outputs.cache-hit != 'true' - # run: yarn install --immutable + - uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "18.x" + registry-url: "https://registry.npmjs.org" + + - name: Cache dependencies + id: cache + uses: actions/cache@v3 + with: + path: "**/node_modules" + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: yarn install --immutable - # - name: Setup local cache server for Turborepo - # uses: felixmosh/turborepo-gh-artifacts@v2 - # with: - # repo-token: ${{ secrets.GITHUB_TOKEN }} - # server-token: ${{ secrets.TURBO_SERVER_TOKEN }} + - name: Setup local cache server for Turborepo + uses: felixmosh/turborepo-gh-artifacts@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: ${{ secrets.TURBO_SERVER_TOKEN }} - # - name: Version - # run: yarn version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}" + - name: Version + run: yarn version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}" - # - name: Build - # run: yarn turbo build --color --concurrency=5 + - name: Build + run: yarn turbo build --color --concurrency=5 - # - run: git config user.email "<>" && git config user.name "UgandaEMR CI" - # - run: git add . && git commit -m "Prerelease version" --no-verify + - run: git config user.email "<>" && git config user.name "UgandaEMR CI" + - run: git add . && git commit -m "Prerelease version" --no-verify - # - name: Pre-release - # run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public --tag next - # env: - # NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + - name: Pre-release + run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public --tag next + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - # - name: Upload Artifacts - # uses: actions/upload-artifact@v3 - # with: - # name: dist - # path: | - # dist + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: dist + path: | + dist release: runs-on: ubuntu-latest @@ -119,11 +120,12 @@ jobs: - uses: actions/checkout@v3 - name: Download Artifacts uses: actions/download-artifact@v3 - - name: Use Node.js + + - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: "18.x" - registry-url: 'https://registry.npmjs.org' + registry-url: "https://registry.npmjs.org" - name: Cache dependencies id: cache @@ -131,27 +133,17 @@ jobs: with: path: "**/node_modules" key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} - + - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' run: yarn install --immutable - + + - name: Setup local cache server for Turborepo + uses: felixmosh/turborepo-gh-artifacts@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: ${{ secrets.TURBO_SERVER_TOKEN }} + - run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - - deploy: - runs-on: ubuntu-latest - - needs: pre_release - - if: ${{ github.event_name == 'push' }} - - steps: - - run: echo "Uncomment the lines below and delete this one." - # - name: Trigger RefApp Build - # uses: fjogeleit/http-request-action@master - # with: - # url: https://ci.openmrs.org/rest/api/latest/queue/REFAPP-D3X - # method: "POST" - # customHeaders: '{ "Authorization": "Bearer ${{ secrets.BAMBOO_TOKEN }}" }' \ No newline at end of file diff --git a/package.json b/package.json index e8729bc..565b62e 100644 --- a/package.json +++ b/package.json @@ -1,104 +1,104 @@ { - "name": "@ugandaemr/esm-template-app", - "version": "1.0.0", - "license": "MPL-2.0", - "description": "A template for creating frontend modules for UgandaEMR", - "browser": "dist/esm-ugandaemr-template-app.js", - "main": "src/index.ts", - "source": true, - "scripts": { - "start": "openmrs develop", - "serve": "webpack serve --mode=development", - "build": "webpack --mode production", - "analyze": "webpack --mode=production --env analyze=true", - "lint": "TIMING=1 eslint src --ext js,jsx,ts,tsx", - "prettier": "prettier --write \"src/**/*.{ts,tsx}\"", - "typescript": "tsc", - "test": "jest --config jest.config.js --passWithNoTests", - "verify": "turbo lint typescript coverage", - "coverage": "yarn test --coverage", - "prepare": "husky install", - "extract-translations": "i18next 'src/**/*.component.tsx' --config ./i18next-parser.config.js" - }, - "husky": { - "hooks": { - "pre-commit": "pretty-quick --staged && yarn verify" - } - }, - "browserslist": [ - "extends browserslist-config-openmrs" - ], - "keywords": [ - "openmrs", - "microfrontends" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/mets-programme/esm-ugandaemr-template-app.git" - }, - "homepage": "https://github.com/mets-programme/esm-ugandaemr-template-app#readme", - "publishConfig": { - "access": "public" - }, - "bugs": { - "url": "https://github.com/mets-programme/esm-ugandaemr-template-app/issues" - }, - "dependencies": { - "@carbon/react": "^1.33.1", - "lodash-es": "^4.17.21", - "react-image-annotate": "^1.8.0" - }, - "peerDependencies": { - "@openmrs/esm-framework": "*", - "dayjs": "1.x", - "react": "18.x", - "react-i18next": "11.x", - "react-router-dom": "6.x", - "rxjs": "6.x" - }, - "devDependencies": { - "@openmrs/esm-framework": "next", - "@openmrs/esm-styleguide": "next", - "@swc/cli": "^0.1.62", - "@swc/core": "^1.3.68", - "@swc/jest": "^0.2.26", - "@testing-library/dom": "^8.20.1", - "@testing-library/jest-dom": "^5.16.5", - "@testing-library/react": "^13.4.0", - "@testing-library/user-event": "^14.4.3", - "@types/jest": "^28.1.8", - "@types/react": "^18.2.14", - "@types/react-dom": "^18.2.6", - "@types/react-router": "^5.1.20", - "@types/react-router-dom": "^5.3.3", - "@types/webpack-env": "^1.18.1", - "@typescript-eslint/eslint-plugin": "^5.61.0", - "@typescript-eslint/parser": "^5.61.0", - "css-loader": "^6.8.1", - "eslint": "^8.44.0", - "eslint-config-prettier": "^8.8.0", - "eslint-config-ts-react-important-stuff": "^3.0.0", - "eslint-plugin-prettier": "^4.2.1", - "husky": "^8.0.0", - "i18next": "^23.2.8", - "i18next-parser": "^8.0.0", - "identity-obj-proxy": "^3.0.0", - "jest": "^28.1.3", - "jest-cli": "^28.1.3", - "jest-environment-jsdom": "^28.1.3", - "openmrs": "next", - "prettier": "^2.8.8", - "pretty-quick": "^3.1.3", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-i18next": "^11.18.6", - "react-router-dom": "^6.14.1", - "rxjs": "^6.6.7", - "swc-loader": "^0.2.3", - "turbo": "^1.10.7", - "typescript": "^4.9.5", - "webpack": "^5.88.1", - "webpack-cli": "^5.1.4" - }, - "packageManager": "yarn@3.6.2" + "name": "@ugandaemr/esm-data-entry-statistics-app", + "version": "1.0.0", + "license": "MPL-2.0", + "description": "Frontend module for data entry statistics", + "browser": "dist/esm-ugandaemr-template-app.js", + "main": "src/index.ts", + "source": true, + "scripts": { + "start": "openmrs develop --backend http://167.71.32.250:8080/", + "serve": "webpack serve --mode=development", + "build": "webpack --mode production", + "analyze": "webpack --mode=production --env analyze=true", + "lint": "TIMING=1 eslint src --ext js,jsx,ts,tsx", + "prettier": "prettier --write \"src/**/*.{ts,tsx}\"", + "typescript": "tsc", + "test": "jest --config jest.config.js --passWithNoTests", + "verify": "turbo lint typescript coverage", + "coverage": "yarn test --coverage", + "prepare": "husky install", + "extract-translations": "i18next 'src/**/*.component.tsx' --config ./i18next-parser.config.js" + }, + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged && yarn verify" + } + }, + "browserslist": [ + "extends browserslist-config-openmrs" + ], + "keywords": [ + "openmrs", + "microfrontends" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/METS-Programme/esm-data-entry-statistics-app.git" + }, + "homepage": "https://github.com/METS-Programme/esm-data-entry-statistics-app/blob/main/README.md", + "publishConfig": { + "access": "public" + }, + "bugs": { + "url": "https://github.com/METS-Programme/esm-data-entry-statistics-app/issues" + }, + "dependencies": { + "@carbon/react": "^1.33.1", + "lodash-es": "^4.17.21", + "react-image-annotate": "^1.8.0" + }, + "peerDependencies": { + "@openmrs/esm-framework": "*", + "dayjs": "1.x", + "react": "18.x", + "react-i18next": "11.x", + "react-router-dom": "6.x", + "rxjs": "6.x" + }, + "devDependencies": { + "@openmrs/esm-framework": "next", + "@openmrs/esm-styleguide": "next", + "@swc/cli": "^0.1.62", + "@swc/core": "^1.3.68", + "@swc/jest": "^0.2.26", + "@testing-library/dom": "^8.20.1", + "@testing-library/jest-dom": "^5.16.5", + "@testing-library/react": "^13.4.0", + "@testing-library/user-event": "^14.4.3", + "@types/jest": "^28.1.8", + "@types/react": "^18.2.14", + "@types/react-dom": "^18.2.6", + "@types/react-router": "^5.1.20", + "@types/react-router-dom": "^5.3.3", + "@types/webpack-env": "^1.18.1", + "@typescript-eslint/eslint-plugin": "^5.61.0", + "@typescript-eslint/parser": "^5.61.0", + "css-loader": "^6.8.1", + "eslint": "^8.44.0", + "eslint-config-prettier": "^8.8.0", + "eslint-config-ts-react-important-stuff": "^3.0.0", + "eslint-plugin-prettier": "^4.2.1", + "husky": "^8.0.0", + "i18next": "^23.2.8", + "i18next-parser": "^8.0.0", + "identity-obj-proxy": "^3.0.0", + "jest": "^28.1.3", + "jest-cli": "^28.1.3", + "jest-environment-jsdom": "^28.1.3", + "openmrs": "next", + "prettier": "^2.8.8", + "pretty-quick": "^3.1.3", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-i18next": "^11.18.6", + "react-router-dom": "^6.14.1", + "rxjs": "^6.6.7", + "swc-loader": "^0.2.3", + "turbo": "^1.10.7", + "typescript": "^4.9.5", + "webpack": "^5.88.1", + "webpack-cli": "^5.1.4" + }, + "packageManager": "yarn@3.6.2" } diff --git a/src/components/data-entry-statistics-header/data-entry-statistics-header.component.tsx b/src/components/data-entry-statistics-header/data-entry-statistics-header.component.tsx new file mode 100644 index 0000000..a455be6 --- /dev/null +++ b/src/components/data-entry-statistics-header/data-entry-statistics-header.component.tsx @@ -0,0 +1,41 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { Calendar, Location } from "@carbon/react/icons"; +import { formatDate, useSession } from "@openmrs/esm-framework"; +import DataEntyStatisticsIllustration from "./data-entry-statistics-illustration.component"; +import styles from "./data-entry-statistics-header.scss"; + +const DatEntryStatisticsHeader: React.FC<{ title?: string }> = ({ title }) => { + const { t } = useTranslation(); + const userSession = useSession(); + const userLocation = userSession?.sessionLocation?.display; + + return ( + <> +
{t("statistics", "Statistics")}
++ {title ?? t("statistics", "Data Entry Statistics")} +
+Next steps
- -