From 504dd8cc3e733a2fb8cb0c1c16f3909d8f8dda48 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Thu, 16 Jul 2026 11:17:53 +0530 Subject: [PATCH] ENG-763 Allow plugins to add sections in user's profile page --- src/components/Users/UserSummary.tsx | 24 ++++++++++++------------ src/pluginTypes.ts | 10 +++++++++- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/components/Users/UserSummary.tsx b/src/components/Users/UserSummary.tsx index 3c7ae65893b..c5a7e04c2a8 100644 --- a/src/components/Users/UserSummary.tsx +++ b/src/components/Users/UserSummary.tsx @@ -1,18 +1,11 @@ -import { useAtom } from "jotai"; -import { useState } from "react"; -import { useTranslation } from "react-i18next"; - +import { developerModeAtom } from "@/atoms/developerMode"; import CareIcon from "@/CAREUI/icons/CareIcon"; - +import LanguageSelector from "@/components/Common/LanguageSelector"; +import UserColumns, { userChildProps } from "@/components/Common/UserColumns"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Label } from "@/components/ui/label"; import { Switch } from "@/components/ui/switch"; - -import { developerModeAtom } from "@/atoms/developerMode"; - -import LanguageSelector from "@/components/Common/LanguageSelector"; -import UserColumns, { userChildProps } from "@/components/Common/UserColumns"; import ServiceTokenSection from "@/components/Users/ServiceTokenSection"; import { TwoFactorAuth } from "@/components/Users/TwoFactorAuth"; import UserAvatar from "@/components/Users/UserAvatar"; @@ -25,10 +18,12 @@ import { ContactInfoDetails, GeoOrgDetails, } from "@/components/Users/UserViewDetails"; - import useAuthUser from "@/hooks/useAuthUser"; - import EditUserSheet from "@/pages/Organization/components/EditUserSheet"; +import { PLUGIN_Component } from "@/PluginEngine"; +import { useAtom } from "jotai"; +import { useState } from "react"; +import { useTranslation } from "react-i18next"; export default function UserSummaryTab({ userData, @@ -205,6 +200,11 @@ export default function UserSummaryTab({ /> )} + {authUser.is_superuser && ( diff --git a/src/pluginTypes.ts b/src/pluginTypes.ts index ec07a945338..eff57bada15 100644 --- a/src/pluginTypes.ts +++ b/src/pluginTypes.ts @@ -12,7 +12,7 @@ import { } from "@/types/emr/patient/patient"; import { FacilityRead } from "@/types/facility/facility"; import { PlugConfigMeta } from "@/types/plugConfig"; -import { UserReadMinimal } from "@/types/user/user"; +import { UserRead, UserReadMinimal } from "@/types/user/user"; import { ComponentType, LazyExoticComponent, ReactNode } from "react"; import { UseFormReturn } from "react-hook-form"; import { QuestionnaireFormState } from "./components/Questionnaire/QuestionnaireForm"; @@ -127,6 +127,13 @@ export type DeliveryOrderActionsComponentType = React.FC<{ locationId: string; }>; +// Sections rendered on the user profile (summary) page +export type UserProfileSectionsComponentType = React.FC<{ + user: UserRead; + isOwnProfile: boolean; + className?: string; +}>; + // Define supported plugin components export type SupportedPluginComponents = { DoctorConnectButtons: DoctorConnectButtonComponentType; @@ -147,6 +154,7 @@ export type SupportedPluginComponents = { DiagnosticReportOverride: DiagnosticReportOverrideComponentType; PatientHomeQuickActions: PatientHomeActionsComponentType; DeliveryOrderActions: DeliveryOrderActionsComponentType; + UserProfileSections: UserProfileSectionsComponentType; }; // Create a type for lazy-loaded components