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: Create close subform button component #13947

Merged
merged 20 commits into from
Nov 6, 2024

Conversation

lassopicasso
Copy link
Contributor

@lassopicasso lassopicasso commented Oct 30, 2024

Description

This PR introduces closeSubformButton as a visual variant of customButton in studio. While it’s saved as customButton type, closeSubformButton appears distinct in Studio due to its action configuration:

      actions: [
        {
          type: 'ClientAction',
          id: 'closeSubform',
          validation: {
            page: 'all',
            show: ['All'],
          },
        },
      ],

This configuration allows closeSubformButton to function as a unique component visually while maintaining customButton’s base structure. The validation can be adjusted, but type and id are required to differentiate it.

I also refactored functions and hooks into a single new hook, useComponentTitle, which now handles component naming across both internal (toolbar) and external (backend-rendered / DesignView) components, managing type names and text resources together.

closesubformbutton-drag-drop.mp4

Related Issue(s)

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)

@lassopicasso lassopicasso linked an issue Oct 30, 2024 that may be closed by this pull request
3 tasks
@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 Oct 30, 2024
@lassopicasso lassopicasso changed the title Create close subform button component feat: Create close subform button component Oct 30, 2024
Copy link

codecov bot commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 94.23077% with 3 lines in your changes missing coverage. Please review.

Project coverage is 95.23%. Comparing base (95a0859) to head (fbc8e2e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ontainers/DesignView/AddItemModal/AddItemModal.tsx 0.00% 1 Missing ⚠️
...ignView/AddItemModal/ItemCategory/ItemCategory.tsx 50.00% 1 Missing ⚠️
...ners/DesignView/AddItemModal/ItemInfo/ItemInfo.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13947      +/-   ##
==========================================
+ Coverage   95.21%   95.23%   +0.01%     
==========================================
  Files        1713     1711       -2     
  Lines       22586    22579       -7     
  Branches     2641     2642       +1     
==========================================
- Hits        21506    21503       -3     
  Misses        834      834              
+ Partials      246      242       -4     

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

@github-actions github-actions bot added the area/dashboard Area: Related to the dashboard application label Oct 30, 2024
@lassopicasso lassopicasso marked this pull request as ready for review October 30, 2024 12:40
@lassopicasso
Copy link
Contributor Author

Note: Codecov reports missing coverage in 3 files, but these issues were introduced from merging with main and are not related to changes in this PR.

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 jobb 🙂 just small things, and I wonder about the icon , is this the icon we will use for closeSubformButton?
image

@lassopicasso
Copy link
Contributor Author

lassopicasso commented Nov 4, 2024

Good jobb 🙂 just small things, and I wonder about the icon , is this the icon we will use for closeSubformButton?

Good question! The other buttons that handle different tasks also share this common icon and are differentiated by their name. So, I think we could keep the icon as it is for now. This might be something we revisit later, and I’ll leave it open for @Annikenkbrathen to consider on a later stage.

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.

Nice work!

@Annikenkbrathen
Copy link

Good jobb 🙂 just small things, and I wonder about the icon , is this the icon we will use for closeSubformButton?

Yes, just go ahead and use that icon. It’s the one we have on all buttons so far, so we’ll use it until we decide to make any changes to all the buttons.

Copy link
Member

@Jondyr Jondyr left a comment

Choose a reason for hiding this comment

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

Tested and works perfectly ✅

@Jondyr Jondyr merged commit fa78ece into main Nov 6, 2024
9 of 10 checks passed
@Jondyr Jondyr deleted the create-closeSubformButton-component branch November 6, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dashboard Area: Related to the dashboard application area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. frontend solution/studio/designer Issues related to the Altinn Studio Designer solution.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support subform with a drag & drop CloseSubformButton component
4 participants