Skip to content

Conversation

Omri-Levy
Copy link
Contributor

@Omri-Levy Omri-Levy commented Jun 25, 2025

Summary by CodeRabbit

  • New Features

    • Added support for an additional document type (Compound File Binary Format) to the list of recognized download-only files.
  • Refactor

    • Renamed the prop and related variables from shouldDownload to isDocumentWithoutViewer across document-related components for improved clarity.
    • Updated button accessibility and styling in the document toolbar for a better user experience.
  • Chores

    • Updated internal migration reference for workflow services.

Copy link

changeset-bot bot commented Jun 25, 2025

⚠️ No Changeset found

Latest commit: b4ab2df

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Jun 25, 2025

Walkthrough

This update renames the variable and prop shouldDownload to isDocumentWithoutViewer throughout the document management components and hooks, clarifying its intent. The list of download-only MIME types is expanded to include 'application/x-cfb'. Accessibility improvements are made to the download button, and a data-migrations subproject reference is updated.

Changes

File(s) Change Summary
apps/backoffice-v2/src/common/constants.ts Added 'application/x-cfb' to DOWNLOAD_ONLY_MIME_TYPES array.
apps/backoffice-v2/src/pages/Entity/components/Case/Case.Documents.Toolbar.tsx Renamed prop shouldDownload to isDocumentWithoutViewer; improved accessibility for download button.
apps/backoffice-v2/src/pages/Entity/components/Case/Case.Documents.tsx Renamed shouldDownload to isDocumentWithoutViewer in logic and props; updated container CSS classes.
apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useDocuments/useDocumentsLogic.tsx Renamed variable shouldDownload to isDocumentWithoutViewer; always enables useStorageFileByIdQuery.
services/workflows-service/prisma/data-migrations Updated subproject commit reference.

Poem

A hop and a skip, new names take the stage,
isDocumentWithoutViewer—a clearer, wiser page!
New MIME types join the warren,
While buttons grow more caring.
With every commit, the code grows bright—
Hooray for clarity, and features done right!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4b8d1a2 and b4ab2df.

📒 Files selected for processing (5)
  • apps/backoffice-v2/src/common/constants.ts (1 hunks)
  • apps/backoffice-v2/src/pages/Entity/components/Case/Case.Documents.Toolbar.tsx (6 hunks)
  • apps/backoffice-v2/src/pages/Entity/components/Case/Case.Documents.tsx (4 hunks)
  • apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useDocuments/useDocumentsLogic.tsx (2 hunks)
  • services/workflows-service/prisma/data-migrations (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`apps/backoffice-v2/**/*.{ts,tsx}`: Use functional components with TypeScript. I...

apps/backoffice-v2/**/*.{ts,tsx}: Use functional components with TypeScript.
Implement smart/dumb component pattern.
Place components in feature-based directories.
Use compound components for complex UIs.
Follow atomic design principles.
Use React Query for server state and API calls.
Use Context for shared state.
Implement state machines for complex flows.
Use local state for UI-only state.
Follow unidirectional data flow.
Use strict TypeScript configuration.
Define interfaces for all props.
Use discriminated unions for state.
Leverage type inference.
Use Radix UI for accessible components.
Implement proper ARIA attributes.
Follow consistent styling patterns.
Use composition over inheritance.
Keep components small and focused.
Use React Hook Form for forms.
Implement Zod for validation.
Handle form submission states.
Show validation feedback.
Use controlled inputs when needed.
Implement proper loading states for data fetching.
Handle error states gracefully.
Cache responses appropriately.
Type API responses.
Use error boundaries.
Implement fallback UI.
Handle async errors.
Show user-friendly error messages.
Log errors appropriately.
Use React.memo wisely.
Implement proper code splitting.
Use lazy loading for routes.
Optimize re-renders.
Profile performance regularly.
Write unit tests for components.
Use React Testing Library.
Mock external dependencies in tests.
Maintain good test coverage.
Follow feature-based organization.
Use index files for exports.
Keep related files together.
Use consistent naming.
Implement barrel exports.
Use Tailwind CSS for styling.
Follow utility-first approach for styling.
Use CSS variables for theming.
Keep styles maintainable.
Use CSS modules when needed.
Document complex logic.
Write clear component documentation.
Keep documentation up to date.
Use JSDoc when helpful.
Follow ESLint rules.
Use consistent formatting.
Write clear variable names.
Keep functions pure.
Use meaningful types.
Validate user input.
Implement proper authentication.
Handle sensitive data carefully.
Follow security best practices.
Use HTTPS for API calls.
Follow WCAG guidelines for accessibility.
Use semantic HTML.
Test with screen readers.
Ensure keyboard navigation.
Provide proper focus management.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/backoffice-v2.mdc)

List of files the instruction was applied to:

  • apps/backoffice-v2/src/common/constants.ts
  • apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useDocuments/useDocumentsLogic.tsx
  • apps/backoffice-v2/src/pages/Entity/components/Case/Case.Documents.Toolbar.tsx
  • apps/backoffice-v2/src/pages/Entity/components/Case/Case.Documents.tsx
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: test_linux
  • GitHub Check: lint
🔇 Additional comments (11)
services/workflows-service/prisma/data-migrations (1)

1-1: Submodule pointer bumped – please confirm CI/CD & local environments pull the new commit

The file now references 493a22283db566fbcd5381e71c6709223950370b.
Ensure that:

  1. The referenced hash exists on the remote repository (no force-push loss).
  2. All CI jobs (build, migrate, deploy) run git submodule update --init --recursive so the new migrations are actually present when the service starts.
  3. Any pending Prisma migration files introduced in that submodule revision are applied in staging before merging.

If you have already verified these, feel free to ignore. Otherwise, a quick check prevents runtime schema drift.

apps/backoffice-v2/src/common/constants.ts (1)

4-4: LGTM! Valid MIME type addition.

The application/x-cfb MIME type for Compound File Binary format is correctly added to the download-only types list, appropriately positioned among Excel-related formats.

apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useDocuments/useDocumentsLogic.tsx (2)

61-61: Excellent semantic improvement!

The renaming from shouldDownload to isDocumentWithoutViewer significantly improves code readability and clearly expresses the intent - identifying documents that cannot be viewed and must be downloaded.


82-82: Consistent return value naming.

The returned value maintains consistency with the internal variable renaming.

apps/backoffice-v2/src/pages/Entity/components/Case/Case.Documents.tsx (3)

50-50: Good variable renaming for clarity.

Consistent with the hook's return value renaming, improving semantic clarity.


59-59: Conditional logic correctly updated.

The component properly uses the renamed variable in both conditional rendering blocks.

Also applies to: 76-76


77-77: Improved responsive design.

The change from fixed width (w-[441px]) to responsive full width with fixed height (h-[600px] w-full) provides better layout flexibility.

apps/backoffice-v2/src/pages/Entity/components/Case/Case.Documents.Toolbar.tsx (4)

54-54: Consistent prop interface update.

The prop renaming from shouldDownload to isDocumentWithoutViewer maintains consistency across the component API and improves semantic clarity.

Also applies to: 66-66


112-112: Correctly updated button disabled states.

All toolbar buttons consistently use the renamed variable for their disabled conditions.

Also applies to: 130-130, 169-169


142-146: Excellent UX improvement for disabled state.

The conditional styling (pointer-events-none opacity-50) provides clear visual feedback when the download button is unavailable, improving user experience.


152-155: Outstanding accessibility implementation!

The addition of aria-disabled and conditional tabIndex={-1} follows WCAG guidelines perfectly, ensuring screen readers and keyboard navigation work correctly for disabled download links.

@@ -85,7 +85,7 @@ export const Documents: FunctionComponent<IDocumentsProps> = ({
onRotateDocument={onRotateDocument}
onOpenDocumentInNewTab={onOpenDocumentInNewTab}
// isRotatedOrTransformed={isRotatedOrTransformed}
shouldDownload={shouldDownload}
shouldDownload={isDocumentWithoutViewer}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix prop name inconsistency.

The DocumentsToolbar component interface expects isDocumentWithoutViewer prop, but you're passing shouldDownload. This will cause a TypeScript error.

Apply this fix:

-            shouldDownload={isDocumentWithoutViewer}
+            isDocumentWithoutViewer={isDocumentWithoutViewer}
📝 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.

Suggested change
shouldDownload={isDocumentWithoutViewer}
isDocumentWithoutViewer={isDocumentWithoutViewer}
🤖 Prompt for AI Agents
In apps/backoffice-v2/src/pages/Entity/components/Case/Case.Documents.tsx at
line 88, replace the prop name `shouldDownload` with `isDocumentWithoutViewer`
when passing props to the DocumentsToolbar component to match its expected
interface and avoid TypeScript errors.

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

Successfully merging this pull request may close these issues.

1 participant