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

chat iframe revert #2737

Merged
merged 1 commit into from
Sep 30, 2024
Merged

chat iframe revert #2737

merged 1 commit into from
Sep 30, 2024

Conversation

Omri-Levy
Copy link
Contributor

@Omri-Levy Omri-Levy commented Sep 30, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced dialog for document re-upload requests with improved styling and functionality.
    • Updated KYC verification UI with dynamic button states and refined decision status indicators.
    • Added a toggle for multiple case creation in the case submission section.
  • Bug Fixes

    • Simplified rendering logic for the chatbot component, improving performance and usability.
  • Style

    • Updated button styles across various components for a more consistent visual experience.

Copy link

changeset-bot bot commented Sep 30, 2024

⚠️ No Changeset found

Latest commit: 8fc7572

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 Sep 30, 2024

Walkthrough

The pull request introduces several modifications across multiple components in the application, focusing on UI enhancements and logic adjustments. Key changes include updates to button styling in the CaseCallToActionLegacy and SubmitSection components, improvements in the useKycBlock hook for KYC verification processes, and simplifications in the Root.page.tsx file's rendering logic. Additionally, a version control update is noted in the workflows-service/prisma/data-migrations directory.

Changes

File Change Summary
apps/backoffice-v2/src/lib/blocks/components/CaseCallToActionLegacy/CaseCallToActionLegacy.tsx Updated button styling and logic for document re-upload dialog, including direct handling of comments in the onClick event.
apps/backoffice-v2/src/lib/blocks/components/KycBlock/hooks/useKycBlock/useKycBlock.tsx Enhanced approval logic and UI rendering for KYC verification, including dynamic button styling based on state and improved badge generation for decision statuses.
apps/backoffice-v2/src/pages/Entities/components/CaseCreation/components/CaseCreationForm/components/SubmitSection/SubmitSection.tsx Modified button styling for submit action while retaining existing rendering logic and added a switch for multiple case creation.
apps/backoffice-v2/src/pages/Root/Root.page.tsx Simplified rendering logic for ChatbotLayout by removing unnecessary iframe wrapper and related imports.
services/workflows-service/prisma/data-migrations Updated subproject commit identifier reflecting version control changes.

Possibly related PRs

  • fix: fixed case page layout #2373: Changes in the CaseCallToActionLegacy component's button styling may relate to adjustments in the Case.Actions.tsx file for UI consistency.
  • Fixed reports #2454: Modifications in the BusinessReportSummary component could affect data presentation, similar to changes in the CaseCallToActionLegacy component.
  • Removed risk score from UI elements #2491: Removal of risk score elements from UI components may connect with changes in the CaseCallToActionLegacy component regarding information display.
  • Blocks data sorting #2709: Sorting logic introduced in the Details component may relate to user experience improvements seen in the CaseCallToActionLegacy component.
  • Documents block sort #2730: Updates to the useDocumentBlocks hook for document management could influence the CaseCallToActionLegacy component's user interactions for document re-uploads.

Suggested labels

bug_fix, Review effort [1-5]: 3, Bug fix

Suggested reviewers

  • MatanYadaev

Poem

In the land of code, we hop and play,
With buttons styled in a bright new way.
A dialog prompts, "Please re-upload,"
As KYC flows smoothly down the road.
Hooray for changes, let’s celebrate,
A brighter UI for all to appreciate! 🐇✨


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
Collaborator

@tomer-shvadron tomer-shvadron left a comment

Choose a reason for hiding this comment

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

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)
apps/backoffice-v2/src/pages/Root/Root.page.tsx (1)

Line range hint 39-48: Consider cleaning up commented code

While not directly related to the main changes in this PR, I noticed that there's a commented-out ReactQueryDevtools component in the Root component. If this code is no longer needed, it would be good to remove it to keep the codebase clean.

If the ReactQueryDevtools is not going to be used, consider removing the commented code and the related import:

- import React, { FunctionComponent, lazy, useState } from 'react';
+ import React, { FunctionComponent, useState } from 'react';

- const ReactQueryDevtools = lazy(() =>
-   process.env.NODE_ENV !== 'production'
-     ? import('@tanstack/react-query-devtools').then(module => ({
-         default: module.ReactQueryDevtools,
-       }))
-     : Promise.resolve({ default: () => null }),
- );

  export const Root: FunctionComponent = () => {
    return (
      <Providers>
        <ServerDownLayout>
          <Outlet />
        </ServerDownLayout>
        <ChatbotLayout />
-       {/*<Suspense>*/}
-       {/*  <ReactQueryDevtools  />*/}
-       {/*</Suspense>*/}
      </Providers>
    );
  };

If you plan to use ReactQueryDevtools in the future, please add a TODO comment explaining why it's commented out and when it might be re-enabled.

apps/backoffice-v2/src/lib/blocks/components/CaseCallToActionLegacy/CaseCallToActionLegacy.tsx (1)

135-135: Verify visual consistency and document style override

The addition of !bg-foreground to the button's className will change its background color and forcefully override any existing styles. While this change doesn't affect functionality, it may impact the visual consistency of the UI.

  1. Please verify that this style change aligns with the design system and doesn't create inconsistencies with similar buttons elsewhere in the application.
  2. Consider documenting the reason for this specific override, either in a comment or in the component's documentation, to provide context for future developers.

If this style change is intended to be applied more broadly, consider creating a new button variant or updating the existing styles in your CSS/Tailwind configuration instead of using an inline override.

apps/backoffice-v2/src/lib/blocks/components/KycBlock/hooks/useKycBlock/useKycBlock.tsx (3)

311-313: Improved button styling based on disabled state

The conditional application of the !bg-success class when the button is not disabled is a good improvement for visual feedback. This change enhances the user experience by clearly indicating when the button is actionable.

Consider extracting the className logic into a separate variable or utility function for better readability, especially if similar conditional styling is used elsewhere in the component.

const buttonClassName = ctw({
  '!bg-success': !isDisabled,
  // Add any other conditional classes here
});

Then use it in the MotionButton:

className={buttonClassName}

This approach would make the component more maintainable and easier to extend in the future.


Line range hint 193-270: Improved badge rendering logic for different states

The refactoring of the getDecisionStatusOrAction function significantly improves the clarity and maintainability of the code. Each state (REVISION, APPROVED, REJECTED, PENDING_PROCESS) is now explicitly handled, returning a badge with appropriate styling and text.

To further improve the code, consider extracting the common badge creation logic into a separate function to reduce duplication. For example:

const createBadge = (value: string, variant: string, className: string) => 
  createBlocksTyped()
    .addBlock()
    .addCell({
      type: 'badge',
      value,
      props: {
        ...motionBadgeProps,
        variant,
        className: `${badgeClassNames} ${className}`,
      },
    })
    .build()
    .flat(1);

// Usage
if (tags?.includes(StateTag.APPROVED)) {
  return createBadge('Approved', 'success', 'bg-success/20');
}

This refactoring would make the function more concise and easier to maintain, especially if you need to add more states in the future.


Line range hint 1-576: Overall improvements to useKycBlock hook

The changes to the useKycBlock hook have enhanced its functionality without altering its interface. The improvements in data processing and rendering, particularly in handling different KYC verification states, contribute to a more robust and flexible component.

For future iterations, consider breaking down this large hook into smaller, more focused custom hooks. This could improve maintainability and testability. For example:

  1. useKycDocuments for handling document-related logic
  2. useKycDecision for decision-making logic
  3. useKycBadges for badge rendering logic

This separation of concerns would make the code easier to understand and maintain as the component grows in complexity.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between df66c39 and 8fc7572.

📒 Files selected for processing (5)
  • apps/backoffice-v2/src/lib/blocks/components/CaseCallToActionLegacy/CaseCallToActionLegacy.tsx (1 hunks)
  • apps/backoffice-v2/src/lib/blocks/components/KycBlock/hooks/useKycBlock/useKycBlock.tsx (1 hunks)
  • apps/backoffice-v2/src/pages/Entities/components/CaseCreation/components/CaseCreationForm/components/SubmitSection/SubmitSection.tsx (1 hunks)
  • apps/backoffice-v2/src/pages/Root/Root.page.tsx (1 hunks)
  • services/workflows-service/prisma/data-migrations (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • services/workflows-service/prisma/data-migrations
🔇 Additional comments (2)
apps/backoffice-v2/src/pages/Entities/components/CaseCreation/components/CaseCreationForm/components/SubmitSection/SubmitSection.tsx (1)

23-23: Approve with suggestions: Document the style override and verify accessibility

The addition of the !bg-foreground class to the Button component is approved as it doesn't introduce any functional issues. However, there are a few points to consider:

  1. The use of the ! important override might lead to maintenance challenges in the future. Consider documenting the reason for this override in a comment.

  2. Changing the button's background color could impact its visibility and contrast ratio. Please verify that the button still meets accessibility standards (WCAG 2.1 AA) with this new style.

  3. It's recommended to test the button's appearance across different themes or color schemes to ensure it remains visible and functional in all contexts.

To verify the impact of this change, please run the following accessibility check:

apps/backoffice-v2/src/pages/Root/Root.page.tsx (1)

32-32: Chatbot rendering simplified, potential impacts to consider

The change simplifies the ChatbotLayout component by directly rendering the Chatbot component instead of wrapping it in a RenderChildrenInIFrame. This aligns with the PR title "chat iframe revert".

While this simplification can improve performance and reduce complexity, please consider the following:

  1. If the iframe was used for security isolation, ensure that removing it doesn't introduce any security vulnerabilities.
  2. Verify that the Chatbot component still functions correctly without the iframe wrapper, especially regarding its positioning and interaction with other elements on the page.
  3. Confirm that this change doesn't affect any CSS styling that might have been relying on the iframe structure.

To ensure no unintended side-effects, please run the following script to check for any remaining references to the removed iframe or related styling:

@Omri-Levy Omri-Levy merged commit 78a7045 into dev Sep 30, 2024
10 checks passed
@Omri-Levy Omri-Levy deleted the omri-levy/fix/chat-iframe branch September 30, 2024 12:34
@Omri-Levy Omri-Levy mentioned this pull request Nov 4, 2024
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.

2 participants