Skip to content

[ENG-570] adds support for extending encounter/patient files tab via plug / remove drawings support.#16469

Open
rithviknishad wants to merge 27 commits into
developfrom
ENG-570-move-out-excalidraw-to-be-a-pluggable-module-meta-artifacts-to-be-extensible-via-plugs
Open

[ENG-570] adds support for extending encounter/patient files tab via plug / remove drawings support.#16469
rithviknishad wants to merge 27 commits into
developfrom
ENG-570-move-out-excalidraw-to-be-a-pluggable-module-meta-artifacts-to-be-extensible-via-plugs

Conversation

@rithviknishad

@rithviknishad rithviknishad commented Jun 22, 2026

Copy link
Copy Markdown
Member

Proposed Changes

image

@rithviknishad rithviknishad requested review from a team and Copilot June 22, 2026 06:50
@rithviknishad rithviknishad requested a review from a team as a code owner June 22, 2026 06:50
@netlify

netlify Bot commented Jun 22, 2026

Copy link
Copy Markdown

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 6bf5c28
🔍 Latest deploy log https://app.netlify.com/projects/care-ohc/deploys/6a3d14abe36dea00088e1379
😎 Deploy Preview https://deploy-preview-16469.preview.ohc.network
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown

⚠️ Merge Checklist Incomplete

Thank you for your contribution! To help us review your PR efficiently, please complete the merge checklist in your PR description.

Your PR will be reviewed once you have marked the appropriate checklist items.

To update the checklist:

  • Change - [ ] to - [x] for completed items
  • Only check items that are relevant to your PR
  • Leave items unchecked if they don't apply

The checklist helps ensure code quality, testing coverage, and documentation are properly addressed.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Removes the hardcoded @excalidraw/excalidraw dependency and replaces the drawing subsystem with a plugin-extensible architecture. The MetaArtifact type model is refactored to use enums and generic object values. New components (DrawingEditor, DrawingPreview, DrawingIcon, DrawingsSubTab) delegate rendering to plugin-provided manifests via new hooks. Routes and FilesTab are updated accordingly.

Changes

Plugin-based drawing system refactor

Layer / File(s) Summary
MetaArtifact type model and API descriptor refactor
src/types/metaArtifact/metaArtifact.ts, src/types/metaArtifact/metaArtifactApi.ts
Replaces Excalidraw-specific literal unions with MetaArtifactAssociatingType and MetaArtifactObjectType enums. Introduces DrawingObjectValue (generic application: string + open payload). Replaces MetaArtifactResponse with MetaArtifactRead. Updates all API endpoint descriptors (create, retrieve, list, update, upsert) to use MetaArtifactRead response types.
DrawingApplicationManifest plugin type and hooks
src/pluginTypes.ts, src/components/Files/Drawings/usePluginDrawingApplications.ts, src/hooks/useCareApps.tsx
Extends PluginManifest with optional drawingApplications array of DrawingApplicationManifest entries (application key, optional icon, lazy-loaded previewer/editor). Adds DrawingApplicationNotFoundError, usePluginDrawingApplications, and usePluginDrawingApplication hooks. Generalizes withSuspense to a generic HOC <T extends object>.
DrawingEditor, DrawingPreview, and DrawingIcon components
src/components/Files/Drawings/DrawingEditor.tsx, src/components/Files/Drawings/DrawingPreview.tsx, src/components/Files/Drawings/DrawingIcon.tsx
Adds DrawingEditor, which fetches an artifact by id, holds DrawingObjectValue in local state, saves via react-query mutation with query invalidation and success toast, and delegates rendering to a plugin-resolved editor in Suspense. Adds DrawingPreview with a spinning skeleton fallback. Adds DrawingIcon with Skeleton fallback and ErrorBoundary guard.
DrawingsSubTab list and creation UI
src/components/Files/Drawings/DrawingsSubTab.tsx
Implements DrawingsSubTab with a paginated, searchable drawing list gated by hasReadPermission/hasWritePermission. NewDrawingButton supports a single button or multi-application dropdown with a creation modal; a react-query mutation creates the drawing and navigates to it. Each card renders DrawingPreview wrapped in ErrorBoundary.
Route updates and FilesTab wiring
src/Routers/routes/ConsultationRoutes.tsx, src/Routers/routes/PatientRoutes.tsx, src/components/Files/FilesTab.tsx
Replaces Excalidraw-based routes with single drawings/:id routes rendering DrawingEditor. Updates FilesTab to render DrawingsSubTab with a FileTypeMetaArtifactAssociatingType mapping. Removes lazy/Suspense/Loading wrappers for the old ExcalidrawEditor.
Locale key updates
public/locale/en.json, public/locale/ml.json
Adds unsupported_drawing_application and saved keys. Removes Excalidraw-era keys (you_have_unsaved_changes_what_would_you_like_to_do, search_drawings, discard_changes, no_drawings_so_far, save_and_go_back, ENCOUNTER_TAB__drawings, add_drawings).
Dependency and build config cleanup
package.json, vite.config.mts
Removes @excalidraw/excalidraw from dependencies. Removes the process.env.IS_PREACT build-time define constant from Vite config.

Possibly related PRs

  • ohcnetwork/care_fe#16229: Modifies the same PluginManifest exported type in src/pluginTypes.ts by adding an overrides field, directly overlapping with this PR's addition of the drawingApplications field to the same interface.

Suggested reviewers

  • nihal467
  • Jacobjeevan
  • gigincg
  • amjithtitus09
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description covers the main changes but omits required template items like Fixes #issue_number, Tagging, and the merge checklist. Add the missing template sections, including the issue reference, @ohcnetwork/care-fe-code-reviewers tag, and all merge checklist items.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is clearly about the main change: refactoring the patient/encounter files tab to use plug-based drawing support and removing built-in drawings support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ENG-570-move-out-excalidraw-to-be-a-pluggable-module-meta-artifacts-to-be-extensible-via-plugs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 22, 2026

Copy link
Copy Markdown

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6bf5c28
Status: ✅  Deploy successful!
Preview URL: https://227a1552.care-preview-a7w.pages.dev
Branch Preview URL: https://eng-570-move-out-excalidraw.care-preview-a7w.pages.dev

View logs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the built-in Excalidraw-based drawings implementation with a plug-driven “drawing applications” system backed by meta_artifacts, refactors the Files → Drawings UI to use the new mechanism, and removes the Excalidraw dependency.

Changes:

  • Introduces plugin manifest support for drawingApplications and new UI components (DrawingsSubTab, DrawingPreview, DrawingEditor) that render app-provided preview/editor implementations.
  • Refactors meta-artifact types/API response typing (MetaArtifactRead, enums for associating/object types) to support generalized drawing payloads.
  • Removes Excalidraw editor/components and dependency, updates loading UI to a new SVG animation, and adjusts locale keys.

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
vite.config.mts Removes a no-longer-needed process.env.IS_PREACT define.
tests/facility/patient/encounter/files/drawings/encounterDrawing.spec.ts Deletes Excalidraw-specific E2E coverage.
src/types/metaArtifact/metaArtifactApi.ts Updates API typing to use MetaArtifactRead consistently.
src/types/metaArtifact/metaArtifact.ts Generalizes drawing value schema; adds enums and MetaArtifactRead.
src/Routers/routes/PatientRoutes.tsx Removes patient drawing routes (needs replacement for new editor route).
src/Routers/routes/ConsultationRoutes.tsx Routes encounter drawings to the new DrawingEditor.
src/pluginTypes.ts Adds drawingApplications to plugin manifest; imports drawing prop types (should be type-only).
src/hooks/useCareApps.tsx Makes withSuspense generic for broader plugin component wrapping.
src/components/Files/FilesTab.tsx Switches drawings subtab to DrawingsSubTab (patient props currently incorrect).
src/components/Files/DrawingSubTab.tsx Removes old Excalidraw-based drawings tab implementation.
src/components/Files/Drawings/* Adds plugin-driven drawings list/preview/icon/editor + application lookup hooks.
src/components/Common/Loading.tsx Replaces static logo with LoadingAnimationSvg (needs a11y status).
src/components/Common/Drawings/ExcalidrawEditor.tsx Removes Excalidraw editor implementation.
src/components/careui/loading-animation-svg.tsx Adds new SVG-based loading animation (hardcoded label).
public/locale/en.json Reorders/removes some old drawing strings; adds new keys (saved, unsupported_drawing_application, etc.).
public/locale/ml.json Removes some drawing-related strings (now missing drawings).
package.json Removes @excalidraw/excalidraw dependency.

Comment thread src/components/Files/FilesTab.tsx Outdated
Comment thread src/Routers/routes/PatientRoutes.tsx
Comment thread src/pluginTypes.ts Outdated
Comment thread src/components/Files/Drawings/DrawingPreview.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingEditor.tsx Outdated
Comment thread src/components/Common/Loading.tsx
Comment thread src/components/careui/loading-animation-svg.tsx Outdated
Comment thread public/locale/ml.json
Comment thread src/components/Files/Drawings/DrawingsSubTab.tsx Outdated
@greptile-apps

greptile-apps Bot commented Jun 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR removes the built-in Excalidraw drawing implementation from care_fe and replaces it with a generic plugin extension point (encounterFileTabs in PluginManifest), allowing any drawing application to be delivered as a plugin. The old useCareAppEncounterTabs hook is generalised into useCareAppTabs<T> so both encounter tabs and file tabs can be served through the same mechanism.

  • Deleted ExcalidrawEditor.tsx, DrawingSubTab.tsx, metaArtifact types/API, and the direct /drawings/* routes — all moved to care_excalidraw.
  • FilesTab now renders a dynamic set of plugin-provided tab panels instead of a hard-coded Drawings tab; the FilesTabsProps interface is exported for plugin use.
  • useCareAppTabs<T>(key) accepts any keyof PluginManifest and casts the value with no TypeScript enforcement that key corresponds to T; a narrower union type for valid tab-map keys would close this gap.

Confidence Score: 5/5

Safe to merge — the change is a clean extraction of Excalidraw into a plugin, with no remaining runtime dependencies on the deleted code.

The deletions are complete and consistent: routes, types, API definitions, and tests all point to the old implementation and are all removed. The new plugin extension point is minimal and both current call sites use it correctly. No broken imports, no dangling references to removed types.

src/hooks/useCareApps.tsx and src/pluginTypes.ts — the type-safety gap in useCareAppTabs and the non-type import of FilesTabsProps are worth addressing before the extension surface grows.

Important Files Changed

Filename Overview
src/hooks/useCareApps.tsx Generalized useCareAppEncounterTabs to useCareAppTabs<T> with a keyof PluginManifest key parameter; type relationship between key and T is not enforced by TypeScript (unsafe cast at line 83).
src/pluginTypes.ts Added encounterFileTabs manifest field; imports FilesTabsProps with a regular (non-type) import, creating a type-level circular dependency with FilesTab.tsx.
src/components/Files/FilesTab.tsx Replaced hard-coded drawings tab with dynamic plugin tabs via useCareAppTabs; FilesTabsProps is now exported for plugin use; type narrowing on qParams.file was loosened by dropping the generic from useQueryParams().
src/pages/Encounters/EncounterShow.tsx Minimal one-line update swapping useCareAppEncounterTabs() for useCareAppTabs<PluginEncounterTabProps>("encounterTabs"); no issues found.
src/Routers/routes/ConsultationRoutes.tsx Removed Excalidraw-specific /drawings/new and /drawings/:drawingId routes; clean deletion with no orphaned references.
src/Routers/routes/PatientRoutes.tsx Removed four patient-scoped Excalidraw routes; clean deletion.
public/locale/en.json Removed Excalidraw-specific i18n keys and added the generic saved key; appropriate since drawing strings now live in the care_excalidraw plugin.
public/locale/ml.json Removed Malayalam translations for drawing-specific keys that are also gone from en.json; consistent with moving the feature to care_excalidraw.

Reviews (13): Last reviewed commit: "optimizations" | Re-trigger Greptile

Comment thread src/components/Files/FilesTab.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingIcon.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingPreview.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingEditor.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingsSubTab.tsx Outdated
@rithviknishad rithviknishad changed the title adds support for drawing applications via plug / move out excalidraw [ENG-570] adds support for drawing applications via plug / move out excalidraw Jun 22, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@public/locale/ml.json`:
- Line 2859: The Malayalam locale file is missing eight critical drawing-related
translation keys that exist in the English locale. Add the following missing
keys to the ml.json file with appropriate Malayalam translations: drawings,
saved, discard_changes, save_and_go_back, enter_drawing_name,
no_drawings_so_far, unsupported_drawing_application, and
you_have_unsaved_changes_what_would_you_like_to_do. Verify each key has a proper
Malayalam translation value to ensure the drawing UI displays correctly for
Malayalam users instead of falling back to English.

In `@src/components/careui/loading-animation-svg.tsx`:
- Around line 385-390: The hardcoded "loading" string in the
loading-animation-svg.tsx component bypasses i18next localization required for
multilingual healthcare interfaces. Replace the literal "loading" text with an
appropriate i18next translation call using the useTranslation hook. Import
useTranslation at the top of the component if not already present, call it
within the component function, and wrap the "loading" text with the translation
function (typically t("key_name")) to ensure the label respects the user's
language settings.

In `@src/components/Files/Drawings/DrawingEditor.tsx`:
- Around line 85-95: The DrawingEditorApplication component uses
usePluginDrawingApplication hook which can throw DrawingApplicationNotFoundError
when an application is not found, but currently has no error boundary to handle
this error. Wrap the DrawingEditorApplication component with an ErrorBoundary
component in the JSX return statement, following the same pattern and i18n
fallback that is already established in DrawingsSubTab.tsx and DrawingIcon.tsx
for handling the same DrawingApplicationNotFoundError exception.

In `@src/components/Files/Drawings/DrawingIcon.tsx`:
- Around line 15-26: The usePluginDrawingApplication hook is called at the top
level of the DrawingIcon component before the ErrorBoundary wrapper, so any
error thrown by the hook (such as DrawingApplicationNotFoundError) cannot be
caught by the ErrorBoundary. Extract the hook call and the ApplicationIcon
rendering into a separate child component, then render this new child component
inside the ErrorBoundary in DrawingIcon. This ensures the hook execution happens
within the ErrorBoundary's scope so it can properly catch and handle any errors
thrown by usePluginDrawingApplication.

In `@src/components/Files/Drawings/DrawingsSubTab.tsx`:
- Around line 253-257: The associatingId calculation in the DrawingsSubTab
component can result in an empty string when both the primary source
(encounter.id or patient.id) and the fallback are undefined, which causes
incorrect backend queries. Replace the empty string fallback ("") with patientId
to ensure there is always a valid identifier. Additionally, add validation
checks before any query or creation operations that use associatingId (including
the areas noted at lines 264-277 and 292-295) to ensure associatingId is not
empty before proceeding, preventing unpredictable backend behavior.
- Line 287: The onChange handler for the search input in DrawingsSubTab only
updates the search state with setSearch but does not reset the pagination page
state. When search text changes, the page offset becomes stale relative to the
new filtered results, which can cause empty states or false data displays.
Modify the onChange handler to also call the pagination reset function (such as
setPage with value 1 or 0) alongside setSearch to ensure the user returns to the
first page whenever the search query is modified.
- Around line 314-320: The Card component in DrawingsSubTab.tsx currently only
responds to click events via the onClick handler that calls navigate, making it
inaccessible via keyboard navigation. Add keyboard accessibility by including a
tabIndex prop to make the Card focusable, adding an appropriate ARIA role
attribute (such as button), and implementing an onKeyDown handler that detects
Enter and Space key presses to trigger the same navigate call as the onClick
handler. This ensures users can open drawings using keyboard navigation, meeting
WCAG 2.1 AA compliance requirements.

In `@src/components/Files/Drawings/usePluginDrawingApplications.ts`:
- Around line 13-18: The getDrawingApplicationsFromCareApps function does not
validate that drawing application keys are unique across plugins, allowing
duplicate keys to silently route to the first matched application. Add
validation logic after the flatMap operation to detect duplicate application
keys and throw an error when duplicates are found, ensuring each application key
is unique before returning the resolved applications. Apply the same validation
check to the other location mentioned around lines 31-33 where drawing
applications are similarly resolved.

In `@src/components/Files/FilesTab.tsx`:
- Around line 128-137: In the DrawingsSubTab component props, when the type is
FileType.PATIENT, you are currently passing patientId with the value
patient?.id. However, DrawingsSubTab expects the full patient object (not just
the id) to properly compute the associatingId from props.patient?.id. Change the
conditional props spread to pass the entire patient object instead of just the
patientId property when type === FileType.PATIENT, ensuring DrawingsSubTab
receives the complete patient data needed for its functionality.

In `@src/pluginTypes.ts`:
- Around line 1-2: The imports for DrawingEditorApplicationProps and
DrawingPreviewProps should use `import type` syntax since these interfaces are
only used in type positions (not at runtime). Change both import statements at
the top of the file to use `import type` instead of regular `import` to clarify
that these are type-only imports and align with TypeScript strict mode best
practices.

In `@src/types/metaArtifact/metaArtifact.ts`:
- Around line 7-10: Replace the enum MetaArtifactAssociatingType with an as
const object map containing the same key-value pairs (PATIENT and ENCOUNTER).
Then create a derived union type from the object's values to provide the same
type safety as the enum. This aligns with the codebase convention used in files
like consent.ts and allergyIntolerance.ts for defining string literal types.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 203e778d-e313-4d86-83a7-9ca30cf975da

📥 Commits

Reviewing files that changed from the base of the PR and between dcec6e9 and 370c57d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (21)
  • package.json
  • public/locale/en.json
  • public/locale/ml.json
  • src/Routers/routes/ConsultationRoutes.tsx
  • src/Routers/routes/PatientRoutes.tsx
  • src/components/Common/Drawings/ExcalidrawEditor.tsx
  • src/components/Common/Loading.tsx
  • src/components/Files/DrawingSubTab.tsx
  • src/components/Files/Drawings/DrawingEditor.tsx
  • src/components/Files/Drawings/DrawingIcon.tsx
  • src/components/Files/Drawings/DrawingPreview.tsx
  • src/components/Files/Drawings/DrawingsSubTab.tsx
  • src/components/Files/Drawings/usePluginDrawingApplications.ts
  • src/components/Files/FilesTab.tsx
  • src/components/careui/loading-animation-svg.tsx
  • src/hooks/useCareApps.tsx
  • src/pluginTypes.ts
  • src/types/metaArtifact/metaArtifact.ts
  • src/types/metaArtifact/metaArtifactApi.ts
  • tests/facility/patient/encounter/files/drawings/encounterDrawing.spec.ts
  • vite.config.mts
💤 Files with no reviewable changes (6)
  • src/components/Common/Drawings/ExcalidrawEditor.tsx
  • tests/facility/patient/encounter/files/drawings/encounterDrawing.spec.ts
  • vite.config.mts
  • src/components/Files/DrawingSubTab.tsx
  • package.json
  • src/Routers/routes/PatientRoutes.tsx

Comment thread public/locale/ml.json
Comment thread src/components/careui/loading-animation-svg.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingEditor.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingIcon.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingsSubTab.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingsSubTab.tsx Outdated
Comment thread src/components/Files/Drawings/usePluginDrawingApplications.ts Outdated
Comment thread src/components/Files/FilesTab.tsx Outdated
Comment thread src/pluginTypes.ts Outdated
Comment thread src/types/metaArtifact/metaArtifact.ts Outdated
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

🎭 Playwright Test Results

Status: ✅ Passed
Test Shards: 3

Metric Count
Total Tests 326
✅ Passed 326
❌ Failed 0
⏭️ Skipped 0

📊 Detailed results are available in the playwright-final-report artifact.

Run: #9788

Copilot AI review requested due to automatic review settings June 22, 2026 07:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 22 changed files in this pull request and generated 9 comments.

Comment thread src/pluginTypes.ts Outdated
Comment thread src/components/Files/Drawings/DrawingsSubTab.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingsSubTab.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingIcon.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingEditor.tsx Outdated
Comment thread src/components/Files/Drawings/DrawingEditor.tsx Outdated
Comment thread public/locale/ml.json
Comment thread src/components/Files/Drawings/DrawingsSubTab.tsx Outdated
Comment thread src/components/careui/loading-animation-svg.tsx Outdated
Copilot AI review requested due to automatic review settings June 24, 2026 07:29
@rithviknishad rithviknishad force-pushed the ENG-570-move-out-excalidraw-to-be-a-pluggable-module-meta-artifacts-to-be-extensible-via-plugs branch from b82e742 to 7c0615f Compare June 24, 2026 07:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 6 comments.

Comment on lines +334 to +352
{data?.results.length === 0 ? (
<div className="flex flex-col items-center justify-center p-8 text-gray-500">
<ImageOffIcon className="mb-2 text-4xl" />
<p className="text-lg font-medium">{t("no_drawings_so_far")}</p>
{canEdit && (
<p className="text-sm">
{hasApplications
? t("create_new_drawing_message")
: t("no_drawing_applications_available")}
</p>
)}
</div>
) : (
<div className="ml-1 grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3">
{data?.results.map((drawing) => (
<DrawingCard key={drawing.id} drawing={drawing} />
))}
</div>
)}
Comment on lines +389 to +396
role="button"
tabIndex={0}
onClick={() => handleSelect()}
onKeyDown={(e) => {
if (e.key === "Enter") {
handleSelect();
}
}}
Comment thread public/locale/ml.json Outdated
Comment thread public/locale/ml.json
Comment thread public/locale/ml.json
Comment thread src/components/Files/Drawings/DrawingsSubTab.tsx Outdated

@nihal467 nihal467 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image
  • the save and edit is keep on triggering unsaved changed browser pp-up

Copilot AI review requested due to automatic review settings June 25, 2026 11:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 6 comments.

Comment thread src/components/Files/FilesTab.tsx
Comment thread src/components/Files/FilesTab.tsx Outdated
Comment thread src/hooks/useCareApps.tsx Outdated
import { Suspense, createContext, useContext } from "react";

import { PluginErrorBoundary } from "@/components/Common/PluginErrorBoundary";
import { FilesTabsProps } from "@/components/Files/FilesTab";
Comment thread src/pluginTypes.ts
@@ -1,3 +1,4 @@
import { FilesTabsProps } from "@/components/Files/FilesTab";
Comment thread public/locale/ml.json
Comment on lines 2689 to 2693
"2FA_backup_code": "2FA ബാക്കപ്പ് കോഡ്",
"ENCOUNTER_TAB__devices": "ഉപകരണങ്ങൾ",
"ENCOUNTER_TAB__drawings": "രേഖാചിത്രങ്ങൾ",
"SYSTEM__govt_org_type__district_panchayat": "ജില്ലാ പഞ്ചായത്ത്",
"add_another": "മറ്റൊന്ന് ചേർക്കുക",
"add_condition": "കണ്ടീഷനനുസരിച് ചേർക്കുക",
Comment thread src/components/Files/FilesTab.tsx Outdated
Comment on lines +47 to +50
const pluginTabs = useCareAppsEncounterFileTabs();

const allowedTabs = ["all", "reports", ...Object.keys(pluginTabs)];
const tabValue = allowedTabs.includes(qParams.file) ? qParams.file : "all";
Copilot AI review requested due to automatic review settings June 25, 2026 11:44
@rithviknishad rithviknishad changed the title [ENG-570] adds support for drawing applications via plug / move out excalidraw [ENG-570] adds support for extending encounter/patient files tab via plug / remove drawings support. Jun 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

src/components/Files/FilesTab.tsx:38

  • useQueryParams() is used without a generic type here, which effectively drops type-safety for qParams.file and setQParams (most other call sites in the repo specify a {...} generic, e.g. src/pages/Encounters/tabs/plots.tsx and src/components/Patient/PatientDetailsTab/EncounterHistory.tsx). Adding a minimal { file?: string } type keeps this tab logic safe and self-documenting.
  const [qParams, setQParams] = useQueryParams();

  const { hasPermission } = usePermissions();
  const { canWritePatient } = getPermissions(
    hasPermission,

Comment thread src/pluginTypes.ts
Comment on lines +1 to 4
import { FilesTabsProps } from "@/components/Files/FilesTab";
import { NavigationLink } from "@/components/ui/sidebar/nav-main";
import type { OverrideCondition } from "@/lib/override";
import { PluginEncounterTabProps } from "@/pages/Encounters/EncounterShow";
Comment thread src/hooks/useCareApps.tsx
Comment on lines +76 to 95
export const useCareAppTabs = <T extends object>(key: keyof PluginManifest) => {
const careApps = useCareApps();

return careApps.reduce<Record<string, React.FC<PluginEncounterTabProps>>>(
(acc, app) => {
if (app.isLoading) {
return acc;
}

const appTabs = Object.entries(app.encounterTabs ?? {}).reduce(
(acc, [key, Component]) => {
return { ...acc, [key]: withSuspense(Component, app.plugin) };
},
{},
);

return { ...acc, ...appTabs };
},
{},
);
return careApps.reduce<Record<string, React.FC<T>>>((acc, app) => {
if (app.isLoading) {
return acc;
}

const tabs = app[key] as Record<string, React.ComponentType<T>> | undefined;
if (!tabs) {
return acc;
}

const appTabs = Object.entries(tabs).reduce((acc, [key, Component]) => {
return { ...acc, [key]: withSuspense(Component, app.plugin) };
}, {});

return { ...acc, ...appTabs };
}, {});
};
Comment thread public/locale/ml.json
Comment on lines 2688 to 2694
"yesterday": "ഇന്നലെ/കഴിഞ്ഞ ദിവസം",
"2FA_backup_code": "2FA ബാക്കപ്പ് കോഡ്",
"ENCOUNTER_TAB__devices": "ഉപകരണങ്ങൾ",
"ENCOUNTER_TAB__drawings": "രേഖാചിത്രങ്ങൾ",
"SYSTEM__govt_org_type__district_panchayat": "ജില്ലാ പഞ്ചായത്ത്",
"add_another": "മറ്റൊന്ന് ചേർക്കുക",
"add_condition": "കണ്ടീഷനനുസരിച് ചേർക്കുക",
"add_drawings": "രേഖാചിത്രങ്ങൾ ചേർക്കുക",
"add_option": "ഓപ്ഷൻ ചേർക്കുക",
Comment on lines +46 to +48
const pluginTabs = useCareAppTabs<FilesTabsProps>("encounterFileTabs");
const allowedTabs = ["all", "reports", ...Object.keys(pluginTabs)];
const tabValue = allowedTabs.includes(qParams.file) ? qParams.file : "all";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants