From 64ea59af4b068b6f197f2d4ec83908f6d919c425 Mon Sep 17 00:00:00 2001
From: Onkar Jadhav
Date: Mon, 26 Feb 2024 07:28:52 +0530
Subject: [PATCH 1/4] create vite plugin to treeshake uniconpaths.json
---
src/Components/Assets/AssetManage.tsx | 14 ++--
src/Components/Assets/AssetTypes.tsx | 8 +-
src/Components/Assets/AssetWarrantyCard.tsx | 6 +-
src/Components/Assets/AssetsList.tsx | 2 +-
.../Common/TemperatureFormField.tsx | 3 +-
.../Common/components/ContactLink.tsx | 4 +-
.../Facility/Consultations/Beds.tsx | 2 +-
src/Components/Facility/FacilityHome.tsx | 2 +-
.../Form/FormFields/PhoneNumberFormField.tsx | 12 +--
src/Components/HCX/PolicyEligibilityCheck.tsx | 2 +-
src/Components/Patient/PatientInfoCard.tsx | 10 +--
vite.config.mts | 82 ++++++++++++++++++-
12 files changed, 114 insertions(+), 33 deletions(-)
diff --git a/src/Components/Assets/AssetManage.tsx b/src/Components/Assets/AssetManage.tsx
index b7197dd0562..a7c53a2503c 100644
--- a/src/Components/Assets/AssetManage.tsx
+++ b/src/Components/Assets/AssetManage.tsx
@@ -271,7 +271,7 @@ const AssetManage = (props: AssetManageProps) => {
@@ -357,7 +357,7 @@ const AssetManage = (props: AssetManageProps) => {
{assetClassProp.name}
@@ -397,17 +397,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,
},
@@ -467,14 +467,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/AssetTypes.tsx b/src/Components/Assets/AssetTypes.tsx
index 39fff240efb..f41881fa0f7 100644
--- a/src/Components/Assets/AssetTypes.tsx
+++ b/src/Components/Assets/AssetTypes.tsx
@@ -46,21 +46,21 @@ export const assetClassProps = {
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..fb9848f7308 100644
--- a/src/Components/Assets/AssetWarrantyCard.tsx
+++ b/src/Components/Assets/AssetWarrantyCard.tsx
@@ -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] && (
@@ -86,7 +86,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..df6c1d03e36 100644
--- a/src/Components/Assets/AssetsList.tsx
+++ b/src/Components/Assets/AssetsList.tsx
@@ -200,7 +200,7 @@ const AssetsList = () => {
setUnit(unit === "celsius" ? "fahrenheit" : "celsius")}
>
-
+ {/* icons: care-l-celsius, care-l-fahrenheit */}
+
}
/>
diff --git a/src/Components/Common/components/ContactLink.tsx b/src/Components/Common/components/ContactLink.tsx
index f78b32863c4..3bb890d81e5 100644
--- a/src/Components/Common/components/ContactLink.tsx
+++ b/src/Components/Common/components/ContactLink.tsx
@@ -12,8 +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/Facility/Consultations/Beds.tsx b/src/Components/Facility/Consultations/Beds.tsx
index 32023bc9f5f..4eaeaa28fa4 100644
--- a/src/Components/Facility/Consultations/Beds.tsx
+++ b/src/Components/Facility/Consultations/Beds.tsx
@@ -127,7 +127,7 @@ const Beds = (props: BedsProps) => {
{
const feature = FACILITY_FEATURE_TYPES.find((f) => f.id === featureId);
if (!feature?.icon) return null;
return typeof feature.icon === "string" ? (
-
+
) : (
feature.icon
);
diff --git a/src/Components/Form/FormFields/PhoneNumberFormField.tsx b/src/Components/Form/FormFields/PhoneNumberFormField.tsx
index b6af2bfaa24..e5e6d0fb415 100644
--- a/src/Components/Form/FormFields/PhoneNumberFormField.tsx
+++ b/src/Components/Form/FormFields/PhoneNumberFormField.tsx
@@ -128,11 +128,11 @@ export default function PhoneNumberFormField(props: Props) {
}
const phoneNumberTypeIcons: Record = {
- international_mobile: "globe",
- indian_mobile: "mobile-android",
- mobile: "mobile-android",
- landline: "phone",
- support: "headset",
+ international_mobile: "l-globe",
+ indian_mobile: "l-mobile-android",
+ mobile: "l-mobile-android",
+ landline: "l-phone",
+ support: "l-headset",
};
const PhoneNumberTypesHelp = ({ types }: { types: PhoneNumberType[] }) => (
@@ -141,7 +141,7 @@ const PhoneNumberTypesHelp = ({ types }: { types: PhoneNumberType[] }) => (
diff --git a/src/Components/HCX/PolicyEligibilityCheck.tsx b/src/Components/HCX/PolicyEligibilityCheck.tsx
index 42aa3caa87d..1fbe0a9e197 100644
--- a/src/Components/HCX/PolicyEligibilityCheck.tsx
+++ b/src/Components/HCX/PolicyEligibilityCheck.tsx
@@ -180,7 +180,7 @@ const EligibilityChip = ({ eligible }: { eligible: boolean }) => {
}`}
>
{eligible ? "Eligible" : "Not Eligible"}
diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx
index fe6c7b64895..2e3387133e9 100644
--- a/src/Components/Patient/PatientInfoCard.tsx
+++ b/src/Components/Patient/PatientInfoCard.tsx
@@ -546,7 +546,7 @@ export default function PatientInfoCard(props: {
[
`/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/update`,
"Edit Consultation Details",
- "pen",
+ "l-pen",
patient.is_active &&
consultation?.id &&
!consultation?.discharge_date,
@@ -554,13 +554,13 @@ export default function PatientInfoCard(props: {
[
`/patient/${patient.id}/investigation_reports`,
"Investigation Summary",
- "align-alt",
+ "l-align-alt",
true,
],
[
`/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/treatment-summary`,
"Treatment Summary",
- "file-medical",
+ "l-file-medical",
consultation?.id,
],
]
@@ -570,7 +570,7 @@ export default function PatientInfoCard(props: {
[
`/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/claims`,
"Claims",
- "copy-landscape",
+ "l-copy-landscape",
consultation?.id,
],
]
@@ -611,7 +611,7 @@ export default function PatientInfoCard(props: {
}}
>
{action[1]}
diff --git a/vite.config.mts b/vite.config.mts
index c8eb11c53cf..c208fd2a5d3 100644
--- a/vite.config.mts
+++ b/vite.config.mts
@@ -1,6 +1,83 @@
import { VitePWA } from "vite-plugin-pwa";
-import { defineConfig } from "vite";
+import { Plugin, defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
+import * as fs from "fs";
+import * as path from "path";
+import * as glob from "glob";
+
+interface TreeShakeUniconPathsPluginOptions {
+ iconWhitelist: string[];
+}
+
+export function treeShakeUniconPathsPlugin(
+ options: TreeShakeUniconPathsPluginOptions = { iconWhitelist: [] }
+): Plugin {
+ const rootDir = __dirname; // update this if moving this code to a different file
+ const careLineClassRegex = /\bcare-l-[a-z]+(?:-[a-z]+)*\b/g;
+ const lineIconNameRegex = /"l-[a-z]+(?:-[a-z]+)*"/g;
+ const allUniconPaths = JSON.parse(
+ fs.readFileSync(
+ path.resolve(rootDir, "src/CAREUI/icons/UniconPaths.json"),
+ "utf8"
+ )
+ );
+
+ function extractCareIconNames(file: string): string[] {
+ const fileContent = fs.readFileSync(file, "utf8");
+ const careLineClassNamesMatches =
+ fileContent.match(careLineClassRegex) || [];
+
+ const lineIconNameMatches = fileContent.match(lineIconNameRegex) || [];
+ const careIconNames = careLineClassNamesMatches.map(
+ (careLineClassName) => careLineClassName.slice(5) // remove "care-" prefix
+ );
+ const lineIconNames = lineIconNameMatches.map(
+ (lineIconName) => lineIconName.slice(1, -1) // remove quotes
+ );
+
+ return [...careIconNames, ...lineIconNames];
+ }
+
+ 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);
+ }
+
+ function getTreeShakenUniconPaths() {
+ const usedIcons = [...getAllUsedIconNames(), ...options.iconWhitelist];
+ const treeshakenUniconPaths = {};
+
+ for (const iconName of usedIcons) {
+ const path = allUniconPaths[iconName];
+ if (path === undefined) {
+ throw new Error(`Icon ${iconName} is not found in UniconPaths.json`);
+ } else {
+ treeshakenUniconPaths[iconName] = path;
+ }
+ }
+
+ return treeshakenUniconPaths;
+ }
+
+ return {
+ name: "tree-shake-unicon-paths",
+ transform(_src, id) {
+ if (process.env.NODE_ENV !== "production") {
+ return;
+ }
+ if (id.endsWith("UniconPaths.json")) {
+ return `export default ${JSON.stringify(getTreeShakenUniconPaths())}`;
+ }
+ },
+ };
+}
const cdnUrls =
process.env.CARE_CDN_URL ??
@@ -14,6 +91,9 @@ export default defineConfig({
envPrefix: "REACT_",
plugins: [
react(),
+ treeShakeUniconPathsPlugin({
+ iconWhitelist: ["default"],
+ }),
VitePWA({
strategies: "injectManifest",
srcDir: "src",
From ec0da6018ed8bce2b72c9afdb7cc758b874f4aed Mon Sep 17 00:00:00 2001
From: Onkar Jadhav
Date: Sat, 16 Mar 2024 22:28:33 +0530
Subject: [PATCH 2/4] use icon attribute instead of className
---
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 | 13 ++--
.../Assets/AssetType/HL7Monitor.tsx | 2 +-
src/Components/Assets/AssetTypes.tsx | 9 ++-
src/Components/Assets/AssetWarrantyCard.tsx | 10 ++-
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 | 17 ++---
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 | 20 +++---
.../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 | 4 +-
.../Medicine/ManagePrescriptions.tsx | 4 +-
.../Medicine/MedicineAdministration.tsx | 4 +-
.../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 | 47 +++++++++----
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 ++-
111 files changed, 591 insertions(+), 393 deletions(-)
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 e452ed5abb2..32fe0036890 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 bad0cc02507..3e199c9d34e 100644
--- a/src/Components/Assets/AssetManage.tsx
+++ b/src/Components/Assets/AssetManage.tsx
@@ -271,7 +271,7 @@ const AssetManage = (props: AssetManageProps) => {
@@ -332,7 +332,7 @@ const AssetManage = (props: AssetManageProps) => {
ghost
border
>
-
+
Export as JSON
}
@@ -357,7 +357,8 @@ const AssetManage = (props: AssetManageProps) => {
{assetClassProp.name}
@@ -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")}
)}
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 f41881fa0f7..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,7 +43,13 @@ 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: "",
diff --git a/src/Components/Assets/AssetWarrantyCard.tsx b/src/Components/Assets/AssetWarrantyCard.tsx
index fb9848f7308..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
@@ -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 df6c1d03e36..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 7ddaca115bd..e8aa67b0270 100644
--- a/src/Components/Common/Export.tsx
+++ b/src/Components/Common/Export.tsx
@@ -44,7 +44,7 @@ export const ExportMenu = ({
}
+ icon={}
className="tooltip border-primary-500 bg-white text-primary-500 hover:bg-primary-100 enabled:border"
>
{exportItems.map((item) => (
@@ -84,9 +84,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 b54cbc764dc..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,8 +65,10 @@ export default function TemperatureFormField(props: Props) {
border
onClick={() => setUnit(unit === "celsius" ? "fahrenheit" : "celsius")}
>
- {/* icons: care-l-celsius, care-l-fahrenheit */}
-
+
}
/>
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 3bb890d81e5..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}
>
-
+
-
+
@@ -251,7 +251,7 @@ function UserListItem(props: { user: UserAssignedModel }) {
Copy Phone number
-
+
{user.alt_phone_number}
diff --git a/src/Components/Facility/FacilityCard.tsx b/src/Components/Facility/FacilityCard.tsx
index 6305fec69cf..31627259fbb 100644
--- a/src/Components/Facility/FacilityCard.tsx
+++ b/src/Components/Facility/FacilityCard.tsx
@@ -110,7 +110,10 @@ export const FacilityCard = (props: { facility: any; userType: any }) => {
border
ghost
>
-
+
View CNS
@@ -180,8 +183,9 @@ export const FacilityCard = (props: { facility: any; userType: any }) => {
Live Patients / Total beds
{" "}
0.85
? "text-white"
: "text-primary-600"
@@ -241,7 +245,7 @@ export const FacilityCard = (props: { facility: any; userType: any }) => {
className="h-[38px]"
onClick={(_) => setNotifyModalFor(facility.id)}
>
-
+
Notify
)}
@@ -252,7 +256,7 @@ export const FacilityCard = (props: { facility: any; userType: any }) => {
ghost
className="h-[38px]"
>
-
+
{t("view_faciliy")}
@@ -263,7 +267,7 @@ export const FacilityCard = (props: { facility: any; userType: any }) => {
border
ghost
>
-
+
{t("view_patients")}
{/* */}
diff --git a/src/Components/Facility/FacilityCreate.tsx b/src/Components/Facility/FacilityCreate.tsx
index f52df5e95ee..ab711058204 100644
--- a/src/Components/Facility/FacilityCreate.tsx
+++ b/src/Components/Facility/FacilityCreate.tsx
@@ -752,7 +752,7 @@ export const FacilityCreate = (props: FacilityProps) => {
/>
{showAutoFilledPincode && (
-
+
State and district auto-filled from pincode
@@ -930,7 +930,7 @@ export const FacilityCreate = (props: FacilityProps) => {
id="facility-location-button"
className="tooltip p-2"
>
-
+
Select location from map
diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx
index 2c4759da38c..0f068e72aed 100644
--- a/src/Components/Facility/FacilityHome.tsx
+++ b/src/Components/Facility/FacilityHome.tsx
@@ -38,7 +38,7 @@ export const getFacilityFeatureIcon = (featureId: number) => {
const feature = FACILITY_FEATURE_TYPES.find((f) => f.id === featureId);
if (!feature?.icon) return null;
return typeof feature.icon === "string" ? (
-
+
) : (
feature.icon
);
@@ -315,13 +315,13 @@ export const FacilityHome = (props: any) => {
}
+ icon={}
>
navigate(`/facility/${facilityId}/update`)}
authorizeFor={NonReadOnlyUsers}
- icon={}
+ icon={}
>
Update Facility
@@ -329,14 +329,14 @@ export const FacilityHome = (props: any) => {
id="configure-facility"
onClick={() => navigate(`/facility/${facilityId}/configure`)}
authorizeFor={NonReadOnlyUsers}
- icon={}
+ icon={}
>
Configure Facility
navigate(`/facility/${facilityId}/inventory`)}
- icon={}
+ icon={}
>
Inventory Management
@@ -344,7 +344,9 @@ export const FacilityHome = (props: any) => {
id="location-management"
onClick={() => navigate(`/facility/${facilityId}/location`)}
authorizeFor={NonReadOnlyUsers}
- icon={}
+ icon={
+
+ }
>
Location Management
@@ -354,7 +356,7 @@ export const FacilityHome = (props: any) => {
navigate(`/facility/${facilityId}/resource/new`)
}
authorizeFor={NonReadOnlyUsers}
- icon={}
+ icon={}
>
Resource Request
@@ -362,21 +364,21 @@ export const FacilityHome = (props: any) => {
id="create-assets"
onClick={() => navigate(`/facility/${facilityId}/assets/new`)}
authorizeFor={NonReadOnlyUsers}
- icon={}
+ icon={}
>
Create Asset
navigate(`/assets?facility=${facilityId}`)}
- icon={}
+ icon={}
>
View Assets
navigate(`/facility/${facilityId}/users`)}
- icon={}
+ icon={}
>
View Users
@@ -386,7 +388,7 @@ export const FacilityHome = (props: any) => {
variant="danger"
onClick={() => setOpenDeleteDialog(true)}
className="flex items-center gap-3"
- icon={}
+ icon={}
>
Delete Facility
@@ -402,7 +404,7 @@ export const FacilityHome = (props: any) => {
className="mt-2 flex w-full flex-row justify-center md:w-auto"
onClick={() => navigate(`/facility/${facilityId}/cns`)}
>
-
+
Central Nursing Station
@@ -414,7 +416,7 @@ export const FacilityHome = (props: any) => {
onClick={() => navigate(`/facility/${facilityId}/patient`)}
authorizeFor={NonReadOnlyUsers}
>
-
+
Add Details of a Patient
{
className="mt-2 flex w-full flex-row justify-center md:w-auto"
onClick={() => navigate(`/patients?facility=${facilityId}`)}
>
-
+
View Patients
{
navigate(`/facility/${facilityId}/discharged-patients`)
}
>
-
+
View Discharged Patients
diff --git a/src/Components/Facility/FacilityUsers.tsx b/src/Components/Facility/FacilityUsers.tsx
index 2985649a543..781dbad9e40 100644
--- a/src/Components/Facility/FacilityUsers.tsx
+++ b/src/Components/Facility/FacilityUsers.tsx
@@ -221,7 +221,7 @@ export default function FacilityUsers(props: any) {
})
}
>
-
+
diff --git a/src/Components/Facility/InventoryLog.tsx b/src/Components/Facility/InventoryLog.tsx
index 96dd564d53c..0d8673e6d01 100644
--- a/src/Components/Facility/InventoryLog.tsx
+++ b/src/Components/Facility/InventoryLog.tsx
@@ -139,7 +139,10 @@ export default function InventoryLog(props: any) {
variant="primary"
>
-
+
UnMark
@@ -150,7 +153,10 @@ export default function InventoryLog(props: any) {
variant="danger"
>
-
+
Mark as Accident
@@ -244,7 +250,10 @@ export default function InventoryLog(props: any) {
disabled={saving}
>
-
+
Delete Last Entry
diff --git a/src/Components/Facility/Investigations/InvestigationSuggestions.tsx b/src/Components/Facility/Investigations/InvestigationSuggestions.tsx
index 5e43d13e07e..8bd884831b7 100644
--- a/src/Components/Facility/Investigations/InvestigationSuggestions.tsx
+++ b/src/Components/Facility/Investigations/InvestigationSuggestions.tsx
@@ -182,7 +182,7 @@ export default function ViewInvestigationSuggestions(props: {
investigation.type?.join("_-_")
}
>
-
+
Log Report
@@ -305,7 +305,7 @@ export default function ViewInvestigationSuggestions(props: {
investigation.type?.join("_-_")
}
>
-
+
Log Report
)}
diff --git a/src/Components/Facility/Investigations/InvestigationTable.tsx b/src/Components/Facility/Investigations/InvestigationTable.tsx
index d322698779d..7f56bff21ef 100644
--- a/src/Components/Facility/Investigations/InvestigationTable.tsx
+++ b/src/Components/Facility/Investigations/InvestigationTable.tsx
@@ -101,7 +101,7 @@ export const InvestigationTable = ({
setShowForm((prev) => !prev);
}}
>
- {!showForm && }
+ {!showForm && }
{showForm ? "Cancel" : "Update Details"}
{showForm && (
diff --git a/src/Components/Facility/LocationManagement.tsx b/src/Components/Facility/LocationManagement.tsx
index c6578958ac5..06e0de28d62 100644
--- a/src/Components/Facility/LocationManagement.tsx
+++ b/src/Components/Facility/LocationManagement.tsx
@@ -267,7 +267,7 @@ const Location = ({
className="mt-3 w-full"
href={`location/${id}/beds`}
>
-
+
Manage Beds
@@ -280,7 +280,7 @@ const Location = ({
href={`location/${id}/update`}
authorizeFor={NonReadOnlyUsers}
>
-
+
Edit
@@ -295,7 +295,7 @@ const Location = ({
}
authorizeFor={NonReadOnlyUsers}
>
-
+
Delete
diff --git a/src/Components/Facility/PatientNotesSlideover.tsx b/src/Components/Facility/PatientNotesSlideover.tsx
index 2e04312d277..b3fe50f7c4c 100644
--- a/src/Components/Facility/PatientNotesSlideover.tsx
+++ b/src/Components/Facility/PatientNotesSlideover.tsx
@@ -140,7 +140,10 @@ export default function PatientNotesSlideover(props: PatientNotesProps) {
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded bg-primary-800 text-gray-100 text-opacity-70 hover:bg-primary-700 hover:text-opacity-100"
href={`/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/notes`}
>
-
+
)}
setShow(!show)}
>
-
+
setShowPatientNotesPopup(false)}
>
-
+
);
@@ -223,7 +232,7 @@ export default function PatientNotesSlideover(props: PatientNotesProps) {
disabled={!patientActive}
authorizeFor={NonReadOnlyUsers}
>
-
+
diff --git a/src/Components/Facility/TriageForm.tsx b/src/Components/Facility/TriageForm.tsx
index 32971f1d302..b4d50a73cec 100644
--- a/src/Components/Facility/TriageForm.tsx
+++ b/src/Components/Facility/TriageForm.tsx
@@ -203,7 +203,10 @@ export const TriageForm = ({ facilityId, id }: Props) => {
-
+
A Triage already exist on this date
}
diff --git a/src/Components/Form/AutoCompleteAsync.tsx b/src/Components/Form/AutoCompleteAsync.tsx
index 4ad68e96d73..762c9f2d136 100644
--- a/src/Components/Form/AutoCompleteAsync.tsx
+++ b/src/Components/Form/AutoCompleteAsync.tsx
@@ -109,7 +109,8 @@ const AutoCompleteAsync = (props: Props) => {
{hasSelection && !loading && !required && (
{
e.preventDefault();
onChange(null);
@@ -121,9 +122,12 @@ const AutoCompleteAsync = (props: Props) => {
)}
{loading ? (
-
+
) : (
-
+
)}
@@ -155,7 +159,7 @@ const AutoCompleteAsync = (props: Props) => {
)}
{selected && (
-
+
)}
)}
diff --git a/src/Components/Form/FormFields/Autocomplete.tsx b/src/Components/Form/FormFields/Autocomplete.tsx
index bf3840b2c44..ec5c73024c3 100644
--- a/src/Components/Form/FormFields/Autocomplete.tsx
+++ b/src/Components/Form/FormFields/Autocomplete.tsx
@@ -121,7 +121,7 @@ export const Autocomplete = (props: AutocompleteProps) => {
label: query,
description: undefined,
search: query.toLowerCase(),
- icon: ,
+ icon: ,
value: query,
},
...mappedOptions,
@@ -168,7 +168,8 @@ export const Autocomplete = (props: AutocompleteProps) => {
{value && !props.isLoading && !props.required && (
{
e.preventDefault();
props.onChange(undefined);
@@ -181,9 +182,9 @@ export const Autocomplete = (props: AutocompleteProps) => {
)}
{props.isLoading ? (
-
+
) : (
-
+
)}
diff --git a/src/Components/Form/FormFields/AutocompleteMultiselect.tsx b/src/Components/Form/FormFields/AutocompleteMultiselect.tsx
index 9004dea939d..3dde6941795 100644
--- a/src/Components/Form/FormFields/AutocompleteMultiselect.tsx
+++ b/src/Components/Form/FormFields/AutocompleteMultiselect.tsx
@@ -123,9 +123,9 @@ export const AutocompleteMutliSelect = (
{props.isLoading ? (
-
+
) : (
-
+
)}
@@ -162,7 +162,7 @@ export const AutocompleteMutliSelect = (
Select All
{value.length === filteredOptions.length && (
-
+
)}
@@ -178,7 +178,7 @@ export const AutocompleteMutliSelect = (
{option.label}
{selected && (
-
+
)}
)}
@@ -187,7 +187,7 @@ export const AutocompleteMutliSelect = (
>
) : (
- {!query && }
+ {!query && }
{query ? "No results" : "Type to search"}
)}
@@ -202,7 +202,7 @@ export const AutocompleteMutliSelect = (
const Searching = () => {
return (
-
+
Searching...
);
diff --git a/src/Components/Form/FormFields/PhoneNumberFormField.tsx b/src/Components/Form/FormFields/PhoneNumberFormField.tsx
index 25219b86296..e86076d62af 100644
--- a/src/Components/Form/FormFields/PhoneNumberFormField.tsx
+++ b/src/Components/Form/FormFields/PhoneNumberFormField.tsx
@@ -14,7 +14,7 @@ import {
PhoneNumberValidator,
PhoneNumberType,
} from "../FieldValidators";
-import CareIcon from "../../../CAREUI/icons/CareIcon";
+import CareIcon, { IconName } from "../../../CAREUI/icons/CareIcon";
const phoneCodes: Record = phoneCodesJson;
@@ -115,9 +115,15 @@ export default function PhoneNumberFormField(props: Props) {
{country?.flag ?? "🇮🇳"}
{isOpen ? (
-
+
) : (
-
+
)}
@@ -146,7 +152,7 @@ export default function PhoneNumberFormField(props: Props) {
);
}
-const phoneNumberTypeIcons: Record = {
+const phoneNumberTypeIcons: Record = {
international_mobile: "l-globe",
indian_mobile: "l-mobile-android",
mobile: "l-mobile-android",
@@ -159,10 +165,8 @@ const PhoneNumberTypesHelp = ({ types }: { types: PhoneNumberType[] }) => (
{types.map((type) => (
{type.replace("_", " ")}
diff --git a/src/Components/Form/FormFields/TextFormField.tsx b/src/Components/Form/FormFields/TextFormField.tsx
index 773dddc034b..3f814f27fc1 100644
--- a/src/Components/Form/FormFields/TextFormField.tsx
+++ b/src/Components/Form/FormFields/TextFormField.tsx
@@ -76,7 +76,7 @@ const TextFormField = forwardRef((props: TextFormFieldProps, ref) => {
className="z-5 absolute right-0 top-0 flex h-full items-center px-3 text-xl"
onClick={() => setShowPassword(!showPassword)}
>
-
+
);
diff --git a/src/Components/Form/MultiSelectMenuV2.tsx b/src/Components/Form/MultiSelectMenuV2.tsx
index 7a976b86bb7..96d7f65f8d0 100644
--- a/src/Components/Form/MultiSelectMenuV2.tsx
+++ b/src/Components/Form/MultiSelectMenuV2.tsx
@@ -122,7 +122,10 @@ const MultiSelectMenuV2 = (props: Props) => {
)}
-
+
@@ -142,7 +145,7 @@ const MultiSelectMenuV2 = (props: Props) => {
{option.label}
{(option.icon || option.isSelected) &&
(option.isSelected ? (
-
+
) : (
option.icon
))}
@@ -186,7 +189,7 @@ export const MultiSelectOptionChip = (props: MultiSelectOptionChipProps) => {
className="cursor-pointer rounded-full hover:bg-white"
onClick={props.onRemove}
>
-
+
)}
diff --git a/src/Components/Form/SearchInput.tsx b/src/Components/Form/SearchInput.tsx
index 40855b8b9a6..146cd0d9b4b 100644
--- a/src/Components/Form/SearchInput.tsx
+++ b/src/Components/Form/SearchInput.tsx
@@ -73,7 +73,7 @@ const SearchInput = ({
className={className}
leading={
props.leading || (
-
+
)
}
trailing={
diff --git a/src/Components/Form/SelectMenuV2.tsx b/src/Components/Form/SelectMenuV2.tsx
index 2e277b40b4f..640f3163b9d 100644
--- a/src/Components/Form/SelectMenuV2.tsx
+++ b/src/Components/Form/SelectMenuV2.tsx
@@ -106,7 +106,10 @@ const SelectMenuV2 = (props: SelectMenuProps) => {
{showChevronIcon && (
-
+
)}
@@ -132,7 +135,10 @@ const SelectMenuV2 = (props: SelectMenuProps) => {
{props.optionIcon
? option.icon
: selected && (
-
+
)}
{option.description && (
diff --git a/src/Components/HCX/ClaimCreatedModal.tsx b/src/Components/HCX/ClaimCreatedModal.tsx
index 0b2e4703177..5148792e09e 100644
--- a/src/Components/HCX/ClaimCreatedModal.tsx
+++ b/src/Components/HCX/ClaimCreatedModal.tsx
@@ -41,7 +41,7 @@ export default function ClaimCreatedModal({ claim, ...props }: Props) {
titleAction={
{isMakingClaim && (
-
+
)}
{isMakingClaim
? `Requesting ${use === "Claim" ? "Claim" : "Pre-Authorization"}...`
diff --git a/src/Components/HCX/ClaimsItemsBuilder.tsx b/src/Components/HCX/ClaimsItemsBuilder.tsx
index 867f302a89e..42f1bc08cc8 100644
--- a/src/Components/HCX/ClaimsItemsBuilder.tsx
+++ b/src/Components/HCX/ClaimsItemsBuilder.tsx
@@ -70,7 +70,7 @@ export default function ClaimsItemsBuilder(props: Props) {
disabled={props.disabled}
>
Delete
-
+
)}
diff --git a/src/Components/HCX/CreateClaimCard.tsx b/src/Components/HCX/CreateClaimCard.tsx
index 755c2865747..1d3b3dc4933 100644
--- a/src/Components/HCX/CreateClaimCard.tsx
+++ b/src/Components/HCX/CreateClaimCard.tsx
@@ -153,7 +153,7 @@ export default function CreateClaimCard({
Check Insurance Policy Eligibility
setShowAddPolicy(true)} ghost border>
-
+
Edit Patient Insurance Details
@@ -177,7 +177,7 @@ export default function CreateClaimCard({
setItems([...(items ?? []), { name: "", id: "", price: 0 }])
}
>
-
+
Add Item
@@ -229,7 +229,7 @@ export default function CreateClaimCard({
onClick={handleSubmit}
className="min-w-[200px]"
>
- {isCreating && }
+ {isCreating && }
{isCreating
? `Creating ${use === "claim" ? "Claim" : "Pre-Authorization"}...`
: "Proceed"}
diff --git a/src/Components/HCX/InsuranceDetailsBuilder.tsx b/src/Components/HCX/InsuranceDetailsBuilder.tsx
index 36713e317a2..c507566a259 100644
--- a/src/Components/HCX/InsuranceDetailsBuilder.tsx
+++ b/src/Components/HCX/InsuranceDetailsBuilder.tsx
@@ -105,7 +105,7 @@ const InsuranceDetailEditCard = ({
Policy
Delete
-
+
diff --git a/src/Components/HCX/PatientInsuranceDetailsEditor.tsx b/src/Components/HCX/PatientInsuranceDetailsEditor.tsx
index c11d2266aba..952ee29e6e7 100644
--- a/src/Components/HCX/PatientInsuranceDetailsEditor.tsx
+++ b/src/Components/HCX/PatientInsuranceDetailsEditor.tsx
@@ -111,7 +111,7 @@ export default function PatientInsuranceDetailsEditor({
])
}
>
-
+
Add Insurance Details
@@ -119,7 +119,7 @@ export default function PatientInsuranceDetailsEditor({
{isUpdating ? (
<>
-
+
Updating...
>
) : (
diff --git a/src/Components/HCX/PolicyEligibilityCheck.tsx b/src/Components/HCX/PolicyEligibilityCheck.tsx
index 1fbe0a9e197..a21b3ce611a 100644
--- a/src/Components/HCX/PolicyEligibilityCheck.tsx
+++ b/src/Components/HCX/PolicyEligibilityCheck.tsx
@@ -160,7 +160,7 @@ export default function HCXPolicyEligibilityCheck({
>
{isChecking ? (
<>
-
+
Checking ...
>
) : (
@@ -179,9 +179,7 @@ const EligibilityChip = ({ eligible }: { eligible: boolean }) => {
eligible ? "bg-primary-100 text-primary-500" : "bg-red-500 text-white"
}`}
>
-
+
{eligible ? "Eligible" : "Not Eligible"}
diff --git a/src/Components/Medicine/AdministerMedicine.tsx b/src/Components/Medicine/AdministerMedicine.tsx
index 8798b476b06..66064343baf 100644
--- a/src/Components/Medicine/AdministerMedicine.tsx
+++ b/src/Components/Medicine/AdministerMedicine.tsx
@@ -33,14 +33,14 @@ export default function AdministerMedicine({ prescription, ...props }: Props) {
-
+
{t("administer_medicine")}
>
}
title={t("administer_medicine")}
description={
- Last administered
+ Last administered
{prescription.last_administered_on
? formatDateTime(prescription.last_administered_on)
diff --git a/src/Components/Medicine/ManagePrescriptions.tsx b/src/Components/Medicine/ManagePrescriptions.tsx
index 16e8ffedcb2..12ed0712533 100644
--- a/src/Components/Medicine/ManagePrescriptions.tsx
+++ b/src/Components/Medicine/ManagePrescriptions.tsx
@@ -33,11 +33,11 @@ export default function ManagePrescriptions() {
onClick={() => goBack()}
data-testid="return-to-patient-dashboard"
>
-
+
{t("return_to_patient_dashboard")}
-
+
{t("all_changes_have_been_saved")}
diff --git a/src/Components/Medicine/MedicineAdministration.tsx b/src/Components/Medicine/MedicineAdministration.tsx
index d899a3800fb..8b0c7eb1def 100644
--- a/src/Components/Medicine/MedicineAdministration.tsx
+++ b/src/Components/Medicine/MedicineAdministration.tsx
@@ -105,7 +105,7 @@ export default function MedicineAdministration(props: Props) {
errorClassName="hidden"
/>
-
{" "}
+
{" "}
{t("last_administered")}
{obj.last_administered_on
@@ -180,7 +180,7 @@ export default function MedicineAdministration(props: Props) {
))}
-
+
{t("administer_selected_medicines")}{" "}
{selectedCount > 0 && `(${selectedCount})`}
diff --git a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx
index 40675640411..50a3807b5af 100644
--- a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx
+++ b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx
@@ -129,7 +129,7 @@ export default function MedicineAdministrationTableRow({
}
onClick={() => setShowAdminister(true)}
>
-
+
{t("administer")}
diff --git a/src/Components/Medicine/PrescriptionBuilder.tsx b/src/Components/Medicine/PrescriptionBuilder.tsx
index 39bf9b2f506..5fb12f1f6fd 100644
--- a/src/Components/Medicine/PrescriptionBuilder.tsx
+++ b/src/Components/Medicine/PrescriptionBuilder.tsx
@@ -79,7 +79,7 @@ export default function PrescriptionBuilder({
disabled={disabled}
>
-
+
{t(is_prn ? "add_prn_prescription" : "add_prescription_medication")}
@@ -94,7 +94,7 @@ export default function PrescriptionBuilder({
)}
description={
-
+
{t("modification_caution_note")}
}
diff --git a/src/Components/Medicine/PrescriptionDetailCard.tsx b/src/Components/Medicine/PrescriptionDetailCard.tsx
index 0e1f28e9654..a5b312761c4 100644
--- a/src/Components/Medicine/PrescriptionDetailCard.tsx
+++ b/src/Components/Medicine/PrescriptionDetailCard.tsx
@@ -62,7 +62,7 @@ export default function PrescriptionDetailCard({
ghost
border
>
-
+
{t("administer")}
-
+
{t("discontinue")}
diff --git a/src/Components/Medicine/PrescriptionsTable.tsx b/src/Components/Medicine/PrescriptionsTable.tsx
index a1b039e71dd..28b73c7d11b 100644
--- a/src/Components/Medicine/PrescriptionsTable.tsx
+++ b/src/Components/Medicine/PrescriptionsTable.tsx
@@ -115,7 +115,7 @@ export default function PrescriptionsTable({
variant="danger"
onClick={() => setShowDiscontinueFor(detailedViewFor)}
>
-
+
{t("discontinue")}
setShowAdministerFor(detailedViewFor)}
>
-
+
{t("administer")}
@@ -138,7 +138,7 @@ export default function PrescriptionsTable({
{is_prn ? "PRN Prescriptions" : "Prescriptions"}
-
+
{lastModified && formatDateTime(lastModified)}
@@ -153,7 +153,7 @@ export default function PrescriptionsTable({
href="prescriptions"
className="w-full lg:w-auto"
>
-
+
{t("edit_prescriptions")}
{t("edit")}
@@ -164,7 +164,7 @@ export default function PrescriptionsTable({
onClick={() => setShowBulkAdminister(true)}
className="w-full lg:w-auto"
>
-
+
{t("administer_medicines")}
@@ -218,7 +218,7 @@ export default function PrescriptionsTable({
if (med.discontinued) {
return (
-
+
{t("discontinued")}
);
@@ -237,7 +237,7 @@ export default function PrescriptionsTable({
setShowAdministerFor(med);
}}
>
-
+
{t("administer")}
-
+
{t("discontinue")}
diff --git a/src/Components/Notifications/NoticeBoard.tsx b/src/Components/Notifications/NoticeBoard.tsx
index 8ad3afba0f8..7835f8576b7 100644
--- a/src/Components/Notifications/NoticeBoard.tsx
+++ b/src/Components/Notifications/NoticeBoard.tsx
@@ -42,7 +42,7 @@ export const NoticeBoard = () => {
notices = (
-
+
No Notice Available
diff --git a/src/Components/Notifications/NotificationsList.tsx b/src/Components/Notifications/NotificationsList.tsx
index 1ce23dafdbc..95093743080 100644
--- a/src/Components/Notifications/NotificationsList.tsx
+++ b/src/Components/Notifications/NotificationsList.tsx
@@ -121,11 +121,8 @@ const NotificationTile = ({
}}
>
{t("mark_as_read")}
@@ -134,7 +131,7 @@ const NotificationTile = ({
ghost
className="shrink-0 bg-white px-2 py-1 font-semibold hover:bg-secondary-300"
>
-
+
{t("open")}
@@ -212,21 +209,21 @@ export default function NotificationsList({
if (status === "NotSubscribed") {
return (
<>
-
+
{t("subscribe")}
>
);
} else if (status === "SubscribedOnAnotherDevice") {
return (
<>
-
+
{t("subscribe_on_this_device")}
>
);
} else {
return (
<>
-
+
{t("unsubscribe")}
>
);
@@ -414,7 +411,7 @@ export default function NotificationsList({
- setOpen(!open)}
- icon={}
+ icon={}
badgeCount={unreadCount}
handleOverflow={handleOverflow}
/>
@@ -438,7 +435,7 @@ export default function NotificationsList({
setOffset(0);
}}
>
-
+
{t("reload")}
{t("mark_all_as_read")}
@@ -470,9 +464,7 @@ export default function NotificationsList({
variant="secondary"
onClick={() => setShowUnread(!showUnread)}
>
-
+
{showUnread
diff --git a/src/Components/Patient/FileUpload.tsx b/src/Components/Patient/FileUpload.tsx
index 1b1ee8f67dd..bfb318418ca 100644
--- a/src/Components/Patient/FileUpload.tsx
+++ b/src/Components/Patient/FileUpload.tsx
@@ -629,7 +629,10 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
- {" "}
+ {" "}
DOWNLOAD
{item?.uploaded_by?.username === authUser.username ||
@@ -647,7 +650,7 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
-
+
RENAME
>
@@ -669,7 +672,7 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
-
+
ARCHIVE
>
@@ -762,7 +765,7 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
-
+
RENAME
>
@@ -782,7 +785,7 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
-
+
ARCHIVE
>
@@ -872,7 +875,8 @@ export const FileUpload = (props: FileUploadProps) => {
{" "}
- FILE ARCHIVED
+ FILE
+ ARCHIVED
{
@@ -886,7 +890,7 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="m-1 w-full sm:w-auto"
>
-
+
MORE DETAILS
@@ -1144,7 +1148,10 @@ export const FileUpload = (props: FileUploadProps) => {
title={
-
+
Camera
@@ -1239,7 +1246,7 @@ export const FileUpload = (props: FileUploadProps) => {
-
+
{`${t("switch")} ${t("camera")}`}
@@ -1254,7 +1261,7 @@ export const FileUpload = (props: FileUploadProps) => {
captureImage();
}}
>
-
+
{t("capture")}
@@ -1299,7 +1306,10 @@ export const FileUpload = (props: FileUploadProps) => {
title={
-
+
Rename File
@@ -1343,7 +1353,10 @@ export const FileUpload = (props: FileUploadProps) => {
title={
-
+
Archive File
@@ -1390,7 +1403,10 @@ export const FileUpload = (props: FileUploadProps) => {
title={
-
+
File Details
@@ -1464,7 +1480,7 @@ export const FileUpload = (props: FileUploadProps) => {
deleteAudioBlob();
}}
>
- Delete
+ Delete
)}
@@ -1477,7 +1493,10 @@ export const FileUpload = (props: FileUploadProps) => {
/>
{!audioBlobExists && (
-
+
Please allow browser permission before you start
speaking
@@ -1491,7 +1510,7 @@ export const FileUpload = (props: FileUploadProps) => {
}}
className="w-full"
>
-
+
Save
@@ -1526,7 +1545,10 @@ export const FileUpload = (props: FileUploadProps) => {
{({ isAuthorized }) =>
isAuthorized ? (
diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx
index 220165e9e4c..4ae163d4271 100644
--- a/src/Components/Patient/ManagePatients.tsx
+++ b/src/Components/Patient/ManagePatients.tsx
@@ -503,7 +503,10 @@ export const PatientManager = () => {
) : patient.last_consultation?.suggestion === "DC" ? (
-
+
Domiciliary Care
@@ -744,7 +747,7 @@ export const PatientManager = () => {
}}
className="w-full lg:w-fit"
>
-
+
Add Patient Details
@@ -773,7 +776,7 @@ export const PatientManager = () => {
setShowDoctors(true);
}}
>
-
+
Doctor Connect
)}
@@ -803,7 +806,7 @@ export const PatientManager = () => {
}}
className="mr-5 w-full lg:w-fit"
>
-
+
Export
) : (
diff --git a/src/Components/Patient/PatientFilter.tsx b/src/Components/Patient/PatientFilter.tsx
index 6392c5c4d45..0275710444a 100644
--- a/src/Components/Patient/PatientFilter.tsx
+++ b/src/Components/Patient/PatientFilter.tsx
@@ -599,7 +599,7 @@ export default function PatientFilter(props: any) {
setFilterState({ ...filterState, facility_type: v })
}
optionIcon={() => (
-
+
)}
/>
@@ -675,7 +675,7 @@ export default function PatientFilter(props: any) {
optionValue={({ id }) => id}
optionIcon={({ id }) => (
<>
-
+
{id}
>
)}
diff --git a/src/Components/Patient/PatientHome.tsx b/src/Components/Patient/PatientHome.tsx
index 841a8d31ddf..d3b4f75b1a8 100644
--- a/src/Components/Patient/PatientHome.tsx
+++ b/src/Components/Patient/PatientHome.tsx
@@ -636,7 +636,7 @@ export const PatientHome = (props: any) => {
)
}
>
-
+
Update Details
@@ -653,7 +653,7 @@ export const PatientHome = (props: any) => {
}
authorizeFor={NonReadOnlyUsers}
>
-
+
{patientData.allow_transfer
? "Disable Transfer"
: "Allow Transfer"}
@@ -673,9 +673,9 @@ export const PatientHome = (props: any) => {
>
Shifting
{showShifts ? (
-
+
) : (
-
+
)}
{
title="Shifting status"
className="flex items-center text-sm font-semibold leading-5 text-zinc-400"
>
-
+
{shift.status}
@@ -726,7 +729,10 @@ export const PatientHome = (props: any) => {
title=" Origin facility"
className="flex items-center text-sm font-semibold leading-5 text-zinc-400"
>
-
+
{(shift.origin_facility_object || {})?.name}
@@ -737,7 +743,10 @@ export const PatientHome = (props: any) => {
title="Shifting approving facility"
className="flex items-center text-sm font-semibold leading-5 text-zinc-400"
>
-
+
{
(
@@ -753,7 +762,10 @@ export const PatientHome = (props: any) => {
title=" Assigned facility"
className="flex items-center text-sm font-semibold leading-5 text-zinc-400"
>
-
+
{(shift.assigned_facility_object || {})?.name ||
"Yet to be decided"}
@@ -773,7 +785,10 @@ export const PatientHome = (props: any) => {
: "rounded p-1 font-normal text-red-600")
}
>
-
+
{formatDateTime(shift.modified_date) || "--"}
@@ -789,7 +804,7 @@ export const PatientHome = (props: any) => {
navigate(`/shifting/${shift.external_id}`)
}
>
-
+
All Details
@@ -1017,7 +1032,10 @@ export const PatientHome = (props: any) => {
)}
>
-
+
@@ -1035,7 +1053,7 @@ export const PatientHome = (props: any) => {
-
+
@@ -1056,7 +1074,7 @@ export const PatientHome = (props: any) => {
-
+
@@ -1089,7 +1107,7 @@ export const PatientHome = (props: any) => {
} text-center `}
>
-
+
@@ -1131,7 +1149,7 @@ export const PatientHome = (props: any) => {
} text-center `}
>
-
+
@@ -1157,7 +1175,7 @@ export const PatientHome = (props: any) => {
-
+
@@ -1192,7 +1210,7 @@ export const PatientHome = (props: any) => {
)}
>
-
+
@@ -1231,7 +1249,7 @@ export const PatientHome = (props: any) => {
}
>
-
+
Add Consultation
@@ -1244,7 +1262,7 @@ export const PatientHome = (props: any) => {
}
>
-
+
Investigations Summary
@@ -1259,7 +1277,7 @@ export const PatientHome = (props: any) => {
}
>
-
+
View/Upload Patient Files
@@ -1276,7 +1294,7 @@ export const PatientHome = (props: any) => {
authorizeFor={NonReadOnlyUsers}
>
-
+
Shift Patient
@@ -1293,7 +1311,7 @@ export const PatientHome = (props: any) => {
authorizeFor={NonReadOnlyUsers}
>
-
+
Request Sample Test
@@ -1308,7 +1326,7 @@ export const PatientHome = (props: any) => {
}
>
-
+
View Patient Notes
@@ -1321,7 +1339,7 @@ export const PatientHome = (props: any) => {
authorizeFor={NonReadOnlyUsers}
>
-
+
Assign to a volunteer
diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx
index 4b38ee9d183..89366b44973 100644
--- a/src/Components/Patient/PatientInfoCard.tsx
+++ b/src/Components/Patient/PatientInfoCard.tsx
@@ -324,7 +324,10 @@ export default function PatientInfoCard(props: {
@@ -522,7 +525,7 @@ export default function PatientInfoCard(props: {
className="w-full"
>
-
+
Log Update
@@ -534,8 +537,8 @@ export default function PatientInfoCard(props: {
<>
- {" "}
- No update filed in the last 24 hours
+ No update
+ filed in the last 24 hours
>
@@ -620,7 +623,8 @@ export default function PatientInfoCard(props: {
}}
>
{action[1]}
@@ -655,7 +659,10 @@ export default function PatientInfoCard(props: {
});
}}
>
-
+
Show ABHA Profile
-
+
Link Care Context
>
@@ -688,7 +698,10 @@ export default function PatientInfoCard(props: {
}}
>
-
+
Link ABHA Number
@@ -716,7 +729,10 @@ export default function PatientInfoCard(props: {
}}
>
-
+
Track Shifting
@@ -731,7 +747,10 @@ export default function PatientInfoCard(props: {
}}
>
-
+
Shift Patient
@@ -750,7 +769,10 @@ export default function PatientInfoCard(props: {
}}
>
-
+
{t("discharge_summary")}
@@ -772,7 +794,8 @@ export default function PatientInfoCard(props: {
>
{
disabled={!patientActive}
authorizeFor={NonReadOnlyUsers}
>
-
+
diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx
index efc269fa00c..eb2f3ee4991 100644
--- a/src/Components/Patient/PatientRegister.tsx
+++ b/src/Components/Patient/PatientRegister.tsx
@@ -1054,7 +1054,10 @@ export const PatientRegister = (props: PatientRegisterProps) => {
- {" "}
+ {" "}
Please enter the correct date of birth for the patient
@@ -1156,7 +1159,7 @@ export const PatientRegister = (props: PatientRegisterProps) => {
setQuery({ extId: "" }, { replace: true });
}}
>
-
+
Import From External Results
@@ -1532,7 +1535,10 @@ export const PatientRegister = (props: PatientRegisterProps) => {
+
}
title={
@@ -1866,7 +1872,7 @@ export const PatientRegister = (props: PatientRegisterProps) => {
}
data-testid="add-insurance-button"
>
-
+
Add Insurance Details
diff --git a/src/Components/Patient/SampleViewAdmin.tsx b/src/Components/Patient/SampleViewAdmin.tsx
index 122f82aa7e2..431fc09a317 100644
--- a/src/Components/Patient/SampleViewAdmin.tsx
+++ b/src/Components/Patient/SampleViewAdmin.tsx
@@ -199,7 +199,10 @@ export default function SampleViewAdmin() {
Contact:{" "}
Confirmed carrier
-
+
)}
{item.patient_has_suspected_contact &&
@@ -209,7 +212,10 @@ export default function SampleViewAdmin() {
Contact:{" "}
Suspected carrier
-
+
)}
{item.has_sari && (
@@ -218,14 +224,20 @@ export default function SampleViewAdmin() {
SARI:{" "}
Severe Acute Respiratory illness
-
+
)}
{item.has_ari && !item.has_sari && (
ARI:
Acute Respiratory illness
-
+
)}
diff --git a/src/Components/Patient/UpdateStatusDialog.tsx b/src/Components/Patient/UpdateStatusDialog.tsx
index 064e19ff2ee..c547a1b85ff 100644
--- a/src/Components/Patient/UpdateStatusDialog.tsx
+++ b/src/Components/Patient/UpdateStatusDialog.tsx
@@ -215,7 +215,7 @@ const UpdateStatusDialog = (props: Props) => {
) : (
diff --git a/src/Components/Resource/ListView.tsx b/src/Components/Resource/ListView.tsx
index 2cf8b9eb26d..680015b16f2 100644
--- a/src/Components/Resource/ListView.tsx
+++ b/src/Components/Resource/ListView.tsx
@@ -181,7 +181,7 @@ export default function ListView() {
-
+
{t("board_view")}
diff --git a/src/Components/Resource/ResourceBoardView.tsx b/src/Components/Resource/ResourceBoardView.tsx
index 558cd77c1f0..6c02d932f77 100644
--- a/src/Components/Resource/ResourceBoardView.tsx
+++ b/src/Components/Resource/ResourceBoardView.tsx
@@ -76,7 +76,7 @@ export default function BoardView() {
/>
-
+
{t("list_view")}
navigate("/shifting/list", { query: qParams })}
>
-
+
{t("list_view")}
navigate("/shifting/board", { query: qParams })}
>
-
+
{t("board_view")}
diff --git a/src/Components/Users/ManageUsers.tsx b/src/Components/Users/ManageUsers.tsx
index dbfca3a815a..ef3d4f00a3f 100644
--- a/src/Components/Users/ManageUsers.tsx
+++ b/src/Components/Users/ManageUsers.tsx
@@ -392,7 +392,7 @@ export default function ManageUsers() {
setSelectedUser(user);
}}
>
-
+
Linked Facilities
-
+
Linked Skills
@@ -420,7 +420,7 @@ export default function ManageUsers() {
setWeeklyHours(user.weekly_working_hours);
}}
>
-
+
Set Average weekly working hours
@@ -736,7 +736,7 @@ function UserFacilities(props: { user: any }) {
})
}
>
-
+
{t("clear_home_facility")}
@@ -791,7 +791,7 @@ function UserFacilities(props: { user: any }) {
}
}}
>
-
+
Set as home facility
@@ -808,7 +808,7 @@ function UserFacilities(props: { user: any }) {
})
}
>
-
+
Unlink Facility
diff --git a/src/Components/Users/SkillsSlideOverComponents.tsx b/src/Components/Users/SkillsSlideOverComponents.tsx
index d03de928c74..428c5cac5aa 100644
--- a/src/Components/Users/SkillsSlideOverComponents.tsx
+++ b/src/Components/Users/SkillsSlideOverComponents.tsx
@@ -52,7 +52,7 @@ export const SkillsArray = ({
disabled={isLoading || !authorizeForAddSkill}
onClick={() => setDeleteSkill(skill)}
>
-
+
diff --git a/src/Components/Users/UserProfile.tsx b/src/Components/Users/UserProfile.tsx
index 34452a367de..e6ab784e198 100644
--- a/src/Components/Users/UserProfile.tsx
+++ b/src/Components/Users/UserProfile.tsx
@@ -441,7 +441,7 @@ export default function UserProfile() {
{showEdit ? "Cancel" : "Edit User Profile"}
-
+
Sign out
@@ -832,7 +832,7 @@ export default function UserProfile() {
-
+
Update available
@@ -847,8 +847,9 @@ export default function UserProfile() {
{" "}
diff --git a/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx b/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx
index 268e6c91ffa..9bd01fea4e6 100644
--- a/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx
+++ b/src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx
@@ -149,7 +149,10 @@ export default function HL7PatientVitalsMonitor(props: IVitalsComponentProps) {
)}
style={waveformCanvas.size}
>
-
+
No incoming data from HL7 Monitor
-
+
No incoming data from Ventilator
-
+
@@ -64,7 +68,7 @@ const VitalsMonitorAssetPopover = ({
id="configure-asset"
data-testid="asset-configure-button"
>
-
+
{t("configure")}
diff --git a/src/Components/VitalsMonitor/VitalsMonitorHeader.tsx b/src/Components/VitalsMonitor/VitalsMonitorHeader.tsx
index 2f9df8607b0..8fa272d4058 100644
--- a/src/Components/VitalsMonitor/VitalsMonitorHeader.tsx
+++ b/src/Components/VitalsMonitor/VitalsMonitorHeader.tsx
@@ -21,7 +21,7 @@ const VitalsMonitorHeader = ({ patientAssetBed }: VitalsMonitorHeaderProps) => {
) : (
-
+
No Patient
)}
@@ -39,11 +39,14 @@ const VitalsMonitorHeader = ({ patientAssetBed }: VitalsMonitorHeaderProps) => {
href={`/facility/${patient?.facility_object?.id}/location/${bed?.location_object?.id}/beds`}
>
-
+
{bed.name}
-
+
{bed.location_object?.name}
diff --git a/src/Utils/VoiceRecorder.tsx b/src/Utils/VoiceRecorder.tsx
index f816a700154..ab14738df89 100644
--- a/src/Utils/VoiceRecorder.tsx
+++ b/src/Utils/VoiceRecorder.tsx
@@ -42,7 +42,10 @@ export const VoiceRecorder = (props: any) => {
<>
-
+
{t("recording") + "..."}
{
confirmAudioBlobExists();
}}
>
-
+
{t("stop")}
@@ -68,7 +71,7 @@ export const VoiceRecorder = (props: any) => {
authorizeFor={NonReadOnlyUsers}
className="w-full md:w-fit"
>
-
+
{t("record")}
)}
From 0bcc32bf3bf96041ba9332cd2a4ec3985e137f2d Mon Sep 17 00:00:00 2001
From: Onkar Jadhav
Date: Sun, 17 Mar 2024 15:16:50 +0530
Subject: [PATCH 3/4] Update the plugin code with comments. Also no longer need
to check for icon names in className
---
vite.config.mts | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/vite.config.mts b/vite.config.mts
index c208fd2a5d3..4c6f537220e 100644
--- a/vite.config.mts
+++ b/vite.config.mts
@@ -5,15 +5,26 @@ 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.
+ */
interface TreeShakeUniconPathsPluginOptions {
iconWhitelist: string[];
}
+/**
+ * Creates a Webpack plugin that tree-shakes unused Unicon paths from UniconPaths.json in production builds.
+ *
+ * @param {TreeShakeUniconPathsPluginOptions} [options] - Optional configuration options. Defaults to an empty iconWhitelist.
+ * @returns {Plugin} Webpack plugin object.
+ */
export function treeShakeUniconPathsPlugin(
options: TreeShakeUniconPathsPluginOptions = { iconWhitelist: [] }
): Plugin {
const rootDir = __dirname; // update this if moving this code to a different file
- const careLineClassRegex = /\bcare-l-[a-z]+(?:-[a-z]+)*\b/g;
const lineIconNameRegex = /"l-[a-z]+(?:-[a-z]+)*"/g;
const allUniconPaths = JSON.parse(
fs.readFileSync(
@@ -22,22 +33,20 @@ export function treeShakeUniconPathsPlugin(
)
);
+ // 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 careLineClassNamesMatches =
- fileContent.match(careLineClassRegex) || [];
const lineIconNameMatches = fileContent.match(lineIconNameRegex) || [];
- const careIconNames = careLineClassNamesMatches.map(
- (careLineClassName) => careLineClassName.slice(5) // remove "care-" prefix
- );
+
const lineIconNames = lineIconNameMatches.map(
(lineIconName) => lineIconName.slice(1, -1) // remove quotes
);
- return [...careIconNames, ...lineIconNames];
+ 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[] = [];
@@ -49,7 +58,7 @@ export function treeShakeUniconPathsPlugin(
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 treeshakenUniconPaths = {};
@@ -72,8 +81,13 @@ export function treeShakeUniconPathsPlugin(
if (process.env.NODE_ENV !== "production") {
return;
}
+
+ // Replace the UniconPaths with the tree-shaken version
if (id.endsWith("UniconPaths.json")) {
- return `export default ${JSON.stringify(getTreeShakenUniconPaths())}`;
+ return {
+ code: `export default ${JSON.stringify(getTreeShakenUniconPaths())}`,
+ map: null,
+ };
}
},
};
From 98be4af233d93fbf47ad254146d55c2be00d1cca Mon Sep 17 00:00:00 2001
From: Onkar Jadhav
Date: Sun, 17 Mar 2024 21:35:37 +0530
Subject: [PATCH 4/4] Rename plugin
---
plugins/treeShakeCareIcons.mts | 94 +++++++++++++++++++++++++++++++++
vite.config.mts | 96 ++--------------------------------
2 files changed, 97 insertions(+), 93 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/vite.config.mts b/vite.config.mts
index 4c6f537220e..9285f495850 100644
--- a/vite.config.mts
+++ b/vite.config.mts
@@ -1,97 +1,7 @@
import { VitePWA } from "vite-plugin-pwa";
-import { Plugin, defineConfig } from "vite";
+import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
-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.
- */
-interface TreeShakeUniconPathsPluginOptions {
- iconWhitelist: string[];
-}
-
-/**
- * Creates a Webpack plugin that tree-shakes unused Unicon paths from UniconPaths.json in production builds.
- *
- * @param {TreeShakeUniconPathsPluginOptions} [options] - Optional configuration options. Defaults to an empty iconWhitelist.
- * @returns {Plugin} Webpack plugin object.
- */
-export function treeShakeUniconPathsPlugin(
- options: TreeShakeUniconPathsPluginOptions = { iconWhitelist: [] }
-): Plugin {
- const rootDir = __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 treeshakenUniconPaths = {};
-
- for (const iconName of usedIcons) {
- const path = allUniconPaths[iconName];
- if (path === undefined) {
- throw new Error(`Icon ${iconName} is not found in UniconPaths.json`);
- } else {
- treeshakenUniconPaths[iconName] = path;
- }
- }
-
- return treeshakenUniconPaths;
- }
-
- return {
- name: "tree-shake-unicon-paths",
- 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,
- };
- }
- },
- };
-}
+import { treeShakeCareIcons } from "./plugins/treeShakeCareIcons.mts";
const cdnUrls =
process.env.CARE_CDN_URL ??
@@ -105,7 +15,7 @@ export default defineConfig({
envPrefix: "REACT_",
plugins: [
react(),
- treeShakeUniconPathsPlugin({
+ treeShakeCareIcons({
iconWhitelist: ["default"],
}),
VitePWA({