Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix:Remove arrow icon from cancel button in Create Questionnaire #10773

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

ashwinpraveengo
Copy link
Contributor

@ashwinpraveengo ashwinpraveengo commented Feb 22, 2025

Proposed Changes

@ohcnetwork/care-fe-code-reviewers

image

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

Summary by CodeRabbit

  • New Features
    • Enhanced the questionnaire interface with translatable text for labels, buttons, and alerts, providing improved multilingual support.
    • Introduced new localization entries for actions like adding questions, conditions, cloning questionnaires, editing forms, previewing, and managing data collection.

@ashwinpraveengo ashwinpraveengo requested a review from a team as a code owner February 22, 2025 18:52
Copy link

netlify bot commented Feb 22, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit df59624
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/67c45a04d3432c000804125a
😎 Deploy Preview https://deploy-preview-10773.preview.ohc.network
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Copy link
Contributor

coderabbitai bot commented Feb 22, 2025

Walkthrough

The changes update the questionnaire editor to support internationalization. Hardcoded strings in the UI have been replaced with translatable keys using the t function from the i18next library. Additionally, new entries have been added to the locale JSON file to provide translations for various questionnaire-related labels and messages. There are no modifications to public or exported entities.

Changes

File(s) Change Summary
src/components/Questionnaire/QuestionnaireEditor.tsx Replaced hardcoded UI strings (e.g., "Clone Questionnaire", "Cancel", "Save") with translatable keys via the t function to improve internationalization support.
public/locale/en.json Added numerous new translation keys related to questionnaire functionality (e.g., "add_question", "edit_form", "no_requested_questionnaires_found") to support multilingual interfaces.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant QE as QuestionnaireEditor
    participant I as i18next
    participant L as Locale File (en.json)

    U->>QE: Interact with Questionnaire UI
    QE->>I: Request translation for a key (e.g., "clone_questionnaire")
    I->>L: Retrieve translation string
    L-->>I: Return localized string
    I-->>QE: Return translated text
    QE-->>U: Display localized UI text
Loading

Possibly related PRs

Suggested labels

changes required

Suggested reviewers

  • rithviknishad
  • Jacobjeevan

Poem

I'm a bunny hopping through the code,
Replacing strings to lighten the load,
With keys that speak in many tongues,
Our app's story is freshly sung,
Hoppy changes made with a gentle nod.
🐇💻

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ashwinpraveengo ashwinpraveengo force-pushed the issues/10725/Remove-Unnecessary-Arrow branch from 6819c7d to 0384bdc Compare February 24, 2025 14:19
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
public/locale/en.json (1)

1742-1742: Added "preview" localization key.
The key "preview": "Preview" provides a succinct label. However, note that similar keys (e.g. "form_preview") exist—please verify if this might lead to duplicate or confusing UI references.

Consider consolidating these similar keys if they serve the same purpose.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3cda28 and 0384bdc.

📒 Files selected for processing (2)
  • public/locale/en.json (11 hunks)
  • src/components/Questionnaire/QuestionnaireEditor.tsx (25 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Questionnaire/QuestionnaireEditor.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: cypress-run (1)
🔇 Additional comments (9)
public/locale/en.json (9)

292-292: Added localization key for "add_condition".
This new entry "add_condition": "Add Condition" is clear, concise, and consistent with the style of similar action labels in the file.


310-310: Added localization key for "add_option".
The entry "add_option": "Add Option" is straightforward and matches the formatting of other similar keys.


318-318: Added localization key for "add_question".
The value "Add Question" is clear and appears to follow the same style as other keys; ensure that any UI component referencing this key is updated accordingly.


584-584: Introduced "clone_questionnaire" localization key.
The added entry "clone_questionnaire": "Clone Questionnaire" is intuitive and aligns with similar action phrases. Verify that the UI components correctly use this translatable string.


588-588: Added localization key for "collect".
The new key "collect": "Collect" is clear; please ensure that its use in the UI matches the intended action, as it follows the established label style.


814-814: Added localization key for "edit_form".
The entry "edit_form": "Edit Form" is concise and complies with the application's language consistency.


1097-1097: Added localization key for "form_preview".
The new key "form_preview": "Preview form" effectively captures the intended UI text for form preview functionality.


1773-1773: Added localization key for "question".
The new key "question": "Question" is self-explanatory and follows the pattern of similar terms in the file.


1837-1837: Added localization key for "repeatable".
The entry "repeatable": "Repeatable" is concise and clear. Make sure that its usage in the questionnaire components correctly reflects its intent.

@ashwinpraveengo ashwinpraveengo force-pushed the issues/10725/Remove-Unnecessary-Arrow branch 2 times, most recently from e1ae475 to 9517093 Compare February 24, 2025 14:34
@github-actions github-actions bot added the merge conflict pull requests with merge conflict label Feb 25, 2025
Copy link

Conflicts have been detected against the base branch. Please merge the base branch into your branch.
cc: @ashwinpraveengo

See: https://docs.ohc.network/docs/contributing#how-to-resolve-merge-conflicts

@ashwinpraveengo ashwinpraveengo force-pushed the issues/10725/Remove-Unnecessary-Arrow branch 2 times, most recently from 9517093 to 172d323 Compare February 26, 2025 05:56
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently, please check "Code review limits" under "Moderation" settings.

Actionable comments posted: 2

🔭 Outside diff range comments (1)
src/components/ValueSet/ValueSetForm.tsx (1)

104-116: 🛠️ Refactor suggestion

Missing internationalization in ConceptFields component.

While translations were added to the main form, the ConceptFields component still uses hardcoded strings.

Add translations for all user-facing strings:

<div className="flex items-center justify-between">
-  <h4 className="text-sm font-medium">Concepts</h4>
+  <h4 className="text-sm font-medium">{t("concepts")}</h4>
  <Button
    type="button"
    variant="outline"
    size="sm"
    onClick={() => append({ code: "", display: "" })}
  >
    <PlusIcon className="h-4 w-4 mr-2" />
-    Add Concept
+    {t("add_concept")}
  </Button>
</div>
🧹 Nitpick comments (12)
src/components/Patient/symptoms/SymptomTable.tsx (1)

113-117: Consider using a more consistent date format

The implementation for displaying the onset date works well, but consider using a more standardized date formatting approach for consistency across the application.

-              {symptom.onset?.onset_datetime
-                ? new Date(symptom.onset.onset_datetime).toLocaleDateString()
-                : "-"}
+              {symptom.onset?.onset_datetime
+                ? new Date(symptom.onset.onset_datetime).toLocaleDateString(undefined, {
+                    year: 'numeric',
+                    month: 'short',
+                    day: 'numeric'
+                  })
+                : "-"}
src/components/Common/AvatarEditModal.tsx (1)

236-240: Good security practice for blob URL handling

Selectively sanitizing blob URLs while leaving backend-provided imageUrls untouched is a good approach based on trust boundaries. According to retrieved learnings, the imageUrl prop is fetched from the backend and considered safe.

However, consider using optional chaining for better null/undefined safety:

-src={
-  preview && preview.startsWith("blob:")
-    ? DOMPurify.sanitize(preview)
-    : imageUrl
-}
+src={
+  preview?.startsWith("blob:")
+    ? DOMPurify.sanitize(preview)
+    : imageUrl
+}
🧰 Tools
🪛 Biome (1.9.4)

[error] 237-237: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

src/pages/Facility/settings/devices/UpdateDevice.tsx (1)

42-44: Consider using React Router's navigation methods instead of window.history.

Using window.history.back() works but isn't aligned with React Router's navigation model.

-          onSuccess={() => {
-            window.history.back();
-          }}
+          onSuccess={() => {
+            navigate(-1); // Assuming you're using React Router's useNavigate hook
+          }}
src/pages/Facility/settings/devices/DevicesList.tsx (2)

27-28: Consider making the page limit configurable.

The limit of 12 devices per page is hardcoded, which reduces flexibility.

Consider making this a configurable value, either through props, context, or user preferences:

-  const limit = 12;
+  const limit = props.itemsPerPage || 12;

79-81: Pagination component usage can be simplified.

The onChange handler has an unused parameter.

<Pagination
  data={{ totalCount: data.count }}
-  onChange={(page, _) => setPage(page)}
+  onChange={(page) => setPage(page)}
  defaultPerPage={limit}
  cPage={page}
/>
src/pages/Facility/settings/devices/DeviceDetail.tsx (1)

105-122: Improve URL validation in contact link generation.

The function doesn't validate URL formats when handling contacts of type 'url', which could lead to invalid links.

case "url":
-  return value;
+  // Basic URL validation
+  return value.startsWith('http://') || value.startsWith('https://') 
+    ? value 
+    : `https://${value}`;
src/components/ValueSet/ValueSetForm.tsx (1)

344-396: Consider using the hook-based translation approach in the schema.

The schema is using the global t function directly, which might cause issues in certain contexts where the translation context isn't properly initialized.

Consider creating the schema inside the component to use the hook-based approach:

-const valuesetFormSchema = z.object({...});

export function ValueSetForm({
  initialData,
  onSubmit,
  isSubmitting,
}: ValueSetFormProps) {
  const { t } = useTranslation();
  
+  const valuesetFormSchema = z.object({
+    name: z.string().min(1, t("field_required")),
+    // rest of the schema
+  });

  const form = useForm<ValuesetFormType>({
    resolver: zodResolver(valuesetFormSchema),
    // ...
  });
  // ...
}
src/types/location/location.ts (1)

45-61: Consider adding comments explaining the abbreviations

The location form options use abbreviated codes ("si", "bu", "wi", etc.) that aren't self-explanatory. Consider adding comments explaining what each code represents to improve code readability and maintainability.

export const LocationFormOptions = [
-  "si",
-  "bu",
-  "wi",
-  "wa",
-  "lvl",
-  "co",
-  "ro",
-  "bd",
-  "ve",
-  "ho",
-  "ca",
-  "rd",
-  "area",
-  "jdn",
-  "vi",
+  "si",   // Site
+  "bu",   // Building
+  "wi",   // Wing
+  "wa",   // Ward
+  "lvl",  // Level
+  "co",   // Corridor
+  "ro",   // Room
+  "bd",   // Bed
+  "ve",   // Vehicle
+  "ho",   // House
+  "ca",   // Cabinet
+  "rd",   // Road
+  "area", // Area
+  "jdn",  // Junction
+  "vi",   // Virtual
] as const;
src/types/device/device.ts (1)

24-39: Remove or uncomment commented code

There's a commented-out field (care_type) in the DeviceBase interface. Either remove it completely or uncomment it if it's needed for future implementation.

export interface DeviceBase {
  identifier?: string;
  status: DeviceStatus;
  availability_status: DeviceAvailabilityStatus;
  manufacturer?: string;
  manufacture_date?: string; // datetime
  expiration_date?: string; // datetime
  lot_number?: string;
  serial_number?: string;
  registered_name: string;
  user_friendly_name?: string;
  model_number?: string;
  part_number?: string;
  contact: ContactPoint[];
-  //   care_type: string | undefined;
}
public/locale/en.json (3)

292-298: Verify Consistency in "Add" Action Keys
New localization entries for "add_condition", "add_consultation", "add_consultation_update", "add_contact_point", and "add_device" have been introduced. Please verify that the capitalization is consistent across these keys (e.g. "Add consultation" uses a lowercase “c” while "Add Condition" uses uppercase “C”).


314-322: Check Consistency for "Add Option/Question" Keys
The entries "add_option" and "add_question" have been added. Ensure these follow the same wording/format conventions used for similar “add_…” keys (for example, decide whether the action words should be uniformly capitalized) and that they reflect the intended UI copy.


2297-2299: Review Deletion Confirmation Warning Messages
The keys:

  • "this_will_permanently_remove_the_exception_and_cannot_be_undone"
  • "this_will_permanently_remove_the_scheduled_template_and_cannot_be_undone"
  • "this_will_permanently_remove_the_session_and_cannot_be_undone"

are introduced to warn users about irreversible actions. While the messages are clear and explicit, consider whether their length is optimal for UI dialogs. If needed, consider a slight rephrasing for brevity without losing clarity.

🛑 Comments failed to post (2)
src/pages/Facility/settings/devices/DevicesList.tsx (1)

47-52: ⚠️ Potential issue

Route to create device should include facilityId.

The Link component's href is using a static path "/devices/create" which doesn't include the facilityId parameter. This could cause issues when navigating to the device creation page.

Consider updating the Link to include the facilityId parameter:

<Button variant="primary" asChild>
-  <Link href="/devices/create">
+  <Link href={`/facility/${facilityId}/settings/devices/create`}>
    <CareIcon icon="l-plus" className="h-4 w-4 mr-2" />
    {t("add_device")}
  </Link>
</Button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

        <Button variant="primary" asChild>
          <Link href={`/facility/${facilityId}/settings/devices/create`}>
            <CareIcon icon="l-plus" className="h-4 w-4 mr-2" />
            {t("add_device")}
          </Link>
        </Button>
src/pages/Facility/settings/devices/DeviceDetail.tsx (1)

147-148: ⚠️ Potential issue

Device edit link is missing facilityId parameter.

The Link to edit the device doesn't include the facilityId, which might cause routing issues.

-<Link href={`/devices/${deviceId}/edit`}>
+<Link href={`/facility/${facilityId}/settings/devices/${deviceId}/edit`}>
  <Button variant="outline">{t("edit")}</Button>
</Link>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

          <Link href={`/facility/${facilityId}/settings/devices/${deviceId}/edit`}>
            <Button variant="outline">{t("edit")}</Button>
          </Link>

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
public/locale/en.json (1)

604-604: New Localization Key: "collect"
The key "collect": "Collect" is added, presumably to label an action that gathers data or responses. While the label is concise, please verify that “Collect” unambiguously conveys the intended functionality in the context of your interface.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9517093 and 172d323.

📒 Files selected for processing (2)
  • public/locale/en.json (11 hunks)
  • src/components/Questionnaire/QuestionnaireEditor.tsx (25 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Questionnaire/QuestionnaireEditor.tsx
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Redirect rules - care-ohc
  • GitHub Check: Header rules - care-ohc
  • GitHub Check: Test
  • GitHub Check: cypress-run (1)
🔇 Additional comments (10)
public/locale/en.json (10)

295-295: New Localization Key: "add_condition"
The key "add_condition": "Add Condition" is introduced to support UI functionality (e.g. adding a condition in a questionnaire). The naming convention and value are clear and consistent with similar keys.


314-314: New Localization Key: "add_option"
The addition of "add_option": "Add Option" follows the established pattern and provides a clear label for options within forms.


322-322: New Localization Key: "add_question"
The key "add_question": "Add Question" is added for enabling users to add questions in the questionnaire. Its phrasing is direct and aligns with the overall UI language.


599-599: New Localization Key: "clone_questionnaire"
The key "clone_questionnaire": "Clone Questionnaire" is provided to label an action that duplicates a questionnaire. Ensure that this term is used consistently in the UI and does not conflict with any similar action labels.


867-867: New Localization Key: "edit_form"
The addition of "edit_form": "Edit Form" is straightforward and matches the UI’s tone for form actions. It is consistent with similar keys already present in the file.


1164-1164: New Localization Key: "form_preview"
The key "form_preview": "Preview form" provides a clear label for the preview functionality. Ensure that its usage in the application is not confused with other similar terms (for example, review any potential redundancy with keys like "previous_form" noted in past reviews).


1484-1484: New Localization Key: "move_down"
The key "move_down": "Move Down" has been added for UI interactions involving the reordering of elements. Its language is clear and fits with the application’s style.


1486-1486: New Localization Key: "move_up"
Similarly, "move_up": "Move Up" provides a label for upward movement actions. It is consistent with the “move_down” key and with the overall language of the platform.


1937-1937: New Localization Key: "repeatable"
The key "repeatable": "Repeatable" is introduced likely to indicate that a particular question or element can be repeated. Its wording is simple and fits well within the UI context.


1581-1581: New Localization Key: "no_requested_questionnaires_found"
This key with the text "The requested questionnaire could not be found." offers a clear and user-friendly error message when a questionnaire cannot be retrieved. It is well formulated for localization purposes.

@ashwinpraveengo ashwinpraveengo force-pushed the issues/10725/Remove-Unnecessary-Arrow branch from 172d323 to f0ec2dd Compare February 26, 2025 08:04
Jacobjeevan
Jacobjeevan previously approved these changes Feb 26, 2025
Copy link
Contributor

@Jacobjeevan Jacobjeevan left a comment

Choose a reason for hiding this comment

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

Clear merge conflict.

@ashwinpraveengo ashwinpraveengo force-pushed the issues/10725/Remove-Unnecessary-Arrow branch from f0ec2dd to d6f192c Compare February 26, 2025 11:24
@Jacobjeevan Jacobjeevan dismissed their stale review February 26, 2025 11:51

Inaccurate translations

@github-actions github-actions bot removed the merge conflict pull requests with merge conflict label Feb 27, 2025
@github-actions github-actions bot added the merge conflict pull requests with merge conflict label Feb 28, 2025
Copy link

Conflicts have been detected against the base branch. Please merge the base branch into your branch.
cc: @ashwinpraveengo

See: https://docs.ohc.network/docs/contributing#how-to-resolve-merge-conflicts

@ashwinpraveengo ashwinpraveengo force-pushed the issues/10725/Remove-Unnecessary-Arrow branch from f2deb43 to 95c2901 Compare March 2, 2025 13:07
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
src/types/questionnaire/question.ts (1)

36-43: 💡 Verification agent

🧩 Analysis chain

Breaking change: "location_association" removed from StructuredQuestionType.

The PR removes the "location_association" option from the StructuredQuestionType union type. This is a breaking change that could affect code depending on this value.


🏁 Script executed:

#!/bin/bash
# Find usages of "location_association" in the codebase
rg "location_association" --type ts

Length of output: 359


Attention: Update Needed for "location_association" References

The removal of "location_association" from the StructuredQuestionType union is indeed a breaking change. Our search revealed that the string literal is still being referenced in src/components/Location/LocationSheet.tsx (e.g., in toast messages and translation keys). Please review and update these usages to ensure consistency with the removed type option.

  • Location for Type Change: src/types/questionnaire/question.ts (Lines 36-43)
  • Affected Usage: src/components/Location/LocationSheet.tsx
🧹 Nitpick comments (12)
src/components/Common/AvatarEditModal.tsx (1)

241-241: Consider using optional chaining for safer access.

The current code might throw an error if preview is undefined or null.

-                          preview && preview.startsWith("blob:")
+                          preview && preview?.startsWith("blob:")
🧰 Tools
🪛 Biome (1.9.4)

[error] 241-241: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

src/CAREUI/interactive/Zoom.tsx (1)

71-71: Changed positioning from absolute to fixed for zoom controls.

Changing from absolute to fixed positioning will make the zoom controls remain in the same position relative to the viewport rather than relative to their nearest positioned ancestor. This ensures the controls remain visible regardless of page scrolling.

This UI improvement seems unrelated to the PR objective of "removing the left arrow icon from the cancel button." Please confirm if this change should be included in this PR or moved to a separate PR for zoom control enhancements.

src/App.tsx (1)

28-37: Improved network resilience with smarter retry logic.

The new implementation selectively retries only on transient errors (network errors or gateway/server errors) and limits retries to 3 attempts. This approach is more efficient than the previous static retry count as it:

  1. Avoids unnecessary retries for client errors
  2. Properly handles temporary network or server issues
  3. Prevents excessive retries that could overload the system
src/components/Common/PrintTable.tsx (1)

57-57: Consider adding more robust null/undefined handling.

The current fallback only handles undefined values, but not null values or empty strings.

-                    {row[key] || "-"}
+                    {row[key] != null && row[key] !== "" ? row[key] : "-"}
src/components/Patient/PatientRegistration.tsx (1)

609-615: Consider handling state updates more consistently.

When unchecking the deceased status, the code sets death_datetime to null, but when updating via the datetime input, it sets to undefined. Consider using the same value for consistency.

                        setIsDeceased(checked as boolean);
                        form.setValue(
                          "death_datetime",
-                         checked ? form.getValues("death_datetime") : null,
+                         checked ? form.getValues("death_datetime") : undefined,
                        );
src/components/Common/FilePreviewDialog.tsx (2)

120-128: Consider using a more specific type than any
In setFileState((prev: any) => ...), using any may lead to type safety issues. Prefer using the StateInterface type or another suitable interface instead.

- setFileState((prev: any) => {
+ setFileState((prev: StateInterface) => {

252-252: Minor style suggestion
You might consider using overflow-auto here to hide scrollbars when not needed.

- <div className="... overflow-scroll ...">
+ <div className="... overflow-auto ...">
src/components/Patient/TreatmentSummary.tsx (1)

164-164: Adjust container padding
Using py-2 may suffice in many cases, but consider increasing it for more comfortable spacing in printed views.

src/components/Patient/PatientInfoCard.tsx (1)

174-183: Repetitive expiration date logic.
These lines duplicate the logic from the mobile view section (lines 138-147). Consider extracting it into a helper component or function for maintainability if needed.

src/components/Medicine/MedicationsTable.tsx (1)

43-50: Empty state handling.
Returning a simple “No active medication recorded” message helps user clarity. Optional enhancement: separate “Loading…” from genuine empty states if needed down the line.

src/components/Patient/MedicationStatementList.tsx (1)

79-93: Popover for displaying medication “note.”
Great UI approach for controlling lengthy or sensitive info. The usage of Popover is consistent.

src/common/constants.tsx (1)

116-218:

❓ Verification inconclusive

Verify that these color changes align with accessibility standards.

Ensure that the new color combinations maintain sufficient contrast ratios to comply with accessibility guidelines (WCAG). Also, verify that the new colors match the intended design system and that these changes are documented for other developers.


🏁 Script executed:

#!/bin/bash
# This script checks if there's any design system documentation 
# in the repository that should be updated with these color changes

echo "Searching for design system documentation..."
fd -t f "design-system|colors|theme" --exec grep -l "variant" {} \;

Length of output: 169


Action Required: Confirm Accessibility Compliance & Update Documentation

Please verify that the updated color variants in src/common/constants.tsx adhere to WCAG contrast ratio requirements. Our initial search did not locate any design system or theme documentation referencing these variant values. To move forward, please ensure that:

  • The color choices (blue, pink, orange, purple, red, indigo, teal, yellow) have been evaluated for sufficient contrast and accessibility compliance.
  • Any relevant design system documentation (or style guide) is updated—or created if missing—to clearly document these color changes for future reference.
🛑 Comments failed to post (1)
src/components/ui/sidebar.tsx (1)

650-650: ⚠️ Potential issue

Fix typo in class name string.

There are two consecutive dots in the class name string which appears to be a typo.

-          "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground··md:opacity-0",
+          "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

          "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/components/Questionnaire/QuestionnaireEditor.tsx (2)

998-999: Consider using i18next pluralization for better localization

The current implementation handles pluralization manually by adding an "s" suffix, which won't work for many languages. Consider using i18next's built-in pluralization features for better internationalization.

-                        {questionnaire.questions?.length || 0} {t("question")}
-                        {questionnaire.questions?.length !== 1 ? "s" : ""}
+                        {t("questions_count", { count: questionnaire.questions?.length || 0 })}

1420-1421: Incomplete internationalization: "Read Only" text is not translated

While most of the UI text has been internationalized, "Read Only" remains hardcoded. For consistency, this should also use the translation function.

-                      Read Only
+                      {t("read_only")}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2deb43 and df59624.

📒 Files selected for processing (2)
  • public/locale/en.json (12 hunks)
  • src/components/Questionnaire/QuestionnaireEditor.tsx (28 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • public/locale/en.json
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test
  • GitHub Check: cypress-run (1)
🔇 Additional comments (3)
src/components/Questionnaire/QuestionnaireEditor.tsx (3)

821-823: Left arrow icon has been successfully removed from cancel button

This change fulfills the PR objective to remove the arrow icon from the cancel button, leaving only the translated text.


753-753: Translation key for error message implemented correctly

Good job implementing internationalization for the error message when a questionnaire is not found.


842-842:

❓ Verification inconclusive

"previous_form" might be a typo or mistranslation

It seems like there might be a typo in the translation key. This is labeled "Preview" in line 1127, but here it uses t("previous_form") instead of what would be expected (t("preview_form")).


🏁 Script executed:

#!/bin/bash
# Verify translation key usage
grep -r "previous_form" public/locale/* --include="*.json"
grep -r "preview_form" public/locale/* --include="*.json"

Length of output: 348


Please run the above script to further verify whether the intended translation key exists in the locale files and how it’s used in the component. The previous check returned no output, so manual confirmation of the correct translation key is needed.

Translation key consistency check required:

  • In src/components/Questionnaire/QuestionnaireEditor.tsx (line 842), the component calls t("previous_form") while elsewhere (line 1127) the label suggests a "Preview" state.
  • The initial grep didn’t reveal any definition for either previous_form or preview_form in the locale files. It’s unclear which key is actually defined.
  • Please verify manually whether the intended translation key should be preview_form and ensure that the locale JSON files are updated accordingly.

🏁 Script executed:

[run_scripts]
#!/bin/bash
# Check for translation key definitions in the locale JSON files
rg '"previous_form"' -n public/locale
rg '"preview_form"' -n public/locale

# Verify usage of translation keys in QuestionnaireEditor.tsx
rg 't\("previous_form"\)' -n src/components/Questionnaire/QuestionnaireEditor.tsx
rg 't\("preview_form"\)' -n src/components/Questionnaire/QuestionnaireEditor.tsx

Length of output: 404


Translation Key Mismatch: Verify Intended Key for "Preview"

  • In src/components/Questionnaire/QuestionnaireEditor.tsx (line 842) the code calls t("previous_form"), yet at line 1127 the label indicates "Preview."
  • Our verification did not uncover any definitions for either "previous_form" or "preview_form" in the locale JSON files.
  • Please manually review the locale files and confirm whether the intended key should be preview_form (matching the "Preview" label) or if previous_form is correctly used. Update the translation keys and usage accordingly.

@github-actions github-actions bot removed the merge conflict pull requests with merge conflict label Mar 3, 2025
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.

Remove Unnecessary Arrow Near Cancel Button
3 participants