From e1fb26062ed1a0a7e39bdcbda8081c5257bc3f78 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Fri, 22 Mar 2024 20:52:25 +0530 Subject: [PATCH 01/13] Removes support for exporting All Patients (#7457) --- src/Components/Common/Export.tsx | 19 +++++++++++++++++++ src/Components/Patient/ManagePatients.tsx | 10 +--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/Components/Common/Export.tsx b/src/Components/Common/Export.tsx index 7ddaca115bd..6714d8bdb08 100644 --- a/src/Components/Common/Export.tsx +++ b/src/Components/Common/Export.tsx @@ -39,6 +39,25 @@ export const ExportMenu = ({ }: ExportMenuProps) => { const { isExporting, exportFile } = useExport(); + if (exportItems.length === 1) { + const item = exportItems[0]; + + return ( + + exportFile(item.action, item.filePrefix, item.type, item.parse) + } + border + ghost + className="py-2.5" + > + + {isExporting ? "Exporting..." : label} + + ); + } + return (
{ disabled={!isExportAllowed} exportItems={[ { - label: - tabValue === 0 - ? "Live patients" - : "Discharged patients", + label: "Export Live patients", action: exportPatients(true), parse: preventDuplicatePatientsDuetoPolicyId, }, - { - label: "All patients", - action: exportPatients(false), - parse: preventDuplicatePatientsDuetoPolicyId, - }, ]} /> )} From 2835d89c838be252f095bc8526e3ebbb0ac109fb Mon Sep 17 00:00:00 2001 From: Onkar Jadhav <56870381+Omkar76@users.noreply.github.com> Date: Tue, 26 Mar 2024 13:03:37 +0530 Subject: [PATCH 02/13] create vite plugin to treeshake uniconpaths.json (#7275) * create vite plugin to treeshake uniconpaths.json * use icon attribute instead of className * Update the plugin code with comments. Also no longer need to check for icon names in className * Rename plugin --- plugins/treeShakeCareIcons.mts | 94 +++++++++++++++++++ src/CAREUI/display/RecordMeta.tsx | 4 +- src/CAREUI/display/SubHeading.tsx | 2 +- src/CAREUI/icons/CareIcon.tsx | 4 +- src/CAREUI/interactive/FiltersSlideover.tsx | 4 +- src/CAREUI/interactive/LegendInput.tsx | 3 +- src/CAREUI/interactive/SlideOver.tsx | 2 +- src/Common/constants.tsx | 2 +- src/Components/ABDM/ABHAProfileModal.tsx | 6 +- src/Components/ABDM/LinkABHANumberModal.tsx | 6 +- src/Components/Assets/AssetManage.tsx | 23 ++--- .../Assets/AssetType/HL7Monitor.tsx | 2 +- src/Components/Assets/AssetTypes.tsx | 17 +++- src/Components/Assets/AssetWarrantyCard.tsx | 14 ++- src/Components/Assets/AssetsList.tsx | 26 +++-- src/Components/Auth/Login.tsx | 2 +- .../LiveMonitoringFilters.tsx | 13 ++- src/Components/Common/Breadcrumbs.tsx | 2 +- src/Components/Common/DateInputV2.tsx | 9 +- src/Components/Common/Export.tsx | 6 +- src/Components/Common/GLocationPicker.tsx | 10 +- src/Components/Common/LanguageSelector.tsx | 5 +- src/Components/Common/Pagination.tsx | 14 +-- src/Components/Common/QRScanner.tsx | 3 +- .../Common/RelativeDateUserMention.tsx | 5 +- src/Components/Common/Sidebar/Sidebar.tsx | 34 ++++--- src/Components/Common/Sidebar/SidebarItem.tsx | 2 +- .../Common/Sidebar/SidebarUserCard.tsx | 10 +- src/Components/Common/SortDropdown.tsx | 8 +- src/Components/Common/Steps.tsx | 3 +- src/Components/Common/SymptomsSelect.tsx | 4 +- .../Common/TemperatureFormField.tsx | 16 ++-- src/Components/Common/UpdatableApp.tsx | 3 +- src/Components/Common/components/ButtonV2.tsx | 4 +- .../Common/components/ContactLink.tsx | 5 +- .../InvestigationBuilder.tsx | 2 +- .../prescription-builder/ProcedureBuilder.tsx | 2 +- src/Components/ExternalResult/ResultList.tsx | 4 +- src/Components/Facility/AssetCreate.tsx | 7 +- src/Components/Facility/BedManagement.tsx | 6 +- .../Facility/CentralNursingStation.tsx | 19 ++-- .../ConsultationInvestigationsTab.tsx | 2 +- .../Facility/ConsultationDetails/index.tsx | 2 +- .../ConsultationDoctorNotes/index.tsx | 2 +- src/Components/Facility/ConsultationForm.tsx | 14 +-- .../Facility/Consultations/Beds.tsx | 17 +++- .../DailyRounds/DefaultLogUpdateCard.tsx | 4 +- .../Consultations/DailyRoundsFilter.tsx | 2 +- .../Facility/Consultations/Feed.tsx | 8 +- .../Facility/Consultations/FeedButton.tsx | 2 +- .../Facility/Consultations/LiveFeed.tsx | 6 +- .../Facility/Consultations/NutritionPlots.tsx | 12 +-- .../Consultations/PrimaryParametersPlot.tsx | 10 +- .../components/BinaryChronologicalChart.tsx | 4 +- .../Facility/CoverImageEditModal.tsx | 20 ++-- src/Components/Facility/DischargeModal.tsx | 2 +- .../Facility/DischargeSummaryModal.tsx | 13 ++- .../Facility/DoctorVideoSlideover.tsx | 6 +- src/Components/Facility/FacilityCard.tsx | 14 ++- src/Components/Facility/FacilityCreate.tsx | 4 +- src/Components/Facility/FacilityHome.tsx | 32 ++++--- src/Components/Facility/FacilityUsers.tsx | 2 +- src/Components/Facility/InventoryLog.tsx | 15 ++- .../InvestigationSuggestions.tsx | 4 +- .../Investigations/InvestigationTable.tsx | 2 +- .../Facility/LocationManagement.tsx | 6 +- .../Facility/PatientNotesSlideover.tsx | 17 +++- src/Components/Facility/TriageForm.tsx | 5 +- src/Components/Form/AutoCompleteAsync.tsx | 12 ++- .../Form/FormFields/Autocomplete.tsx | 9 +- .../FormFields/AutocompleteMultiselect.tsx | 12 +-- .../Form/FormFields/PhoneNumberFormField.tsx | 30 +++--- .../Form/FormFields/TextFormField.tsx | 2 +- src/Components/Form/MultiSelectMenuV2.tsx | 9 +- src/Components/Form/SearchInput.tsx | 2 +- src/Components/Form/SelectMenuV2.tsx | 10 +- src/Components/HCX/ClaimCreatedModal.tsx | 2 +- src/Components/HCX/ClaimsItemsBuilder.tsx | 2 +- src/Components/HCX/CreateClaimCard.tsx | 6 +- .../HCX/InsuranceDetailsBuilder.tsx | 2 +- .../HCX/PatientInsuranceDetailsEditor.tsx | 4 +- src/Components/HCX/PolicyEligibilityCheck.tsx | 6 +- .../Medicine/AdministerMedicine.tsx | 10 +- .../Medicine/ManagePrescriptions.tsx | 4 +- .../Medicine/MedicineAdministration.tsx | 6 +- .../AdministrationTableRow.tsx | 2 +- .../Medicine/PrescriptionBuilder.tsx | 4 +- .../Medicine/PrescriptionDetailCard.tsx | 4 +- .../Medicine/PrescriptionsTable.tsx | 16 ++-- src/Components/Notifications/NoticeBoard.tsx | 2 +- .../Notifications/NotificationsList.tsx | 30 +++--- src/Components/Patient/FileUpload.tsx | 60 ++++++++---- src/Components/Patient/ManagePatients.tsx | 11 ++- src/Components/Patient/PatientFilter.tsx | 4 +- src/Components/Patient/PatientHome.tsx | 66 ++++++++----- src/Components/Patient/PatientInfoCard.tsx | 55 +++++++---- src/Components/Patient/PatientNotes.tsx | 2 +- src/Components/Patient/PatientRegister.tsx | 14 ++- src/Components/Patient/SampleViewAdmin.tsx | 20 +++- src/Components/Patient/UpdateStatusDialog.tsx | 4 +- src/Components/Resource/ListView.tsx | 2 +- src/Components/Resource/ResourceBoardView.tsx | 2 +- src/Components/Shifting/BoardView.tsx | 2 +- src/Components/Shifting/ListView.tsx | 2 +- src/Components/Users/ManageUsers.tsx | 12 +-- .../Users/SkillsSlideOverComponents.tsx | 2 +- src/Components/Users/UserProfile.tsx | 7 +- .../VitalsMonitor/HL7PatientVitalsMonitor.tsx | 5 +- .../VentilatorPatientVitalsMonitor.tsx | 5 +- .../VitalsMonitorAssetPopover.tsx | 12 ++- .../VitalsMonitor/VitalsMonitorHeader.tsx | 9 +- src/Utils/VoiceRecorder.tsx | 9 +- vite.config.mts | 4 + 113 files changed, 713 insertions(+), 416 deletions(-) create mode 100644 plugins/treeShakeCareIcons.mts diff --git a/plugins/treeShakeCareIcons.mts b/plugins/treeShakeCareIcons.mts new file mode 100644 index 00000000000..bf1713a0625 --- /dev/null +++ b/plugins/treeShakeCareIcons.mts @@ -0,0 +1,94 @@ +import { Plugin } from "vite"; +import * as fs from "fs"; +import * as path from "path"; +import * as glob from "glob"; + +/** + * Interface defining options for the treeShakeUniconPathsPlugin. + * + * @interface TreeShakeUniconPathsPluginOptions + * @property {string[]} iconWhitelist - An array of icon names to always include, even if not found in code. + */ + +export interface TreeShakeCareIconsOptions { + iconWhitelist: string[]; +} + +/** + * Creates a Webpack plugin that tree-shakes unused Unicon paths from UniconPaths.json in production builds. + * + * @param {TreeShakeCareIconsOptions} [options] - Optional configuration options. Defaults to an empty iconWhitelist. + * @returns {Plugin} Webpack plugin object. + */ + +export function treeShakeCareIcons( + options: TreeShakeCareIconsOptions = { iconWhitelist: [] } +): Plugin { + const rootDir = path.resolve(__dirname, ".."); // update this if moving this code to a different file + const lineIconNameRegex = /"l-[a-z]+(?:-[a-z]+)*"/g; + const allUniconPaths = JSON.parse( + fs.readFileSync( + path.resolve(rootDir, "src/CAREUI/icons/UniconPaths.json"), + "utf8" + ) + ); + + // Extracts icon names from a given file's content. + // Returns an array of icon names like ["l-eye", "l-sync", "l-hearbeat"] + function extractCareIconNames(file: string): string[] { + const fileContent = fs.readFileSync(file, "utf8"); + + const lineIconNameMatches = fileContent.match(lineIconNameRegex) || []; + + const lineIconNames = lineIconNameMatches.map( + (lineIconName) => lineIconName.slice(1, -1) // remove quotes + ); + + return lineIconNames; + } + // Finds all used icon names within the project's source files (`.tsx` or `.res` extensions). + function getAllUsedIconNames() { + const files = glob.sync(path.resolve(rootDir, "src/**/*.{tsx,res}")); + const usedIconsArray: string[] = []; + + files.forEach((file) => { + const iconNames = extractCareIconNames(file); + usedIconsArray.push(...iconNames); + }); + + return new Set(usedIconsArray); + } + // Generates a map of used icon names to their paths from UniconPaths.json, including any whitelisted icons. + function getTreeShakenUniconPaths() { + const usedIcons = [...getAllUsedIconNames(), ...options.iconWhitelist]; + const treeshakenCareIconPaths = {}; + + for (const iconName of usedIcons) { + const path = allUniconPaths[iconName]; + if (path === undefined) { + throw new Error(`Icon ${iconName} is not found in UniconPaths.json`); + } else { + treeshakenCareIconPaths[iconName] = path; + } + } + + return treeshakenCareIconPaths; + } + + return { + name: "tree-shake-care-icons", + transform(_src, id) { + if (process.env.NODE_ENV !== "production") { + return; + } + + // Replace the UniconPaths with the tree-shaken version + if (id.endsWith("UniconPaths.json")) { + return { + code: `export default ${JSON.stringify(getTreeShakenUniconPaths())}`, + map: null, + }; + } + }, + }; +} diff --git a/src/CAREUI/display/RecordMeta.tsx b/src/CAREUI/display/RecordMeta.tsx index 5e1e117f9d6..662c61fd73f 100644 --- a/src/CAREUI/display/RecordMeta.tsx +++ b/src/CAREUI/display/RecordMeta.tsx @@ -44,7 +44,7 @@ const RecordMeta = ({ {user && !inlineUser && ( by - + {formatName(user)} {isOnline && (
@@ -61,7 +61,7 @@ const RecordMeta = ({ {prefix} {child} {user && inlineUser && by} - {user && !inlineUser && } + {user && !inlineUser && } {user && inlineUser && ( {formatName(user)} )} diff --git a/src/CAREUI/display/SubHeading.tsx b/src/CAREUI/display/SubHeading.tsx index 75d8710fdef..a9024e83687 100644 --- a/src/CAREUI/display/SubHeading.tsx +++ b/src/CAREUI/display/SubHeading.tsx @@ -18,7 +18,7 @@ export default function SubHeading(props: Props) { {props.lastModified && (
- +
)} diff --git a/src/CAREUI/icons/CareIcon.tsx b/src/CAREUI/icons/CareIcon.tsx index 27a4abe97b4..90a59d972cb 100644 --- a/src/CAREUI/icons/CareIcon.tsx +++ b/src/CAREUI/icons/CareIcon.tsx @@ -6,7 +6,7 @@ import iconData from "./UniconPaths.json"; export type IconName = keyof typeof iconData; export interface CareIconProps { - icon?: IconName; + icon: IconName; className?: string | undefined; onClick?: React.MouseEventHandler | undefined; id?: string; @@ -16,7 +16,7 @@ export interface CareIconProps { * ### CARE's Official Icon Library. * @param className icon class name * @returns icon component - * @example ``` ``` + * @example ``` ``` * * @see [icon library](https://iconscout.com/unicons/) */ diff --git a/src/CAREUI/interactive/FiltersSlideover.tsx b/src/CAREUI/interactive/FiltersSlideover.tsx index 9b2e5a29c29..83f92e2bd90 100644 --- a/src/CAREUI/interactive/FiltersSlideover.tsx +++ b/src/CAREUI/interactive/FiltersSlideover.tsx @@ -36,7 +36,7 @@ export default function FiltersSlideover({ onClick={onClear} id="clear-filter" > - + {t("clear")} @@ -62,7 +62,7 @@ export const AdvancedFilterButton = ({ onClick }: { onClick: () => void }) => { onClick={onClick} id="advanced-filter" > - + {t("advanced_filters")} ); diff --git a/src/CAREUI/interactive/LegendInput.tsx b/src/CAREUI/interactive/LegendInput.tsx index 789412d7635..b057e7772c5 100644 --- a/src/CAREUI/interactive/LegendInput.tsx +++ b/src/CAREUI/interactive/LegendInput.tsx @@ -144,7 +144,8 @@ export default function LegendInput(props: InputProps) { onClick={() => setShowPassword(!showPassword)} > )} diff --git a/src/CAREUI/interactive/SlideOver.tsx b/src/CAREUI/interactive/SlideOver.tsx index 9fae2588fca..a92344c41ba 100644 --- a/src/CAREUI/interactive/SlideOver.tsx +++ b/src/CAREUI/interactive/SlideOver.tsx @@ -116,7 +116,7 @@ export default function SlideOver({ onCloseClick && onCloseClick(); }} > - +

{title}

diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index c5e8880cb50..8ad2e72032c 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -742,7 +742,7 @@ export const GENDER: { [key: number]: string } = GENDER_TYPES.reduce( ); export type CameraPTZ = { - icon?: string; + icon?: IconName; label: string; action: string; loadingLabel?: string; diff --git a/src/Components/ABDM/ABHAProfileModal.tsx b/src/Components/ABDM/ABHAProfileModal.tsx index cc16fd45b8d..be991bb8f55 100644 --- a/src/Components/ABDM/ABHAProfileModal.tsx +++ b/src/Components/ABDM/ABHAProfileModal.tsx @@ -54,11 +54,13 @@ const ABHAProfileModal = ({ patientId, show, onClose, abha }: IProps) => {
downloadAbhaCard("pdf")} - className="care-l-print cursor-pointer" + icon="l-print" + className="cursor-pointer" /> downloadAbhaCard("png")} - className="care-l-import cursor-pointer" + icon="l-import" + className="cursor-pointer" />
diff --git a/src/Components/ABDM/LinkABHANumberModal.tsx b/src/Components/ABDM/LinkABHANumberModal.tsx index 6297b11152f..4aed5e0ee8f 100644 --- a/src/Components/ABDM/LinkABHANumberModal.tsx +++ b/src/Components/ABDM/LinkABHANumberModal.tsx @@ -59,7 +59,7 @@ export default function LinkABHANumberModal({ const title = (
- +

{currentStep === "ScanExistingQR" ? "Link Existing ABHA Number" @@ -752,7 +752,7 @@ const VerifyMobileSection = ({ /> ) : (

- OTP is + OTP is generated if the above phone number is not linked with given Aadhaar number.

@@ -833,7 +833,7 @@ const CreateHealthIDSection = ({ />

- Existing + Existing ABHA Address is used if ABHA Number already exists.

diff --git a/src/Components/Assets/AssetManage.tsx b/src/Components/Assets/AssetManage.tsx index 661043ba697..3e199c9d34e 100644 --- a/src/Components/Assets/AssetManage.tsx +++ b/src/Components/Assets/AssetManage.tsx @@ -271,7 +271,7 @@ const AssetManage = (props: AssetManageProps) => {
- +
{item.label}
@@ -332,7 +332,7 @@ const AssetManage = (props: AssetManageProps) => { ghost border > - + Export as JSON } @@ -357,7 +357,8 @@ const AssetManage = (props: AssetManageProps) => {
{assetClassProp.name}
@@ -397,17 +398,17 @@ const AssetManage = (props: AssetManageProps) => { {[ { label: asset?.location_object.facility.name, - icon: "location-pin-alt", + icon: "l-location-pin-alt", content: asset?.location_object.name, }, { label: "Asset QR Code ID", - icon: "qrcode-scan", + icon: "l-qrcode-scan", content: asset?.qr_code_id, }, { label: "Not working reason", - icon: "exclamation-circle", + icon: "l-exclamation-circle", content: asset?.not_working_reason, hide: asset?.is_working, }, @@ -425,7 +426,7 @@ const AssetManage = (props: AssetManageProps) => { data-testid="asset-update-button" authorizeFor={NonReadOnlyUsers} > - + {t("update")} {asset?.asset_class && @@ -442,7 +443,7 @@ const AssetManage = (props: AssetManageProps) => { id="configure-asset" data-testid="asset-configure-button" > - + {t("configure")} )} @@ -454,7 +455,7 @@ const AssetManage = (props: AssetManageProps) => { data-testid="asset-delete-button" className="inline-flex" > - + {t("delete")} )} @@ -467,14 +468,14 @@ const AssetManage = (props: AssetManageProps) => { {[ { label: "Last serviced on", - icon: "wrench", + icon: "l-wrench", content: asset?.last_service?.serviced_on && formatDate(asset?.last_service?.serviced_on), }, { label: "Notes", - icon: "notes", + icon: "l-notes", content: asset?.last_service?.note, }, ].map(detailBlock)} diff --git a/src/Components/Assets/AssetType/HL7Monitor.tsx b/src/Components/Assets/AssetType/HL7Monitor.tsx index cca0a7571b8..6583157018d 100644 --- a/src/Components/Assets/AssetType/HL7Monitor.tsx +++ b/src/Components/Assets/AssetType/HL7Monitor.tsx @@ -116,7 +116,7 @@ const HL7Monitor = (props: HL7MonitorProps) => { error={ipadrdress_error} /> - + Save Configuration
diff --git a/src/Components/Assets/AssetTypes.tsx b/src/Components/Assets/AssetTypes.tsx index 39fff240efb..e3dee31bb7f 100644 --- a/src/Components/Assets/AssetTypes.tsx +++ b/src/Components/Assets/AssetTypes.tsx @@ -1,3 +1,4 @@ +import { IconName } from "../../CAREUI/icons/CareIcon"; import { BedModel } from "../Facility/models"; import { PerformedByModel } from "../HCX/misc"; import { PatientModel } from "../Patient/models"; @@ -42,25 +43,31 @@ export const AssetStatus = { maintenance: "Under Maintenance", }; -export const assetClassProps = { +export const assetClassProps: { + [key in AssetClass]: { + name: string; + description?: string; + icon: IconName; + }; +} = { ONVIF: { name: "ONVIF Camera", description: "", - icon: "camera", + icon: "l-camera", }, HL7MONITOR: { name: "HL7 Vitals Monitor", description: "", - icon: "monitor-heart-rate", + icon: "l-monitor-heart-rate", }, VENTILATOR: { name: "Ventilator", description: "", - icon: "lungs", + icon: "l-lungs", }, NONE: { name: "N/A", - icon: "box", + icon: "l-box", }, }; diff --git a/src/Components/Assets/AssetWarrantyCard.tsx b/src/Components/Assets/AssetWarrantyCard.tsx index 2e5fa74b9c6..63636fea694 100644 --- a/src/Components/Assets/AssetWarrantyCard.tsx +++ b/src/Components/Assets/AssetWarrantyCard.tsx @@ -1,6 +1,6 @@ -import CareIcon from "../../CAREUI/icons/CareIcon"; +import CareIcon, { IconName } from "../../CAREUI/icons/CareIcon"; import { AssetData } from "./AssetTypes"; -import { classNames, formatDate } from "../../Utils/utils"; +import { formatDate } from "../../Utils/utils"; import CopyToClipboard from "react-copy-to-clipboard"; import { t } from "i18next"; import { useEffect, useState } from "react"; @@ -52,7 +52,7 @@ export default function AssetWarrantyCard(props: { asset: AssetData }) { {t("copied_to_clipboard")} ) : ( - + )} Copy to clipboard @@ -72,8 +72,8 @@ export default function AssetWarrantyCard(props: { asset: AssetData }) {

{[ - ["Phone", asset.support_phone, "phone"], - ["Email", asset.support_email, "envelope"], + ["Phone", asset.support_phone, "l-phone"], + ["Email", asset.support_email, "l-envelope"], ].map((item) => (
{item[1] && ( @@ -85,9 +85,7 @@ export default function AssetWarrantyCard(props: { asset: AssetData }) { } className="border-b border-primary-300 text-primary-300 hover:text-primary-400" > - + {item[1]} diff --git a/src/Components/Assets/AssetsList.tsx b/src/Components/Assets/AssetsList.tsx index 228e940de29..9596ceb7faa 100644 --- a/src/Components/Assets/AssetsList.tsx +++ b/src/Components/Assets/AssetsList.tsx @@ -200,13 +200,14 @@ const AssetsList = () => {

{

- + {asset?.location_object?.name} - + {asset?.location_object?.facility?.name}

@@ -272,7 +279,10 @@ const AssetsList = () => { label: "Import Assets", options: { icon: ( - + ), onClick: () => setImportAssetModalOpen(true), }, @@ -289,7 +299,7 @@ const AssetsList = () => { type: "json", filePrefix: `assets_${facility?.name ?? "all"}`, options: { - icon: , + icon: , disabled: totalCount === 0 || !authorizedForImportExport, id: "export-json-option", }, @@ -306,7 +316,7 @@ const AssetsList = () => { type: "csv", filePrefix: `assets_${facility?.name ?? "all"}`, options: { - icon: , + icon: , disabled: totalCount === 0 || !authorizedForImportExport, id: "export-csv-option", }, @@ -364,7 +374,7 @@ const AssetsList = () => { } }} > - + {t("create_asset")}
diff --git a/src/Components/Auth/Login.tsx b/src/Components/Auth/Login.tsx index 9e2e4f6686a..4c88e6e5aea 100644 --- a/src/Components/Auth/Login.tsx +++ b/src/Components/Auth/Login.tsx @@ -368,7 +368,7 @@ export const Login = (props: { forgot?: boolean }) => { className="mb-4 text-sm text-primary-400 hover:text-primary-500" >
- + {t("back_to_login")}
diff --git a/src/Components/CameraFeed/CentralLiveMonitoring/LiveMonitoringFilters.tsx b/src/Components/CameraFeed/CentralLiveMonitoring/LiveMonitoringFilters.tsx index 628518191de..e2931a816bc 100644 --- a/src/Components/CameraFeed/CentralLiveMonitoring/LiveMonitoringFilters.tsx +++ b/src/Components/CameraFeed/CentralLiveMonitoring/LiveMonitoringFilters.tsx @@ -7,7 +7,6 @@ import useFilters from "../../../Common/hooks/useFilters"; import { Fragment } from "react"; import CareIcon from "../../../CAREUI/icons/CareIcon"; import useSlug from "../../../Common/hooks/useSlug"; -import { classNames } from "../../../Utils/utils"; interface Props { perPageLimit: number; @@ -27,7 +26,7 @@ const LiveMonitoringFilters = (props: Props) => { - + Settings and Filters @@ -112,12 +111,12 @@ const LiveMonitoringFilters = (props: Props) => { className="tooltip !h-11" > {props.isFullscreen ? "Exit Fullscreen" : "Fullscreen"} diff --git a/src/Components/Common/Breadcrumbs.tsx b/src/Components/Common/Breadcrumbs.tsx index b6c39a38ef1..c0f6ab9b349 100644 --- a/src/Components/Common/Breadcrumbs.tsx +++ b/src/Components/Common/Breadcrumbs.tsx @@ -55,7 +55,7 @@ export default function Breadcrumbs(props: any) {
  • - + Home
    diff --git a/src/Components/Common/DateInputV2.tsx b/src/Components/Common/DateInputV2.tsx index bce5f24b11c..47ac41f5d71 100644 --- a/src/Components/Common/DateInputV2.tsx +++ b/src/Components/Common/DateInputV2.tsx @@ -249,7 +249,10 @@ const DateInputV2: React.FC = ({ value={value && dayjs(value).format("DD/MM/YYYY")} />
    - +
    @@ -296,7 +299,7 @@ const DateInputV2: React.FC = ({ className="inline-flex aspect-square cursor-pointer items-center justify-center rounded p-2 transition duration-100 ease-in-out hover:bg-gray-300" onClick={decrement} > - +
    @@ -329,7 +332,7 @@ const DateInputV2: React.FC = ({ className="inline-flex aspect-square cursor-pointer items-center justify-center rounded p-2 transition duration-100 ease-in-out hover:bg-gray-300" onClick={increment} > - +
  • diff --git a/src/Components/Common/Export.tsx b/src/Components/Common/Export.tsx index 6714d8bdb08..e94a2826398 100644 --- a/src/Components/Common/Export.tsx +++ b/src/Components/Common/Export.tsx @@ -63,7 +63,7 @@ export const ExportMenu = ({ } + icon={} className="tooltip border-primary-500 bg-white text-primary-500 hover:bg-primary-100 enabled:border" > {exportItems.map((item) => ( @@ -103,9 +103,9 @@ export const ExportButton = ({ circle > {isExporting ? ( - + ) : ( - + )} {props.tooltip || "Export"} diff --git a/src/Components/Common/GLocationPicker.tsx b/src/Components/Common/GLocationPicker.tsx index fc121b8519f..6fc1a4c2b6c 100644 --- a/src/Components/Common/GLocationPicker.tsx +++ b/src/Components/Common/GLocationPicker.tsx @@ -220,7 +220,10 @@ const Map: React.FC = ({ ref={mapCloseRef} onClick={handleOnClose} > - +
    )} @@ -235,7 +238,10 @@ const Map: React.FC = ({ ) } > - + )} diff --git a/src/Components/Common/LanguageSelector.tsx b/src/Components/Common/LanguageSelector.tsx index 4a4f67b993e..8ae1b187c89 100644 --- a/src/Components/Common/LanguageSelector.tsx +++ b/src/Components/Common/LanguageSelector.tsx @@ -38,7 +38,10 @@ export const LanguageSelector = (props: any) => { ))}
    - +
    ); diff --git a/src/Components/Common/Pagination.tsx b/src/Components/Common/Pagination.tsx index e86c9b7a491..0f988874257 100644 --- a/src/Components/Common/Pagination.tsx +++ b/src/Components/Common/Pagination.tsx @@ -94,12 +94,12 @@ const Pagination = ({ tooltip="Previous" onClick={() => goToPage(currentPage - 1)} disabled={currentPage - 1 <= 0} - children={} + children={} /> } + children={} onClick={() => goToPage(currentPage + 1)} disabled={currentPage + 1 > totalPage} /> @@ -110,7 +110,7 @@ const Pagination = ({ } + children={} onClick={() => goToPage(1)} disabled={currentPage === 1} /> @@ -119,7 +119,7 @@ const Pagination = ({ tooltip="Previous" onClick={() => goToPage(currentPage - 1)} disabled={currentPage - 1 <= 0} - children={} + children={} /> {pageNumbers.map((page) => ( @@ -137,14 +137,16 @@ const Pagination = ({ } + children={} onClick={() => goToPage(currentPage + 1)} disabled={currentPage + 1 > totalPage} /> } + children={ + + } onClick={() => goToPage(totalPage)} disabled={totalPage === 0 || currentPage === totalPage} /> diff --git a/src/Components/Common/QRScanner.tsx b/src/Components/Common/QRScanner.tsx index b4d618ec7dc..4b744ba2eeb 100644 --- a/src/Components/Common/QRScanner.tsx +++ b/src/Components/Common/QRScanner.tsx @@ -73,8 +73,9 @@ const QRScanner = ({ setShowScanner(true)} - className="care-l-focus z-50 cursor-pointer text-black" + className="z-50 cursor-pointer text-black" /> } error={error} diff --git a/src/Components/Common/RelativeDateUserMention.tsx b/src/Components/Common/RelativeDateUserMention.tsx index 2af92268987..70eadc5b7ed 100644 --- a/src/Components/Common/RelativeDateUserMention.tsx +++ b/src/Components/Common/RelativeDateUserMention.tsx @@ -33,7 +33,10 @@ function RelativeDateUserMention(props: {

    {props.user.user_type}

    - + )} diff --git a/src/Components/Common/Sidebar/Sidebar.tsx b/src/Components/Common/Sidebar/Sidebar.tsx index 747fa3949da..c611b26f2e5 100644 --- a/src/Components/Common/Sidebar/Sidebar.tsx +++ b/src/Components/Common/Sidebar/Sidebar.tsx @@ -3,7 +3,7 @@ import { SidebarItem, ShrinkedSidebarItem } from "./SidebarItem"; import SidebarUserCard from "./SidebarUserCard"; import NotificationItem from "../../Notifications/NotificationsList"; import useActiveLink from "../../../Common/hooks/useActiveLink"; -import CareIcon from "../../../CAREUI/icons/CareIcon"; +import CareIcon, { IconName } from "../../../CAREUI/icons/CareIcon"; import useConfig from "../../../Common/hooks/useConfig"; import SlideOver from "../../../CAREUI/interactive/SlideOver"; import { classNames } from "../../../Utils/utils"; @@ -36,26 +36,30 @@ const StatelessSidebar = ({ }: StatelessSidebarProps) => { const authUser = useAuthUser(); - const NavItems = [ - { text: "Facilities", to: "/facility", icon: "care-l-hospital" }, - { text: "Patients", to: "/patients", icon: "care-l-user-injured" }, - { text: "Assets", to: "/assets", icon: "care-l-shopping-cart-alt" }, - { text: "Sample Test", to: "/sample", icon: "care-l-medkit" }, - { text: "Shifting", to: "/shifting", icon: "care-l-ambulance" }, - { text: "Resource", to: "/resource", icon: "care-l-heart-medical" }, + const NavItems: { + text: string; + to: string; + icon: IconName; + }[] = [ + { text: "Facilities", to: "/facility", icon: "l-hospital" }, + { text: "Patients", to: "/patients", icon: "l-user-injured" }, + { text: "Assets", to: "/assets", icon: "l-shopping-cart-alt" }, + { text: "Sample Test", to: "/sample", icon: "l-medkit" }, + { text: "Shifting", to: "/shifting", icon: "l-ambulance" }, + { text: "Resource", to: "/resource", icon: "l-heart-medical" }, ...(!["Nurse", "NurseReadOnly", "Staff", "StaffReadOnly"].includes( authUser.user_type ) - ? [ + ? ([ { text: "External Results", to: "/external_results", - icon: "care-l-clipboard-notes", + icon: "l-clipboard-notes", }, - ] + ] as const) : []), - { text: "Users", to: "/users", icon: "care-l-users-alt" }, - { text: "Notice Board", to: "/notice_board", icon: "care-l-meeting-board" }, + { text: "Users", to: "/users", icon: "l-users-alt" }, + { text: "Notice Board", to: "/notice_board", icon: "l-meeting-board" }, ]; const { main_logo } = useConfig(); @@ -134,7 +138,7 @@ const StatelessSidebar = ({ ref={i.to === activeLink ? activeLinkRef : undefined} key={i.text} {...i} - icon={} + icon={} selected={i.to === activeLink} do={() => onItemClick && onItemClick(false)} handleOverflow={handleOverflow} @@ -151,7 +155,7 @@ const StatelessSidebar = ({ } + icon={} external handleOverflow={handleOverflow} /> diff --git a/src/Components/Common/Sidebar/SidebarItem.tsx b/src/Components/Common/Sidebar/SidebarItem.tsx index 20ffec4217e..90698aa3bbc 100644 --- a/src/Components/Common/Sidebar/SidebarItem.tsx +++ b/src/Components/Common/Sidebar/SidebarItem.tsx @@ -66,7 +66,7 @@ const SidebarItemBase = forwardRef( {t(props.text)} {external && !shrinked && ( - + )} diff --git a/src/Components/Common/Sidebar/SidebarUserCard.tsx b/src/Components/Common/Sidebar/SidebarUserCard.tsx index 75cf2d9ce43..d083867738c 100644 --- a/src/Components/Common/Sidebar/SidebarUserCard.tsx +++ b/src/Components/Common/Sidebar/SidebarUserCard.tsx @@ -16,11 +16,12 @@ const SidebarUserCard = ({ shrinked }: { shrinked: boolean }) => { } transition-all duration-200 ease-in-out`} > - +
    @@ -44,9 +45,8 @@ const SidebarUserCard = ({ shrinked }: { shrinked: boolean }) => { onClick={signOut} >

    {t("sign_out")}

    diff --git a/src/Components/Common/SortDropdown.tsx b/src/Components/Common/SortDropdown.tsx index e979d89375e..b29662de0a7 100644 --- a/src/Components/Common/SortDropdown.tsx +++ b/src/Components/Common/SortDropdown.tsx @@ -24,7 +24,7 @@ export default function SortDropdownMenu(props: Props) { title={props.label ?? t("sort_by")} variant="secondary" className="border border-primary-500 bg-white" - icon={} + icon={} > {props.options.map(({ isAscending, value }) => ( props.onSelect({ ordering: value })} icon={ } > diff --git a/src/Components/Common/Steps.tsx b/src/Components/Common/Steps.tsx index 497682c3bf8..e0b1e03af3f 100644 --- a/src/Components/Common/Steps.tsx +++ b/src/Components/Common/Steps.tsx @@ -29,7 +29,8 @@ export default function Steps(props: { steps: Step[] }) { diff --git a/src/Components/Common/SymptomsSelect.tsx b/src/Components/Common/SymptomsSelect.tsx index e96c8070e3a..f16744b7343 100644 --- a/src/Components/Common/SymptomsSelect.tsx +++ b/src/Components/Common/SymptomsSelect.tsx @@ -51,7 +51,7 @@ export const SymptomsSelect = (props: FormFieldBaseProps) => { if (value.includes(ASYMPTOMATIC_ID) && id !== ASYMPTOMATIC_ID) return (
    - + also unselects Asymptomatic @@ -61,7 +61,7 @@ export const SymptomsSelect = (props: FormFieldBaseProps) => { if (!value.includes(ASYMPTOMATIC_ID) && id === ASYMPTOMATIC_ID) return ( - + {`also unselects the other ${value.length} option(s)`} ); diff --git a/src/Components/Common/TemperatureFormField.tsx b/src/Components/Common/TemperatureFormField.tsx index 4a40781a141..2d81ab3d8df 100644 --- a/src/Components/Common/TemperatureFormField.tsx +++ b/src/Components/Common/TemperatureFormField.tsx @@ -3,7 +3,6 @@ import { FormFieldBaseProps } from "../Form/FormFields/Utils"; import RangeAutocompleteFormField from "../Form/FormFields/RangeAutocompleteFormField"; import CareIcon from "../../CAREUI/icons/CareIcon"; import ButtonV2 from "./components/ButtonV2"; -import { classNames } from "../../Utils/utils"; type TemperatureUnit = "celsius" | "fahrenheit"; @@ -24,31 +23,31 @@ export default function TemperatureFormField(props: Props) { { value: 95, label: "Low", - icon: , + icon: , className: "text-danger-500", }, { value: 96.6, label: "Low", - icon: , + icon: , className: "text-warning-500", }, { value: 97.6, label: "Normal", - icon: , + icon: , className: "text-primary-500", }, { value: 99.6, label: "High", - icon: , + icon: , className: "text-warning-500", }, { value: 101.6, label: "High", - icon: , + icon: , className: "text-danger-500", }, ]} @@ -66,7 +65,10 @@ export default function TemperatureFormField(props: Props) { border onClick={() => setUnit(unit === "celsius" ? "fahrenheit" : "celsius")} > - + } /> diff --git a/src/Components/Common/UpdatableApp.tsx b/src/Components/Common/UpdatableApp.tsx index 8b200d5da0e..1fd44da1672 100644 --- a/src/Components/Common/UpdatableApp.tsx +++ b/src/Components/Common/UpdatableApp.tsx @@ -121,6 +121,7 @@ const UpdateAppPopup = ({ onUpdate }: UpdateAppPopupProps) => {
    {
    - +

    Updated successfully

    diff --git a/src/Components/Common/components/ButtonV2.tsx b/src/Components/Common/components/ButtonV2.tsx index 2f3d3002451..4dc6c71ac82 100644 --- a/src/Components/Common/components/ButtonV2.tsx +++ b/src/Components/Common/components/ButtonV2.tsx @@ -171,7 +171,7 @@ export const Submit = ({ label = "Submit", ...props }: CommonButtonProps) => { type="submit" children={ <> - + {t(label)} } @@ -191,7 +191,7 @@ export const Cancel = ({ label = "Cancel", ...props }: CommonButtonProps) => { border children={ <> - + {t(label)} } diff --git a/src/Components/Common/components/ContactLink.tsx b/src/Components/Common/components/ContactLink.tsx index f78b32863c4..762558f5bb2 100644 --- a/src/Components/Common/components/ContactLink.tsx +++ b/src/Components/Common/components/ContactLink.tsx @@ -12,9 +12,8 @@ export default function ContactLink(props: ContactLinkProps) { className=" flex items-center gap-2 border-b border-blue-500 text-base font-medium tracking-wider text-blue-500" > {props.tel ? props.tel : props.mailto} diff --git a/src/Components/Common/prescription-builder/InvestigationBuilder.tsx b/src/Components/Common/prescription-builder/InvestigationBuilder.tsx index 7cf7e3024ad..6ccef78e6ec 100644 --- a/src/Components/Common/prescription-builder/InvestigationBuilder.tsx +++ b/src/Components/Common/prescription-builder/InvestigationBuilder.tsx @@ -142,7 +142,7 @@ export default function InvestigationBuilder( } > Delete Investigation - +

    diff --git a/src/Components/Common/prescription-builder/ProcedureBuilder.tsx b/src/Components/Common/prescription-builder/ProcedureBuilder.tsx index a42f2bab19d..1c773482464 100644 --- a/src/Components/Common/prescription-builder/ProcedureBuilder.tsx +++ b/src/Components/Common/prescription-builder/ProcedureBuilder.tsx @@ -60,7 +60,7 @@ export default function ProcedureBuilder(props: Props) { } > Delete Procedure - +
    diff --git a/src/Components/ExternalResult/ResultList.tsx b/src/Components/ExternalResult/ResultList.tsx index 88a385394aa..3cedd0fc109 100644 --- a/src/Components/ExternalResult/ResultList.tsx +++ b/src/Components/ExternalResult/ResultList.tsx @@ -245,7 +245,7 @@ export default function ResultList() { label: "Import Results", action: () => navigate("/external_results/upload"), options: { - icon: , + icon: , }, }, ] @@ -259,7 +259,7 @@ export default function ResultList() { ), filePrefix: "external_results", options: { - icon: , + icon: , }, }, ]} diff --git a/src/Components/Facility/AssetCreate.tsx b/src/Components/Facility/AssetCreate.tsx index eba5d89a0b3..a0fa23e74c4 100644 --- a/src/Components/Facility/AssetCreate.tsx +++ b/src/Components/Facility/AssetCreate.tsx @@ -390,7 +390,7 @@ const AssetCreate = (props: AssetProps) => {

    - +

    @@ -673,7 +673,10 @@ const AssetCreate = (props: AssetProps) => { className="ml-1 mt-1 flex h-10 cursor-pointer items-center justify-self-end rounded border border-gray-400 px-4 hover:bg-gray-200" onClick={() => setIsScannerActive(true)} > - +

    diff --git a/src/Components/Facility/BedManagement.tsx b/src/Components/Facility/BedManagement.tsx index d8799f1fbc5..e0d7c99b3b6 100644 --- a/src/Components/Facility/BedManagement.tsx +++ b/src/Components/Facility/BedManagement.tsx @@ -120,7 +120,7 @@ const BedRow = (props: BedRowProps) => { border ghost > - + Edit { tooltip={isOccupied ? "Bed is occupied" : undefined} tooltipClassName="w-full lg:w-auto" > - + Delete @@ -222,7 +222,7 @@ export const BedManagement = (props: BedManagementProps) => { href={`/facility/${facilityId}/location/${locationId}/beds/add`} authorizeFor={NonReadOnlyUsers} > - + Add New Bed(s) diff --git a/src/Components/Facility/CentralNursingStation.tsx b/src/Components/Facility/CentralNursingStation.tsx index e063292cf2f..2b938d2af07 100644 --- a/src/Components/Facility/CentralNursingStation.tsx +++ b/src/Components/Facility/CentralNursingStation.tsx @@ -6,7 +6,6 @@ import Loading from "../Common/Loading"; import Page from "../Common/components/Page"; import ButtonV2 from "../Common/components/ButtonV2"; import CareIcon from "../../CAREUI/icons/CareIcon"; -import { classNames } from "../../Utils/utils"; import { LocationSelect } from "../Common/LocationSelect"; import Pagination from "../Common/Pagination"; import { Popover, Transition } from "@headlessui/react"; @@ -82,7 +81,7 @@ export default function CentralNursingStation({ facilityId }: Props) { - + Settings and Filters @@ -138,10 +137,10 @@ export default function CentralNursingStation({ facilityId }: Props) { optionLabel={({ value }) => t("SortOptions." + value)} optionIcon={({ isAscending }) => ( )} @@ -166,12 +165,12 @@ export default function CentralNursingStation({ facilityId }: Props) { className="tooltip !h-11" > {isFullscreen ? "Exit Fullscreen" : "Fullscreen"} diff --git a/src/Components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx index 69b11a30ed5..470658f4e52 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationInvestigationsTab.tsx @@ -23,7 +23,7 @@ export const ConsultationInvestigationsTab = (props: ConsultationTabProps) => { ) } > - + {t("log_lab_results")} diff --git a/src/Components/Facility/ConsultationDetails/index.tsx b/src/Components/Facility/ConsultationDetails/index.tsx index b422fc8867d..6ce75c6ed70 100644 --- a/src/Components/Facility/ConsultationDetails/index.tsx +++ b/src/Components/Facility/ConsultationDetails/index.tsx @@ -228,7 +228,7 @@ export const ConsultationDetails = (props: any) => { //

    {diagnosis.label}

    //
    // - // + // // //
    // diff --git a/src/Components/Facility/ConsultationDoctorNotes/index.tsx b/src/Components/Facility/ConsultationDoctorNotes/index.tsx index cf0f78a39bb..9d2af1461c1 100644 --- a/src/Components/Facility/ConsultationDoctorNotes/index.tsx +++ b/src/Components/Facility/ConsultationDoctorNotes/index.tsx @@ -143,7 +143,7 @@ const ConsultationDoctorNotes = (props: ConsultationDoctorNotesProps) => { disabled={!patientActive} authorizeFor={NonReadOnlyUsers} > - + diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 70e78ccb3c8..ea49f24871b 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -267,26 +267,26 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { const sections = { "Consultation Details": { - iconClass: "care-l-medkit", + iconClass: "l-medkit", visible: consultationDetailsVisible, ref: consultationDetailsRef, }, Diagnosis: { - iconClass: "care-l-stethoscope", + iconClass: "l-stethoscope", visible: diagnosisVisible, ref: diagnosisRef, }, "Treatment Plan": { - iconClass: "care-l-clipboard-alt", + iconClass: "l-clipboard-alt", visible: treatmentPlanVisible, ref: treatmentPlanRef, }, "Bed Status": { - iconClass: "care-l-bed", + iconClass: "l-bed", visible: bedStatusVisible, ref: bedStatusRef, }, - }; + } as const; useEffect(() => { setCurrentSection((prev) => { @@ -838,7 +838,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { className="col-span-6 -ml-2 mb-6 flex flex-row items-center" ref={section.ref as LegacyRef} > - +