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

feat(MCDA): 19437 New reverse sentiments button for MCDA layer. Small UI tweaks #835

Merged
merged 6 commits into from
Sep 12, 2024

Conversation

albaranau
Copy link
Contributor

@albaranau albaranau commented Sep 12, 2024

https://kontur.fibery.io/Tasks/Task/New-Reverse-sentiments-button-for-MCDA-layer-19437

Summary by CodeRabbit

  • New Features

    • Introduced new sentiment reversal options for enhanced clarity in sentiment analysis.
    • Added a button for reversing sentiment values, improving user interaction.
  • Bug Fixes

    • Streamlined the editing process to prevent multiple entries into edit mode.
  • Style

    • Updated styles for the layer editor to improve layout and responsiveness.
    • Added new styling for the reverse sentiment button to enhance visual appeal.

@albaranau albaranau requested a review from a team September 12, 2024 09:17
Copy link
Contributor

coderabbitai bot commented Sep 12, 2024

Walkthrough

The changes involve updates to localization strings, styling enhancements, and functionality improvements in the MCDALayerEditor component. New sentiment keys have been introduced in the localization file, replacing an existing key. The CSS files have been modified to improve layout and responsiveness, while the TypeScript file adds a new feature for reversing sentiment values, streamlining user interaction and editing processes.

Changes

Files Change Summary
src/core/localization/translations/en/common.json Removed "sentiment" key; added "reverse_to_good_bad" and "reverse_to_bad_good" keys.
src/features/mcda/components/MCDALayerEditor/MCDALayerParameters/MCDALayerParameters.module.css Enhanced styling for .layerEditContainer and added a new class .reverseButton for button styling.
src/features/mcda/components/MCDALayerEditor/MCDALayerParameters/MCDALayerParameters.tsx Introduced onReverseSentiment callback for toggling sentiment; modified editLayer function to check editMode state; updated rendering logic for sentiment display.
src/features/mcda/components/MCDALayerEditor/style.module.css Added display: flex; and flex-direction: column; for improved layout structure.

Poem

🐇 In the garden of code, changes bloom bright,
New keys for sentiment, a clearer insight.
Styles dance in flex, with gaps that align,
A button for reversing, how lovely, how fine!
Let's hop with delight, for the edits are here,
Enhancing our layers, let's give a cheer! 🎉


Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 225d730 and 62b3829.

Files selected for processing (4)
  • src/core/localization/translations/en/common.json (1 hunks)
  • src/features/mcda/components/MCDALayerEditor/MCDALayerParameters/MCDALayerParameters.module.css (2 hunks)
  • src/features/mcda/components/MCDALayerEditor/MCDALayerParameters/MCDALayerParameters.tsx (2 hunks)
  • src/features/mcda/components/MCDALayerEditor/style.module.css (1 hunks)
Additional comments not posted (7)
src/features/mcda/components/MCDALayerEditor/style.module.css (1)

2-4: LGTM!

The changes introduce a vertical flex layout for the editor component, which will improve the visual organization and responsiveness of the interface. The consistent spacing between the child elements using the gap property is a nice touch. The existing margin properties are preserved, ensuring that the overall positioning of the component remains intact.

These changes align well with the PR objective of making small UI tweaks to enhance the user experience.

src/features/mcda/components/MCDALayerEditor/MCDALayerParameters/MCDALayerParameters.module.css (2)

19-23: LGTM!

The changes to the .layerEditContainer class are well-thought-out and contribute to a more consistent, responsive, and visually appealing design. The use of CSS variables for spacing values promotes maintainability and flexibility. The added border and border-radius enhance the container's appearance without compromising its functionality.


116-118: LGTM!

The addition of the .reverseButton class is a welcome change that aligns perfectly with the PR objective of introducing a new "Reverse sentiments" button for the MCDA layer. The class name is descriptive and follows the BEM naming convention, making it easily understandable and maintainable. The margin value using var(--half-unit) ensures consistent spacing with other elements, contributing to a cohesive design.

src/features/mcda/components/MCDALayerEditor/MCDALayerParameters/MCDALayerParameters.tsx (3)

220-235: LGTM!

The onReverseSentiment function correctly toggles the sentiment between the two predefined options, updates the layer object with the new sentiment value, and propagates the changes using the onLayerEdited callback. Exiting the edit mode before applying the sentiment change is a good practice to ensure a consistent user experience.


Line range hint 236-257: LGTM!

The editLayer function correctly checks the editMode state before proceeding with the editing process. Canceling the editing and returning early if already in edit mode is a good practice to prevent the user from entering edit mode again without first canceling the current session. The function fetches the transformations statistics data, updates the state accordingly, and properly handles the loading state and errors while fetching the data.


265-296: LGTM!

The rendering logic changes are well-implemented and align with the new feature requirements:

  • Always displaying the LayerActionIcon for editing, regardless of the editMode state, simplifies the user interface and provides a consistent user experience.
  • Adding the sentiment display and the new reverse sentiment button to the component's output provides users with immediate access to sentiment manipulation, enhancing the user experience.
  • Removing the previous static sentiment selection UI streamlines the component's functionality and aligns with the new feature requirements.
src/core/localization/translations/en/common.json (1)

116-117: LGTM!

The introduction of the new localization keys "reverse_to_good_bad" and "reverse_to_bad_good" enhances clarity regarding sentiment transformations in the user interface. The removal of the previous "sentiment" key is consistent with this change.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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

Language To Recheck Fuzzy Untranslated Total
ar 3 24 101 128
de 2 24 101 127
es 3 24 101 128
id 2 24 101 127
ko 3 24 101 128
uk 0 7 8 15

Copy link

Bundle size diff

Old size New size Diff
5.22 MB 5.23 MB 177 B (0.00%)

@albaranau albaranau merged commit 8701c7b into main Sep 12, 2024
9 checks passed
@albaranau albaranau deleted the 19437-new-reverse-sentiments-button-for-mcda-layer branch September 12, 2024 10:08
@@ -149,7 +150,6 @@
},
"tips": {
"range": "The values that will be considered the worst and the best in your analysis.",
"sentiment": "Determine the direction of sentiment for the layer's impact on the analysis:\n* **Bad → Good**: Higher values indicate a positive sentiment.\n* **Good → Bad**: Higher values indicate a negative sentiment.",
Copy link
Member

Choose a reason for hiding this comment

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

lost a tooltip? there is no other explanation of "Sentiment"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was removed in the new layout, along with the dropdown. Guess we need to put the info icon somewhere else

https://www.figma.com/design/cFmWZmGioB52BDMoCofzpY/MCDA?node-id=17025-59711&node-type=frame&t=E9Ji1JGqeSNTH9E7-0

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.

3 participants