Skip to content

Commit

Permalink
add text
Browse files Browse the repository at this point in the history
  • Loading branch information
modamaan committed Nov 23, 2024
1 parent df00093 commit 448d7bb
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 106 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
],
"rules": {
"no-unused-vars": "off",
"prettier/prettier":0,
"@typescript-eslint/no-unused-vars": [
"error",
{
Expand Down
34 changes: 34 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@
"@googlemaps/typescript-guards": "^2.0.3",
"@headlessui/react": "^2.2.0",
"@hello-pangea/dnd": "^17.0.0",
"@heroicons/react": "^2.1.5",
"@pnotify/core": "^5.2.0",
"@pnotify/mobile": "^5.2.0",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-icons": "^1.3.1",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-toast": "^1.2.2",
"@radix-ui/react-tooltip": "^1.1.3",
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Toaster } from "@/components/ui/toaster";
import Loading from "@/components/Common/Loading";

import Integrations from "@/Integrations";
import PluginEngine from "@/PluginEngine";
// import PluginEngine from "@/PluginEngine";
import AuthUserProvider from "@/Providers/AuthUserProvider";
import HistoryAPIProvider from "@/Providers/HistoryAPIProvider";
import Routers from "@/Routers";
Expand Down
114 changes: 57 additions & 57 deletions src/PluginEngine.tsx
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
/* eslint-disable i18next/no-literal-string */
import React, { Suspense } from "react";

import ErrorBoundary from "@/components/Common/ErrorBoundary";
import Loading from "@/components/Common/Loading";

import { CareAppsContext, useCareApps } from "@/hooks/useCareApps";

import { SupportedPluginComponents, pluginMap } from "@/pluginTypes";

export default function PluginEngine({
children,
}: {
children: React.ReactNode;
}) {
return (
<Suspense fallback={<Loading />}>
<ErrorBoundary
fallback={
<div className="flex h-screen w-screen items-center justify-center">
Error loading plugins
</div>
}
>
<CareAppsContext.Provider value={pluginMap}>
{children}
</CareAppsContext.Provider>
</ErrorBoundary>
</Suspense>
);
}

type PluginProps<K extends keyof SupportedPluginComponents> =
React.ComponentProps<SupportedPluginComponents[K]>;

export function PLUGIN_Component<K extends keyof SupportedPluginComponents>({
__name,
...props
}: { __name: K } & PluginProps<K>) {
const plugins = useCareApps();

return (
<>
{plugins.map((plugin) => {
const Component = plugin.components[
__name
] as React.ComponentType<unknown>;

if (!Component) {
return null;
}

return <Component {...props} key={plugin.plugin} />;
})}
</>
);
}
// /* eslint-disable i18next/no-literal-string */
// import React, { Suspense } from "react";

// import ErrorBoundary from "@/components/Common/ErrorBoundary";
// import Loading from "@/components/Common/Loading";

// import { CareAppsContext, useCareApps } from "@/hooks/useCareApps";

// // import { SupportedPluginComponents, pluginMap } from "@/pluginTypes";

// export default function PluginEngine({
// children,
// }: {
// children: React.ReactNode;
// }) {
// return (
// <Suspense fallback={<Loading />}>
// <ErrorBoundary
// fallback={
// <div className="flex h-screen w-screen items-center justify-center">
// Error loading plugins
// </div>
// }
// >
// <CareAppsContext.Provider value={pluginMap}>
// {children}
// </CareAppsContext.Provider>
// </ErrorBoundary>
// </Suspense>
// );
// }

// type PluginProps<K extends keyof SupportedPluginComponents> =
// React.ComponentProps<SupportedPluginComponents[K]>;

// export function PLUGIN_Component<K extends keyof SupportedPluginComponents>({
// __name,
// ...props
// }: { __name: K } & PluginProps<K>) {
// const plugins = useCareApps();

// return (
// <>
// {plugins.map((plugin) => {
// const Component = plugin.components[
// __name
// ] as React.ComponentType<unknown>;

// if (!Component) {
// return null;
// }

// return <Component {...props} key={plugin.plugin} />;
// })}
// </>
// );
// }
6 changes: 3 additions & 3 deletions src/components/Facility/DischargeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import useConfirmedAction from "@/hooks/useConfirmedAction";

import { DISCHARGE_REASONS } from "@/common/constants";

import { PLUGIN_Component } from "@/PluginEngine";
// import { PLUGIN_Component } from "@/PluginEngine";
import * as Notification from "@/Utils/Notifications";
import dayjs from "@/Utils/dayjs";
import routes from "@/Utils/request/api";
Expand Down Expand Up @@ -366,11 +366,11 @@ const DischargeModal = ({
}
error={errors?.discharge_notes}
/>

{/*
<PLUGIN_Component
__name="AdditionalDischargeProcedures"
consultation={consultationData}
/>
/> */}

<div className="py-4">
<span className="text-secondary-700">
Expand Down
4 changes: 2 additions & 2 deletions src/components/Facility/DoctorVideoSlideover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { UserAssignedModel } from "@/components/Users/models";
import useAuthUser from "@/hooks/useAuthUser";

import { triggerGoal } from "@/Integrations/Plausible";
import { PLUGIN_Component } from "@/PluginEngine";
// import { PLUGIN_Component } from "@/PluginEngine";
import { Warn } from "@/Utils/Notifications";
import routes from "@/Utils/request/api";
import useQuery from "@/Utils/request/useQuery";
Expand Down Expand Up @@ -371,7 +371,7 @@ function DoctorConnectButtons(props: {
<CareIcon icon="l-phone-alt" id="phone-icon" className="h-5 w-5" />
</div>
</a>
<PLUGIN_Component __name="DoctorConnectButtons" user={user} />
{/* <PLUGIN_Component __name="DoctorConnectButtons" user={user} /> */}
</div>
);
}
6 changes: 3 additions & 3 deletions src/components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
} from "@/common/constants";

import { triggerGoal } from "@/Integrations/Plausible";
import { PLUGIN_Component } from "@/PluginEngine";
// import { PLUGIN_Component } from "@/PluginEngine";
import * as Notification from "@/Utils/Notifications";
import dayjs from "@/Utils/dayjs";
import routes from "@/Utils/request/api";
Expand Down Expand Up @@ -923,11 +923,11 @@ export default function PatientInfoCard(props: {
</MenuItem>
</div>

<PLUGIN_Component
{/* <PLUGIN_Component
__name="ManagePatientOptions"
patient={patient}
consultation={consultation}
/>
/> */}

<div className="px-4 py-2">
<Field as="div" className="flex items-center">
Expand Down
1 change: 1 addition & 0 deletions src/components/Patient/SampleDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ export const SampleDetails = ({ id }: DetailRoute) => {
: "-"}
</div>
</div>
{/* Result on testing */}
<div className="space-y-1">
<div className="text-sm text-muted-foreground">Result on:</div>
<div className="font-medium">
Expand Down
1 change: 0 additions & 1 deletion src/components/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const CardHeader = React.forwardRef<
/>
));
CardHeader.displayName = "CardHeader";

const CardTitle = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
Expand Down
11 changes: 8 additions & 3 deletions src/pluginTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ import { ConsultationModel } from "@/components/Facility/models";
import { PatientModel } from "@/components/Patient/models";
import { UserAssignedModel } from "@/components/Users/models";

import { AppRoutes } from "@/Routers/AppRouter";
import { pluginMap } from "@/pluginMap";
import { AppRoutes } from "./Routers/AppRouter";
import { ConsultationTabProps } from "./components/Facility/ConsultationDetails";
import { FormContextValue } from "./components/Form/FormContext";
import { PatientInfoCardProps } from "./components/Patient/PatientInfoCard";
import { PatientForm } from "./components/Patient/PatientRegister";
import { PatientModel } from "./components/Patient/models";
import { pluginMap } from "./pluginMap";

// Define the available plugins
export type AvailablePlugin = "@apps/care_livekit_fe" | "@apps/care_hcx_fe";
Expand Down Expand Up @@ -68,4 +73,4 @@ export type EnabledPluginConfig = {
components: PluginComponentMap;
};

export { pluginMap };
// export { pluginMap };
Loading

0 comments on commit 448d7bb

Please sign in to comment.