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

Implemented Next and Previous button for files preview #9196

Conversation

sarvesh-official
Copy link
Contributor

@sarvesh-official sarvesh-official commented Nov 25, 2024

Add Next/Previous Navigation in File Preview Dialog

Fixes #8321

Changes Made

  • Added navigation buttons to allow users to move between files in the preview dialog
  • Implemented proper file ordering with oldest files first and newest files last
  • Added file creation date/time display for better context
  • Improved file name display with larger font size
  • Reduced "File Preview" title size for better visual hierarchy

Implementation Details

  1. Navigation Controls

    • Added Previous/Next buttons in the file preview dialog
    • Previous button shows for files after index 0
    • Next button shows for files before the last index
    • Buttons are hidden when no navigation is possible
  2. File Order & Display

    • Reversed file array to show oldest files first
    • Added file creation timestamp below file name
    • Increased file name font size for better readability
    • Reduced modal title size
  3. State Management

    • Added currentIndex tracking for proper navigation
    • Implemented proper index management during navigation
    • Added checks to prevent navigation beyond bounds

Screenshots/Videos

image

Next_and_Previous_Navigation.mp4

QA Checklist

  • Test navigation between multiple files
  • Verify correct file order display
  • Check creation date/time accuracy
  • Test edge cases (single file, first file, last file)
  • Verify navigation button visibility logic
  • Test with different file types (images, PDFs, etc.)

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced file upload capabilities in the FilePreviewDialog, allowing users to navigate through multiple uploaded files with improved display of file information.
    • Added contextual handling of uploaded files with new properties in the FileUpload component.
    • Introduced keyboard navigation for file previewing, enhancing user interactivity.
  • Bug Fixes

    • Minor adjustments to the FileUploadPage component for improved code cleanliness.
  • Documentation

    • Updated interfaces to reflect new properties related to file uploads and management.

These changes aim to improve user experience by streamlining file handling and navigation within the application.

@sarvesh-official sarvesh-official requested a review from a team as a code owner November 25, 2024 08:39
Copy link
Contributor

coderabbitai bot commented Nov 25, 2024

Walkthrough

The changes involve modifications to several components and hooks within the codebase to enhance file management and preview capabilities. The .prettierignore file now includes *.bs.js, reversing its previous exclusion. The FilePreviewDialog component is updated to support multiple uploaded files with navigation buttons for previous and next files. The FileUpload component's state management is enhanced with new properties, and the useFileManager hook is modified to track the current file index. Minor whitespace adjustments were made in the FileUploadPage component.

Changes

File Change Summary
.prettierignore Changed entry for *.bs.js from excluded to included.
src/components/Common/FilePreviewDialog.tsx Added properties uploadedFiles, loadFile, and currentIndex to FilePreviewProps. Updated internal state and methods for file navigation.
src/components/Files/FileUpload.tsx Added optional properties id and associating_id to StateInterface. Updated uploadedFiles mapping.
src/components/Patient/FileUploadPage.tsx Removed unnecessary whitespace lines; no functional changes.
src/hooks/useFileManager.tsx Added uploadedFiles to FileManagerOptions interface. Introduced currentIndex state variable.

Assessment against linked issues

Objective Addressed Explanation
Add Next and Previous Scroll button for files preview (#8321)
Increase font size of the file name and add "Created on date and time" (#8321) No changes related to font size or date display were made.

Suggested labels

tested

Suggested reviewers

  • rithviknishad
  • Jacobjeevan
  • khavinshankar

Poem

Hop along, dear friends, let's cheer,
For files now dance, both far and near!
With buttons to guide, and dates to show,
Navigating files, oh what a flow!
In the land of code, we leap and bound,
A joyful update, in hops profound! 🐇✨


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 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.

Copy link

netlify bot commented Nov 25, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit ba4d4c0
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/674437abbb836d0008102a25
😎 Deploy Preview https://deploy-preview-9196--care-ohc.netlify.app
📱 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

netlify bot commented Nov 25, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit fd2ccd8
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/67493ab64f07db0008ee8db5
😎 Deploy Preview https://deploy-preview-9196--care-ohc.netlify.app
📱 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 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: 2

🧹 Outside diff range and nitpick comments (5)
src/components/Common/FilePreviewDialog.tsx (3)

80-86: Consider simplifying the useEffect

The current implementation can be simplified by removing the redundant uploadedFiles check since the show condition is sufficient.

  useEffect(() => {
-   if (uploadedFiles && show) {
+   if (show) {
      setIndex(currentIndex);
    }
  }, [uploadedFiles, show, currentIndex]);

149-149: Improve metadata display with optional chaining and accessibility

The file metadata section could benefit from:

  1. Using optional chaining as suggested by static analysis
  2. Adding proper ARIA labels for screen readers
- <span className="text-sm text-gray-600">{t("file_preview")}</span>
+ <span className="text-sm text-gray-600" role="heading" aria-level="1">{t("file_preview")}</span>

  <div className="mb-2 flex flex-col items-start justify-between md:flex-row">
-   <div>
+   <div role="contentinfo" aria-label="File information">
      <p className="text-xl font-semibold text-gray-800">
        {file_state.name}.{file_state.extension}
      </p>
-     {uploadedFiles &&
-       uploadedFiles[index] &&
-       uploadedFiles[index].created_date && (
+     {uploadedFiles?.[index]?.created_date && (
        <p className="text-sm text-gray-500">
          Created on{" "}
          {new Date(
-           uploadedFiles[index].created_date!,
+           uploadedFiles[index].created_date,
          ).toLocaleString()}
        </p>
      )}
    </div>

Also applies to: 154-169


187-194: Add keyboard navigation support

While the navigation buttons are implemented correctly, consider adding keyboard support for better accessibility.

  <ButtonV2
    className="cursor-pointer bg-primary-500 rounded-md mr-2"
    onClick={() => handleNext(index - 1)}
+   aria-label="Previous file"
+   onKeyDown={(e) => e.key === 'ArrowLeft' && handleNext(index - 1)}
  >
    <CareIcon icon="l-arrow-left" className="h-4 w-4" />
  </ButtonV2>

  {/* ... */}

  <ButtonV2
    className="cursor-pointer bg-primary-500 rounded-md"
    onClick={() => handleNext(index + 1)}
+   aria-label="Next file"
+   onKeyDown={(e) => e.key === 'ArrowRight' && handleNext(index + 1)}
  >
    <CareIcon icon="l-arrow-right" className="h-4 w-4" />
  </ButtonV2>

Also applies to: 233-243

src/hooks/useFileManager.tsx (2)

85-86: Add validation for file.id

While the index finding logic is correct, consider validating file.id before searching to prevent potential issues.

-const index = uploadedFiles?.findIndex((f) => f.id === file.id) ?? -1;
+const index = file.id && uploadedFiles?.findIndex((f) => f.id === file.id) ?? -1;

232-237: Consider memoizing FilePreviewDialog props

While the props are correctly passed, consider memoizing the component or its callbacks to prevent unnecessary re-renders.

+const handleLoadFile = useCallback(
+  (file: FileUploadModel, associating_id: string) => {
+    viewFile(file, associating_id);
+  },
+  [viewFile]
+);

 <FilePreviewDialog
   show={file_state.open}
   fileUrl={fileUrl}
   file_state={file_state}
   setFileState={setFileState}
   downloadURL={downloadURL}
   uploadedFiles={uploadedFiles}
   onClose={handleFilePreviewClose}
   fixedWidth={false}
   className="h-[80vh] w-full md:h-screen"
-  loadFile={viewFile}
+  loadFile={handleLoadFile}
   currentIndex={currentIndex}
 />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between fdfc53d and b8d9a06.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • .prettierignore (1 hunks)
  • src/components/Common/FilePreviewDialog.tsx (8 hunks)
  • src/components/Files/FileUpload.tsx (2 hunks)
  • src/components/Patient/FileUploadPage.tsx (0 hunks)
  • src/hooks/useFileManager.tsx (5 hunks)
💤 Files with no reviewable changes (1)
  • src/components/Patient/FileUploadPage.tsx
✅ Files skipped from review due to trivial changes (1)
  • .prettierignore
🧰 Additional context used
🪛 Biome (1.9.4)
src/components/Common/FilePreviewDialog.tsx

[error] 159-161: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (6)
src/components/Common/FilePreviewDialog.tsx (1)

46-48: LGTM: Props structure aligns with navigation requirements

The new props (uploadedFiles, loadFile, currentIndex) are well-typed and properly structured to support the file navigation feature.

src/components/Files/FileUpload.tsx (3)

72-73: LGTM: Interface changes support file navigation feature

The addition of optional id and associating_id fields to StateInterface appropriately supports the file navigation functionality.


Line range hint 1-1: Verify implementation of remaining PR objectives

Several PR objectives don't appear to be implemented in this file:

  • Next/Previous navigation buttons
  • File creation timestamp display
  • Font size adjustments

Let's locate the remaining implementations:


213-220: ⚠️ Potential issue

Consider handling file ordering at the API level

The current implementation of reversing files has several issues:

  1. Performance: slice().reverse() creates a new array on every render
  2. Consistency: Reversing after pagination could lead to incorrect ordering as you're only reversing the current page
  3. Pagination: The current approach doesn't provide true oldest-first ordering across pages

Consider these alternatives:

  1. Preferred: Handle ordering at the API level by adding a sort parameter:
 const activeFilesQuery = useQuery(routes.viewUpload, {
   query: {
     file_type: type,
     associating_id: associatedId,
     is_archived: false,
     limit: RESULTS_PER_PAGE_LIMIT,
     offset: offset,
+    sort_by: "created_at",
+    order: "asc",
   },
 });
  1. If API changes aren't possible, move the reversal logic to the query transform:
-    uploadedFiles:
-      fileQuery?.data?.results
-        .slice()
-        .reverse()
-        .map((file) => ({
-          ...file,
-          associating_id: associatedId,
-        })) || [],
+    uploadedFiles: (fileQuery?.data?.results || []).map((file) => ({
+      ...file,
+      associating_id: associatedId,
+    })),

Let's verify if the API supports sorting:

src/hooks/useFileManager.tsx (2)

52-52: LGTM! Clean destructuring of new prop

The new uploadedFiles prop is correctly destructured alongside existing options.


27-27: LGTM! Verify usage of optional prop

The optional uploadedFiles prop is correctly typed and maintains backward compatibility.

✅ Verification successful

Optional uploadedFiles prop is safely implemented

The verification shows that the optional uploadedFiles prop maintains backward compatibility:

  • PatientConsentRecords.tsx and one instance in FileUpload.tsx don't provide the prop, working with the default undefined value
  • Only one instance in FileUpload.tsx uses the new prop with fileQuery?.data?.results
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify that existing usages of useFileManager don't break
rg "useFileManager\(" --type typescript

Length of output: 76


Script:

#!/bin/bash
# Search for useFileManager hook usage with common TypeScript/JavaScript file extensions
rg "useFileManager\(" -t js -t jsx -t ts -t tsx

Length of output: 77


Script:

#!/bin/bash
# Find all JavaScript/TypeScript files first, then search for useFileManager usage
fd -e js -e jsx -e ts -e tsx | xargs rg "useFileManager\("

Length of output: 383


Script:

#!/bin/bash
# Check how useFileManager is used in the components
echo "=== PatientConsentRecords.tsx ==="
rg -A 5 "useFileManager\(" src/components/Patient/PatientConsentRecords.tsx

echo -e "\n=== FileUpload.tsx ==="
rg -A 5 "useFileManager\(" src/components/Files/FileUpload.tsx

Length of output: 723

src/components/Common/FilePreviewDialog.tsx Outdated Show resolved Hide resolved
src/hooks/useFileManager.tsx Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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

🧹 Outside diff range and nitpick comments (2)
src/components/Common/FilePreviewDialog.tsx (2)

80-86: Add validation for index bounds in useEffect

While the effect handles basic state updates, consider adding bounds checking to prevent invalid indices when uploadedFiles changes.

 useEffect(() => {
   if (uploadedFiles && show) {
+    const validIndex = Math.min(Math.max(currentIndex, 0), uploadedFiles.length - 1);
-    setIndex(currentIndex);
+    setIndex(uploadedFiles.length > 0 ? validIndex : -1);
   }
 }, [uploadedFiles, show, currentIndex]);

162-171: Simplify conditional rendering with optional chaining

The nested conditions can be simplified using optional chaining for better readability.

-              {uploadedFiles &&
-                uploadedFiles[index] &&
-                uploadedFiles[index].created_date && (
+              {uploadedFiles?.[index]?.created_date && (
                   <p className="text-sm text-gray-500">
                     Created on{" "}
                     {new Date(
-                      uploadedFiles[index].created_date!,
+                      uploadedFiles[index].created_date,
                     ).toLocaleString()}
                   </p>
                 )}
🧰 Tools
🪛 Biome (1.9.4)

[error] 162-164: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b8d9a06 and 7e273b4.

📒 Files selected for processing (1)
  • src/components/Common/FilePreviewDialog.tsx (8 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/components/Common/FilePreviewDialog.tsx

[error] 162-164: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (2)
src/components/Common/FilePreviewDialog.tsx (2)

46-48: LGTM: Well-structured type definitions for file navigation

The new props provide proper typing for managing multiple files and navigation functionality.


104-119: LGTM: Navigation logic implements proper error handling

The implementation includes proper null checks and error handling as previously suggested.

src/components/Common/FilePreviewDialog.tsx Outdated Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (5)
src/components/Common/FilePreviewDialog.tsx (5)

46-48: Consider making currentIndex an optional prop

The currentIndex prop should be optional with a default value since there might be cases where we're showing a single file without navigation context.

-  currentIndex: number;
+  currentIndex?: number;

82-86: Optimize useEffect implementation

The effect can be simplified and should include cleanup for state reset:

  useEffect(() => {
-   if (uploadedFiles && show) {
-     setIndex(currentIndex);
-   }
+   setIndex(show ? currentIndex : -1);
+   return () => setIndex(-1);
  }, [uploadedFiles, show, currentIndex]);

165-172: Use user's locale for timestamp formatting

The timestamp formatting is hardcoded to 'en-US'. Consider using the user's locale or a prop-based locale setting.

- ).toLocaleString("en-US", {
+ ).toLocaleString(undefined, {  // Uses user's locale

193-200: Reduce code duplication in navigation buttons

The Next and Previous button implementations are very similar. Consider extracting a reusable navigation button component.

type NavButtonProps = {
  direction: 'prev' | 'next';
  onClick: () => void;
};

const NavigationButton = ({ direction, onClick }: NavButtonProps) => (
  <ButtonV2
    className={`cursor-pointer bg-primary-500 rounded-md ${
      direction === 'prev' ? 'mr-2' : ''
    }`}
    onClick={onClick}
  >
    <CareIcon
      icon={direction === 'prev' ? 'l-arrow-left' : 'l-arrow-right'}
      className="h-4 w-4"
    />
  </ButtonV2>
);

Then use it like:

- {uploadedFiles && uploadedFiles.length > 1 && index > 0 && (
-   <ButtonV2
-     className="cursor-pointer bg-primary-500 rounded-md mr-2"
-     onClick={() => handleNext(index - 1)}
-   >
-     <CareIcon icon="l-arrow-left" className="h-4 w-4" />
-   </ButtonV2>
- )}
+ {uploadedFiles?.length > 1 && index > 0 && (
+   <NavigationButton
+     direction="prev"
+     onClick={() => handleNext(index - 1)}
+   />
+ )}

Also applies to: 240-249


162-164: Use optional chaining for better readability

The nested condition checks can be simplified using optional chaining.

- {uploadedFiles &&
-   uploadedFiles[index] &&
-   uploadedFiles[index].created_date && (
+ {uploadedFiles?.[index]?.created_date && (
🧰 Tools
🪛 Biome (1.9.4)

[error] 162-164: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7e273b4 and 62e6ef7.

📒 Files selected for processing (1)
  • src/components/Common/FilePreviewDialog.tsx (8 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/components/Common/FilePreviewDialog.tsx

[error] 162-164: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

@sarvesh-official
Copy link
Contributor Author

Hi @rithviknishad, could you please review the PR as soon as possible? Let me know if it's good to merge, or feel free to suggest any changes. Thanks!

@github-actions github-actions bot added needs-triage question Further information is requested labels Nov 25, 2024
@nihal467 nihal467 added needs testing needs review and removed question Further information is requested needs-triage labels Nov 25, 2024
src/components/Common/FilePreviewDialog.tsx Outdated Show resolved Hide resolved
src/components/Common/FilePreviewDialog.tsx Outdated Show resolved Hide resolved
src/components/Common/FilePreviewDialog.tsx Outdated Show resolved Hide resolved
src/components/Common/FilePreviewDialog.tsx Outdated Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (4)
src/components/Common/FilePreviewDialog.tsx (4)

46-48: Consider improving type safety for navigation props

The loadFile prop is marked optional but is required when uploadedFiles is present. Consider making this relationship explicit in the types.

-  uploadedFiles?: FileUploadModel[];
-  loadFile?: (file: FileUploadModel, associating_id: string) => void;
-  currentIndex: number;
+  uploadedFiles?: {
+    files: FileUploadModel[];
+    loadFile: (file: FileUploadModel, associating_id: string) => void;
+    currentIndex: number;
+  };

104-115: Simplify navigation handler with optional chaining

The navigation handler can be simplified while maintaining the same safety checks.

 const handleNext = (newIndex: number) => {
-  if (!uploadedFiles?.length) return;
-  if (!loadFile) return;
-  if (newIndex < 0 || newIndex >= uploadedFiles.length) return;
-
-  const nextFile = uploadedFiles[newIndex];
-  if (!nextFile?.id) return;
+  const nextFile = uploadedFiles?.[newIndex];
+  if (!nextFile?.id || !loadFile || newIndex < 0 || newIndex >= (uploadedFiles?.length ?? 0)) {
+    return;
+  }

   const associating_id = nextFile.associating_id || "";
   loadFile(nextFile, associating_id);
   setIndex(newIndex);
 };

173-185: Simplify conditional rendering with optional chaining

Following the static analysis suggestion, the nested conditions can be simplified.

-              {uploadedFiles &&
-                uploadedFiles[index] &&
-                uploadedFiles[index].created_date && (
+              {uploadedFiles?.[index]?.created_date && (
                   <p className="mt-1 text-sm text-gray-600">
                     Created on{" "}
                     {new Date(
-                      uploadedFiles[index].created_date!,
+                      uploadedFiles[index].created_date,
                     ).toLocaleString("en-US", {
                       dateStyle: "long",
                       timeStyle: "short",
                     })}
                   </p>
                 )}
🧰 Tools
🪛 Biome (1.9.4)

[error] 173-175: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


206-206: Adjust navigation button margins for better spacing

The margins between the navigation buttons and the image container should be consistent.

-                className="cursor-pointer bg-primary-500 rounded-md mr-4"
+                className="cursor-pointer bg-primary-500 rounded-md mx-6"
-                className="cursor-pointer bg-primary-500 rounded-md ml-4"
+                className="cursor-pointer bg-primary-500 rounded-md mx-6"

Also applies to: 258-258

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 62e6ef7 and 82a581b.

📒 Files selected for processing (1)
  • src/components/Common/FilePreviewDialog.tsx (8 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/components/Common/FilePreviewDialog.tsx

[error] 173-175: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (2)
src/components/Common/FilePreviewDialog.tsx (2)

80-86: LGTM: Clean state management implementation

The state management for the file index is well-implemented with proper effect dependencies.


141-154: LGTM: Well-implemented keyboard navigation

The keyboard navigation implementation is clean with proper cleanup and matches the button behavior.

@sarvesh-official
Copy link
Contributor Author

Hi @Jacobjeevan, I have updated the required changes, could you please review the PR again?

@github-actions github-actions bot added needs-triage question Further information is requested labels Nov 26, 2024
@nihal467
Copy link
Member

LGTM

@sarvesh-official
Copy link
Contributor Author

Hi @rithviknishad could you please review?

@github-actions github-actions bot added needs-triage question Further information is requested labels Nov 28, 2024
@Jacobjeevan Jacobjeevan removed question Further information is requested needs-triage labels Nov 28, 2024
.prettierignore Outdated Show resolved Hide resolved
@sarvesh-official
Copy link
Contributor Author

Hi @rithviknishad, do I need to make any changes, or is this PR good to merge?

@github-actions github-actions bot added needs-triage question Further information is requested labels Nov 29, 2024
@rithviknishad rithviknishad removed question Further information is requested needs-triage labels Nov 29, 2024
@rithviknishad rithviknishad merged commit c407120 into ohcnetwork:develop Nov 29, 2024
5 checks passed
Copy link

@sarvesh-official Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Next and Previous Scroll button for files preview
4 participants