Skip to content

Introduce variant prop for popover control item #4407

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

Merged
merged 2 commits into from
Jun 14, 2025

Conversation

Guria
Copy link
Contributor

@Guria Guria commented Jun 13, 2025

PR Checklist

  • Have you verified that the PR is pointing to the correct target branch? (develop for features/bugfixes, other if mentioned in the task)
  • Have you verified that your branch is consistent with the target branch and has no conflicts? (if not, make a rebase under the target branch)
  • Have you checked that everything works within the branch according to the task description and tested it locally?
  • Have you run the linter (npm run lint) prior to submission? Enable the git hook on commit in your IDE to run it and format the code automatically.
  • Have you run the tests locally and added/updated them if needed?
  • Have you checked that app can be built (npm run build)?
  • Have you checked that no new circular dependencies appreared with your changes? (the webpack plugin reports circular dependencies within the dev npm script)
  • Have you made sure that all the necessary pipelines has been successfully completed?
  • If the task requires translations to be updated, have you done this by running the manage:translations script?
  • Have you added the link to the PR in the Jira ticket comments?

Visuals

no changes in any visuals

@coderabbitai full review

Summary by CodeRabbit

  • New Features

    • Added a "destructive" variant for popover menu items, providing clear visual cues for actions such as delete.
  • Style

    • Updated styling to consistently highlight destructive actions using the new variant, ensuring error colors are applied across all relevant UI elements.
    • Removed legacy CSS classes previously used for destructive styling.
  • Refactor

    • Streamlined how destructive actions are defined in menus, replacing direct CSS class assignments with a semantic variant property for improved maintainability and consistency.

Copy link

coderabbitai bot commented Jun 13, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes refactor the way destructive actions are styled in popover menus across several components. Instead of assigning custom CSS classes for destructive actions, a new variant: 'destructive' property is introduced and propagated through TypeScript interfaces and component props. Corresponding SCSS classes for the old approach are removed and replaced with a unified modifier class.

Changes

Files / Groups Change Summary
popoverControl.tsx, popoverControl.scss Refactored to use a variant: 'destructive' prop for destructive items; added TypeScript interfaces; added new SCSS modifier for destructive buttons.
popoverTools.jsx, variable.jsx, variablesControl.jsx Updated popover menu item definitions to use variant: 'destructive' instead of custom class names for destructive actions.
popoverTools.scss, variable.scss, variablesControl.scss Removed old CSS classes for destructive styling (--red modifiers); styling now handled by the new unified modifier in popoverControl.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PopoverControl
    participant MenuItem

    User->>PopoverControl: Opens popover
    PopoverControl->>MenuItem: Renders items with variant prop
    alt variant is 'destructive'
        MenuItem->>PopoverControl: Applies .popover-control__item-button--destructive class
    else
        MenuItem->>PopoverControl: Applies default styling
    end
    User->>MenuItem: Clicks item (e.g., delete)
    MenuItem->>PopoverControl: Triggers onClick handler
Loading

Poem

A bunny with code on its mind,
Hopped through styles, old and unkind.
"No more red classes!" it cheered with delight,
"Variants for danger, now styling is right!"
With TypeScript and SCSS, the changes are neat—
Destructive actions, unified and sweet!
🐇✨

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch popover-control-item-destructive
  • Post Copyable Unit Tests in Comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 auto-generate unit tests to generate unit tests 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.

@codecov-commenter
Copy link

codecov-commenter commented Jun 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.73%. Comparing base (769c6bc) to head (a43ecb5).

Additional details and impacted files
@@                  Coverage Diff                  @@
##           feature/test-library    #4407   +/-   ##
=====================================================
  Coverage                 66.73%   66.73%           
=====================================================
  Files                        85       85           
  Lines                       995      995           
  Branches                    142      142           
=====================================================
  Hits                        664      664           
  Misses                      300      300           
  Partials                     31       31           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Guria
Copy link
Contributor Author

Guria commented Jun 13, 2025

@coderabbitai full review

Copy link

coderabbitai bot commented Jun 13, 2025

✅ Actions performed

Full review triggered.

@Guria Guria added the TMS label Jun 13, 2025
Copy link

@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 (2)
app/src/pages/common/popoverControl/popoverControl.scss (1)

43-52: Check contrast for the new --destructive state

The modifier correctly pins the text color to var(--rp-ui-base-error) across all interactive states. Please verify that the default hover background (var(--rp-ui-base-bg-200)) still meets WCAG-AA contrast against this error color; if not, consider a dedicated background for the destructive variant to retain accessibility.

Everything else looks consistent with the existing BEM naming.

app/src/pages/common/popoverControl/popoverControl.tsx (1)

26-34: Consider widening the variant union or making it exhaustive

Right now only 'destructive' is allowed. If you foresee additional visual intents (e.g. primary, warning, success) it would be better to encode them here to avoid future breaking changes:

-  variant?: 'destructive';
+  variant?: 'destructive' | 'primary' | 'warning' | 'success';

Keeping the union exhaustive helps TypeScript warn about unsupported variants early.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bbba75a and 4520d4f.

📒 Files selected for processing (8)
  • app/src/pages/common/popoverControl/popoverControl.scss (1 hunks)
  • app/src/pages/common/popoverControl/popoverControl.tsx (2 hunks)
  • app/src/pages/inside/productVersionPage/productVersionHeader/popoverTools/popoverTools.jsx (1 hunks)
  • app/src/pages/inside/productVersionPage/productVersionHeader/popoverTools/popoverTools.scss (1 hunks)
  • app/src/pages/inside/projectSettingsPageContainer/content/testLibrary/testData/variablesControl/variable/variable.jsx (1 hunks)
  • app/src/pages/inside/projectSettingsPageContainer/content/testLibrary/testData/variablesControl/variable/variable.scss (1 hunks)
  • app/src/pages/inside/projectSettingsPageContainer/content/testLibrary/testData/variablesControl/variablesControl.jsx (1 hunks)
  • app/src/pages/inside/projectSettingsPageContainer/content/testLibrary/testData/variablesControl/variablesControl.scss (1 hunks)
🔇 Additional comments (6)
app/src/pages/inside/projectSettingsPageContainer/content/testLibrary/testData/variablesControl/variable/variable.jsx (1)

57-60: variant: 'destructive' wired-in—ensure typings are updated

Good call moving to the semantic prop. Double-check that:

  1. PopoverControl’s item type/prop interface includes 'destructive' in its union so TS consumers compile cleanly.
  2. No residual references to the removed red CSS class remain in the codebase.

Otherwise LGTM.

app/src/pages/inside/projectSettingsPageContainer/content/testLibrary/testData/variablesControl/variable/variable.scss (1)

60-60: Nothing functionally changed in this hunk.

app/src/pages/inside/projectSettingsPageContainer/content/testLibrary/testData/variablesControl/variablesControl.scss (1)

60-60: Nothing functionally changed in this hunk.

app/src/pages/inside/productVersionPage/productVersionHeader/popoverTools/popoverTools.scss (1)

23-23: Only removal of obsolete styles—no further action.

app/src/pages/inside/productVersionPage/productVersionHeader/popoverTools/popoverTools.jsx (1)

108-111: variant: 'destructive' aligns with the new API – no issues spotted

The item correctly switches from ad-hoc CSS to the new semantic variant prop.
No further action required.

app/src/pages/inside/projectSettingsPageContainer/content/testLibrary/testData/variablesControl/variablesControl.jsx (1)

79-82: Proper adoption of variant: 'destructive'

The destructive action now relies on the typed variant instead of a hard-coded CSS class — consistent with the refactor. Looks good.

Copy link

@ViktorSoroka07 ViktorSoroka07 merged commit 82b574c into feature/test-library Jun 14, 2025
8 checks passed
@ViktorSoroka07 ViktorSoroka07 deleted the popover-control-item-destructive branch June 14, 2025 13:38
@Guria Guria mentioned this pull request Jun 16, 2025
10 tasks
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.

4 participants