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

style(components): change button state styling to fix disappearing buttons #2877

Merged
merged 4 commits into from
Dec 11, 2024

Conversation

shanegrouber
Copy link
Collaborator

@shanegrouber shanegrouber commented Dec 8, 2024

  • Update button classes to include hover and enabled states
  • Remove unused CSS rules to streamline styles

Summary by CodeRabbit

  • New Features

    • Enhanced button styling across various components for improved visual feedback during user interactions.
  • Bug Fixes

    • Simplified rendering of the Chatbot component by removing unnecessary wrapper, potentially improving performance and layout.
  • Documentation

    • Updated CSS classes for better theming and responsiveness in dark mode.
  • Chores

    • Removed unused components and import statements to streamline the codebase.

- Update button classes to include hover and enabled states
- Remove unused CSS rules to streamline styles

(your buttons now have more states than a soap opera character)
Copy link

changeset-bot bot commented Dec 8, 2024

⚠️ No Changeset found

Latest commit: c160e09

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 Dec 8, 2024

Walkthrough

This pull request introduces several modifications across multiple components in the backoffice application, primarily focusing on enhancing the styling of Button components to improve visual feedback during user interactions. Changes include updates to the className properties of buttons in various components, incorporating new utility classes for enabled states. Additionally, the ChatbotLayout component's rendering logic has been simplified by removing an unnecessary iframe wrapper. Overall, the changes are centered around improving the user interface without altering the core functionality of the components.

Changes

File Change Summary
apps/backoffice-v2/src/domains/notes/Notes.tsx Updated Button className to include enabled:bg-primary enabled:hover:bg-primary/90.
apps/backoffice-v2/src/index.css Added new utility classes, updated theming variables, modified .bpComposerPoweredBy, and removed background color for .bpModalDialogNewConversationButton.
apps/backoffice-v2/src/lib/blocks/components/CallToActionLegacy/CallToActionLegacy.tsx Modified MotionButton classNames for "Re-upload needed" actions based on state.
apps/backoffice-v2/src/lib/blocks/components/EditableDetails/EditableDetails.tsx Updated Button className to include enabled:bg-primary enabled:hover:bg-primary/90.
apps/backoffice-v2/src/lib/blocks/hooks/useDirectorsBlocks/useDirectorsBlocks.tsx Added enabled:bg-success enabled:hover:bg-success/90 to MotionButton className.
apps/backoffice-v2/src/lib/blocks/hooks/useDocumentBlocks/useDocumentBlocks.tsx Added enabled:bg-success enabled:hover:bg-success/90 to MotionButton className.
apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/DefaultActions/DefaultActions.tsx Updated Button classNames for enabled states in DialogTrigger and DialogFooter.
apps/backoffice-v2/src/pages/Root/Root.page.tsx Removed RenderChildrenInIFrame component, simplifying Chatbot rendering.
apps/backoffice-v2/src/pages/SignIn/SignIn.page.tsx Updated Button className to include enabled:bg-primary enabled:hover:bg-primary/90.

Possibly related PRs

  • Case creation submit button hotfix #2681: The changes in the SubmitSection component involve updating the Button component's className to enhance its styling, similar to the modifications made in the Notes component's button styling in the main PR.
  • KYC button hotfix #2682: The CaseCallToActionLegacy component's button styling changes include conditional class names based on the data?.disabled state, which aligns with the styling enhancements made to the Button component in the Notes component.
  • KYC button hotfix #2683: The useKycBlock component's button styling changes also involve conditional class names based on the isDisabled state, reflecting a similar approach to the button styling updates in the main PR.
  • Chatbot css fix #2686: The ChatbotLayout component's changes include updates to button styling, which is related to the visual feedback improvements seen in the Notes component.
  • hide powered by #2739: The modifications in the index.css file include changes to button styles, which are relevant to the updates made in the Notes component.
  • fix restart bg color #2740: Similar to the previous PR, this one also involves updates to CSS classes that could impact button styling, relating to the changes in the Notes component.
  • fix: fixed document cropping & layout fixes #2866: The updates to document rendering and layout fixes include adjustments to button styles, which are relevant to the changes made in the Notes component.
  • Removed disable condition for document type #2880: The modifications in the useDocumentBlocks hook enhance the rendering logic for document actions, which is related to the visual feedback improvements in the Notes component.

Suggested labels

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

Suggested reviewers

  • Omri-Levy

Poem

🐰 In the land of code where buttons gleam,
New styles emerge like a bright, sweet dream.
With colors that dance on hover and click,
Our UI shines, oh so slick!
So let us rejoice, for changes are here,
A better experience, let's all cheer! ✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 478123d and c160e09.

📒 Files selected for processing (1)
  • apps/backoffice-v2/src/lib/blocks/hooks/useDocumentBlocks/useDocumentBlocks.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/backoffice-v2/src/lib/blocks/hooks/useDocumentBlocks/useDocumentBlocks.tsx

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. (Experiment)
  • @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

🧹 Outside diff range and nitpick comments (2)
apps/backoffice-v2/src/lib/blocks/components/CallToActionLegacy/CallToActionLegacy.tsx (1)

192-195: LGTM! Good use of conditional classes for button states

The implementation properly handles both the resetable and non-resetable states of the Re-upload button, with appropriate hover effects.

Consider extracting these common button state classes into a shared utility class or Tailwind plugin for consistency across the application:

-className={ctw({
-  'flex gap-2': isReuploadResetable,
-  'enabled:bg-warning enabled:hover:bg-warning/90': !isReuploadResetable,
-})}
+className={ctw(
+  'btn-base', // New utility class that includes common enabled/hover states
+  {
+    'flex gap-2': isReuploadResetable,
+    'btn-warning': !isReuploadResetable, // New utility class for warning variant
+  }
+)}
apps/backoffice-v2/src/lib/blocks/hooks/useDirectorsBlocks/useDirectorsBlocks.tsx (1)

256-256: LGTM! Consider extracting common button styles.

The added className properly implements the enabled state styling and hover effect, which aligns with the PR's goal of improving button visibility. The success color and hover opacity provide good visual feedback.

Consider extracting these common button styles into a shared constant or utility class, as similar styling might be needed for other buttons across the application. This would ensure consistency and make future updates easier.

// Example: Create a shared styles object
const buttonStateStyles = {
  success: 'enabled:bg-success enabled:hover:bg-success/90',
  // Add other variants as needed
} as const;

// Usage
className={buttonStateStyles.success}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c4959d8 and ed1fd17.

📒 Files selected for processing (9)
  • apps/backoffice-v2/src/domains/notes/Notes.tsx (1 hunks)
  • apps/backoffice-v2/src/index.css (1 hunks)
  • apps/backoffice-v2/src/lib/blocks/components/CallToActionLegacy/CallToActionLegacy.tsx (2 hunks)
  • apps/backoffice-v2/src/lib/blocks/components/EditableDetails/EditableDetails.tsx (1 hunks)
  • apps/backoffice-v2/src/lib/blocks/hooks/useDirectorsBlocks/useDirectorsBlocks.tsx (1 hunks)
  • apps/backoffice-v2/src/lib/blocks/hooks/useDocumentBlocks/useDocumentBlocks.tsx (1 hunks)
  • apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/DefaultActions/DefaultActions.tsx (2 hunks)
  • apps/backoffice-v2/src/pages/Root/Root.page.tsx (1 hunks)
  • apps/backoffice-v2/src/pages/SignIn/SignIn.page.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • apps/backoffice-v2/src/lib/blocks/components/EditableDetails/EditableDetails.tsx
  • apps/backoffice-v2/src/pages/SignIn/SignIn.page.tsx
  • apps/backoffice-v2/src/lib/blocks/hooks/useDocumentBlocks/useDocumentBlocks.tsx
🔇 Additional comments (6)
apps/backoffice-v2/src/pages/Root/Root.page.tsx (1)

36-40: Verify chatbot positioning after iframe removal

The removal of the iframe wrapper might affect the chatbot's positioning and z-index stacking context. Please ensure that:

  1. The chatbot still appears above other UI elements
  2. The toggle functionality works correctly
  3. The chatbot maintains its expected position in the layout
✅ Verification successful

Chatbot positioning is handled by Botpress Webchat component

The removal of the iframe wrapper is safe because:

  1. The chatbot uses @botpress/webchat library components (Webchat, WebchatProvider) which handle their own positioning and z-index stacking context
  2. No custom positioning styles were found in the codebase
  3. The toggle functionality is properly maintained through isWebchatOpen state and toggleIsWebchatOpen handler

The iframe removal simplifies the component structure without affecting the chatbot's functionality or positioning.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any z-index or positioning styles related to the chatbot
rg -g '*.{css,scss}' -A 2 'chatbot|webchat' 

Length of output: 45


Script:

#!/bin/bash
# Let's check the Chatbot component implementation for any styling
fd -e tsx -e ts -e css -e scss "Chatbot" --exec cat {}

Length of output: 56


Script:

#!/bin/bash
# Search for the Chatbot component file using a broader search
fd "Chatbot" --type f

# Then let's check for any webchat or chatbot related styling in the entire codebase
rg -g '*.{tsx,ts,css,scss,styled.ts}' -i "(webchat|chatbot|\.webchat|\.chatbot)"

Length of output: 2714

apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/DefaultActions/DefaultActions.tsx (2)

38-42: LGTM: Enhanced button visibility with proper state handling

The addition of enabled:bg-warning enabled:hover:bg-warning/90 classes improves button visibility and hover state feedback.


66-67: LGTM: Consistent loading state handling

Good use of conditional styling to handle the enabled state based on the loading status.

apps/backoffice-v2/src/domains/notes/Notes.tsx (1)

91-91: LGTM: Improved button styling with accessibility support

The updated button styling:

  • Adds proper enabled state handling with hover effects
  • Maintains accessibility with aria-disabled styles
  • Follows the consistent pattern across other components
apps/backoffice-v2/src/lib/blocks/components/CallToActionLegacy/CallToActionLegacy.tsx (1)

261-261: LGTM! Consistent button state styling

The enabled state styling matches the PR objectives and maintains consistency with other button implementations.

apps/backoffice-v2/src/lib/blocks/hooks/useDirectorsBlocks/useDirectorsBlocks.tsx (1)

Line range hint 252-259: Verify button visibility across all states

The button combines motion animations (opacity: isApproveDisabled ? 0.5 : ...) with enabled state styles. Let's ensure the button remains visible across all combinations of states.

✅ Verification successful

Button visibility pattern is consistent across the codebase

The codebase shows a consistent pattern for handling button visibility in disabled states:

  1. All MotionButton instances use the same opacity animation pattern:

    • Default opacity from motionButtonProps.animate.opacity
    • Opacity 0.5 when disabled
  2. The button's enabled state styling (enabled:bg-success enabled:hover:bg-success/90) follows the established pattern used across multiple components in the codebase.

  3. Disabled state handling is consistently implemented with:

    • disabled prop for click prevention
    • opacity: 0.5 for visual feedback
    • aria-disabled attributes for accessibility

The implementation in the review matches these established patterns and correctly handles button visibility across all states.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for similar button patterns to ensure consistent visibility handling

# Check for other instances of MotionButton with opacity animations
ast-grep --pattern 'MotionButton {
  $$$
  animate={
    $$$
    opacity: $$$
  }
  $$$
}'

# Check for other buttons with enabled state styling
rg "enabled:bg-" --type tsx

Length of output: 148


Script:

#!/bin/bash
# Let's try different approaches to find similar patterns

# Search for MotionButton usage with opacity
rg -t ts -t tsx "MotionButton.*opacity"

# Search for enabled: class patterns (without file type restriction)
rg "enabled:(bg|hover)"

# Find all MotionButton component definitions and usages
rg -t ts -t tsx "MotionButton"

# Look for disabled state handling in buttons
rg -t ts -t tsx "disabled=\{.*\}"

Length of output: 1843


Script:

#!/bin/bash
# Let's search without file type restrictions since tsx isn't recognized

# Find MotionButton usages
rg "MotionButton" -A 5 -B 5

# Find disabled state handling with opacity
rg "disabled.*opacity|opacity.*disabled"

# Find aria-disabled styling patterns
rg "aria-disabled"

Length of output: 65830

apps/backoffice-v2/src/index.css Show resolved Hide resolved
@shanegrouber shanegrouber requested review from Omri-Levy and removed request for tomer-shvadron December 8, 2024 16:17
- Change button styles from slate to primary background and hover colors
- Ensure consistency across different components for better UX

(your color choices are so dark, they could be the backdrop for a horror movie)
Copy link
Contributor

@Omri-Levy Omri-Levy left a comment

Choose a reason for hiding this comment

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

Great job. 💪🏼

@shanegrouber shanegrouber enabled auto-merge (squash) December 11, 2024 08:28
@shanegrouber shanegrouber merged commit 3750829 into dev Dec 11, 2024
10 checks passed
@shanegrouber shanegrouber deleted the BAL-3165 branch December 11, 2024 08:37
Omri-Levy added a commit that referenced this pull request Dec 15, 2024
* feat(filters): implement create filter functionality (#2881)

* style(components): change button state styling to fix disappearing buttons (#2877)

* style(components): enhance button state styling for better UX

- Update button classes to include hover and enabled states
- Remove unused CSS rules to streamline styles

(your buttons now have more states than a soap opera character)

* fix(buttons): update background color for button components

- Change button styles from slate to primary background and hover colors
- Ensure consistency across different components for better UX

(your color choices are so dark, they could be the backdrop for a horror movie)

---------

Co-authored-by: Omri Levy <61207713+Omri-Levy@users.noreply.github.com>

* fix(stepper): improve step display and clean up formatting

- Refactor step display to enhance layout and readability
- Add a new no-op constant to built-in events
- Clean up transition validation logic

(Your transition validation is so confusing, it makes find-and-replace look like a clear path)

* Date input improvements (#2889)

* refactor(*): changed handling of date inputs

* ci(*): testing path change

* temporarily disabled test

* updated hook name

---------

Co-authored-by: Tomer Shvadron <tomers@ballerine.com>

* EditableDetailsV2 input type improvement (#2891)

* refactor(*): changed handling of date inputs

* ci(*): testing path change

* temporarily disabled test

* updated hook name

* fix(backoffice-v2): no longer looking at form value for input type

---------

Co-authored-by: Tomer Shvadron <tomers@ballerine.com>

* EditableDetailsV2 added ability to override input type (#2892)

* refactor(*): changed handling of date inputs

* ci(*): testing path change

* temporarily disabled test

* updated hook name

* fix(backoffice-v2): no longer looking at form value for input type

* feat(backoffice-v2): added a way to override input type

---------

Co-authored-by: Tomer Shvadron <tomers@ballerine.com>

* Dev 318/action alert delivery (#2893)

* feat: adding changes for sending alerts to specific channel

* fix: added change in hotfix action

---------

Co-authored-by: Alon Peretz <8467965+alonp99@users.noreply.github.com>
Co-authored-by: Shane <66246046+shanegrouber@users.noreply.github.com>
Co-authored-by: Tomer Shvadron <tomers@ballerine.com>
Co-authored-by: Chirag <134513193+codechirag123@users.noreply.github.com>
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