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

refactor: main config #14800

Merged
merged 13 commits into from
Feb 26, 2025
Merged

Conversation

lassopicasso
Copy link
Contributor

@lassopicasso lassopicasso commented Feb 25, 2025

Description

This PR restructure the order of the main config.

  • Moved the header Hovedinnstillinger to the top of the config after discussing with @Annikenkbrathen . For now it is displayed when its a summary component or when feature flag mainConfig is set.
  • Hide all other config options when the subform table is in "Recommended Next Action" mode.
  • Restructured the main config to simplify implement new configs, i.e. ordered as: Text, Specific Main Config, Data Model Binding.
Summary2

image

image

When feature flag set - other components

image

Subform

Before:

image

image

After (when feature flag is set):

image

image

Related Issue(s)

  • #itself

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

Summary by CodeRabbit

  • New Features

    • Updated display logic ensures that configuration panels and editing options appear only when applicable based on form type and enabled feature settings.
    • Introduced conditional rendering for the main configuration header based on feature flags.
  • Style

    • Enhanced spacing, padding, and margin adjustments deliver a more consistent and polished layout across configuration and summary views.
    • New CSS classes and modifications improve the visual styling of components.
  • Refactor

    • Streamlined the interface by removing redundant elements, resulting in a cleaner and more intuitive user experience.

Copy link
Contributor

coderabbitai bot commented Feb 25, 2025

📝 Walkthrough

Walkthrough

This pull request updates several components in the ux-editor package. It modifies test cases to streamline cleanup routines and adjust assertions for conditional rendering based on feature flags and component types. The components have been altered to remove the rendering of HeaderMainConfig in non-matching cases and introduce new conditional logic. CSS changes adjust spacing, padding, and class naming to enhance layout presentation, while a new HTML wrapper has been implemented in one component to improve the structure of the rendered output.

Changes

File(s) Change Summary
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/ComponentMainConfig.test.tsx,
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.test.tsx
Updated tests: simplified afterEach cleanup, adjusted test expectations for feature flags and conditional rendering, and modified the component wrapper structure for clearer output verification.
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/ComponentMainConfig.tsx,
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.tsx,
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/SpecificMainConfig/SummaryMainConfig.tsx
Modified component logic: removed the import and rendering of HeaderMainConfig, introduced conditional rendering based on form item types and feature flags, and simplified nested wrappers.
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditLayoutSetForSubform/EditLayoutSetForSubform.tsx Replaced the React fragment with a <div> using a new wrapper class to alter the rendered structure.
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditLayoutSetForSubform/EditLayoutSetForSubform.module.css Added a new .wrapper class (display block, top margin, full width) and updated the .navigateSubformButton margin from bottom to top for revised spacing.
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/HeaderMainConfig.module.css Changed the .componentMainConfig padding from a single spacing value to three distinct values, modifying the top, side, and bottom padding.
frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.module.css Renamed the .content class to .mainContent and removed the align-items: flex-start; property, altering the flex container alignment.
frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Summary2Target/Summary2Target.module.css Modified the .targetConfig class by replacing the padding-top property with uniform padding and adding a background-color property for a subtle background.

Possibly related PRs

  • feat: add main config section with header behind feature flag #14702: The changes in the main PR are related to the modifications in the ComponentMainConfig component and its tests, which involve rendering logic that is also impacted by the new feature flag introduced in the retrieved PR.
  • feat: reorganize summary2 config #14460: The changes in the main PR are related to the modifications in the ComponentMainConfig component, specifically in how it handles rendering based on component types, which aligns with the updates made in the retrieved PR regarding the ComponentMainConfig component's structure and functionality.
  • fix: adjust design in StudioDisplayTile to align with StudioToggleableTextfield design #14401: The changes in the main PR, specifically the removal of the HeaderMainConfig component from the rendering logic in ComponentMainConfig.tsx, are related to the modifications in the PropertiesHeader.tsx file where the rendering of HeaderMainConfig is conditionally controlled, indicating a direct connection in their functionality.

Suggested labels

team/studio-domain1, skip-releasenotes

Suggested reviewers

  • Annikenkbrathen
  • mlqn

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0f8e28c and 2a0255e.

📒 Files selected for processing (1)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditLayoutSetForSubform/EditLayoutSetForSubform.module.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditLayoutSetForSubform/EditLayoutSetForSubform.module.css
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build environment and run e2e test
  • GitHub Check: Typechecking and linting
  • GitHub Check: Testing
  • GitHub Check: CodeQL

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.
  • @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.

@github-actions github-actions bot added area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. solution/studio/designer Issues related to the Altinn Studio Designer solution. frontend labels Feb 25, 2025
@lassopicasso lassopicasso added added-to-sprint frontend and removed solution/studio/designer Issues related to the Altinn Studio Designer solution. frontend labels Feb 25, 2025
@lassopicasso lassopicasso self-assigned this Feb 25, 2025
@lassopicasso lassopicasso changed the title feat: Restructure/refactor mainconfig feat: Restructure/refactor the order of mainconfig Feb 25, 2025
@github-actions github-actions bot added the solution/studio/designer Issues related to the Altinn Studio Designer solution. label Feb 25, 2025
@lassopicasso lassopicasso added the skip-manual-testing PRs that do not need to be tested manually label Feb 25, 2025
@lassopicasso
Copy link
Contributor Author

lassopicasso commented Feb 25, 2025

For the reviewer: there is not that much to test in this PR. Can the reviewer also test this manually, so we can skip the test column? A different issue that im working on, #14185, is dependent on this PR.

@lassopicasso lassopicasso marked this pull request as ready for review February 25, 2025 13:39
@lassopicasso lassopicasso removed their assignment Feb 25, 2025
@lassopicasso lassopicasso changed the title feat: Restructure/refactor the order of mainconfig refactor: the order of mainconfig Feb 25, 2025
@lassopicasso lassopicasso changed the title refactor: the order of mainconfig refactor: main config Feb 25, 2025
@lassopicasso lassopicasso self-assigned this Feb 26, 2025
@lassopicasso lassopicasso removed their assignment Feb 26, 2025
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 867e10c and c18577f.

📒 Files selected for processing (5)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditLayoutSetForSubform/EditLayoutSetForSubform.module.css (1 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditLayoutSetForSubform/EditLayoutSetForSubform.tsx (3 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/HeaderMainConfig.module.css (1 hunks)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.tsx (3 hunks)
  • frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Summary2Target/Summary2Target.module.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditLayoutSetForSubform/EditLayoutSetForSubform.module.css
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/HeaderMainConfig.module.css
  • frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditLayoutSetForSubform/EditLayoutSetForSubform.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: CodeQL
  • GitHub Check: Testing
  • GitHub Check: Build environment and run e2e test
🔇 Additional comments (5)
frontend/packages/ux-editor/src/components/config/componentSpecificContent/Summary2/Summary2Target/Summary2Target.module.css (1)

2-5: Improve visual styling and ensure design consistency.

The modifications to the .targetConfig class are well-executed. Replacing padding-top with a uniform padding provides consistent spacing on all sides, and the addition of a subtle background color along with defined top and bottom borders offers a clearer visual separation. Please verify that these styling changes align with the overall design specifications—especially in scenarios where the HeaderMainConfig component is no longer present—to ensure a harmonious layout across the application.

frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.tsx (4)

13-13: Good addition of needed import

The import for HeaderMainConfig is correctly added to support the new conditional rendering logic.


36-38: Good implementation of conditional logic for header visibility

The constant uses clear, semantic naming and properly implements the requirement to show the main config header when either the feature flag is enabled or the component is a Summary2.


64-64: Correct placement of HeaderMainConfig component

This implementation matches the PR objective of moving the header to the top of the configuration. The conditional rendering ensures it's only shown when appropriate.


65-76: Proper restructuring of configuration components

The conditional wrapping of both the EditComponentIdRow and ComponentMainConfig implements the requirement to hide configuration options when in "Recommended Next Action" mode (when hideContentWhenSubformGuide is true).

This restructuring aligns with the PR objective to organize the main configuration as: Text, Specific Main Config, and Data Model Binding.

Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.77%. Comparing base (8bd3870) to head (52f0666).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14800   +/-   ##
=======================================
  Coverage   95.77%   95.77%           
=======================================
  Files        1922     1922           
  Lines       25076    25077    +1     
  Branches     2864     2867    +3     
=======================================
+ Hits        24017    24018    +1     
  Misses        799      799           
  Partials      260      260           

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

@JamalAlabdullah JamalAlabdullah self-assigned this Feb 26, 2025
Copy link
Contributor

@JamalAlabdullah JamalAlabdullah left a comment

Choose a reason for hiding this comment

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

Good job! I tested all cases that mentioned in description and they works fine. 👍
Regarding my comment, I am not sure if we need the margin I mentioned , so you decide 😄

@lassopicasso lassopicasso merged commit 6722766 into main Feb 26, 2025
11 checks passed
@lassopicasso lassopicasso deleted the restructure-top-of-mainconfig-when-subform branch February 26, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added-to-sprint area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. frontend skip-manual-testing PRs that do not need to be tested manually solution/studio/designer Issues related to the Altinn Studio Designer solution. team/studio-domain2
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants