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

OH2-443 | Refactor admin forms reset/cancel actions #706

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

SteveGT96
Copy link
Contributor

@SteveGT96 SteveGT96 commented Nov 29, 2024

See OH2-443

@mwithi mwithi requested a review from SilverD3 November 29, 2024 17:31
Copy link
Contributor

@SilverD3 SilverD3 left a comment

Choose a reason for hiding this comment

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

The 'cancel button' could manage at the top level, I mean by the parent component (just like we're doing with the form title). This way, we keep this logic centralize and easy to maintain.

Furthermore, the 'cancel button' actually looks like the button for the 'primary action' of the form, when it's for a secondary or even tertiary action. We could use the secondary color (grey, I think) or a less expressive one.

Screenshot 2024-12-06 at 10-05-54 Open Hospital

Finally for the icon, I suggest to use the chevron left or the arrow left

@SteveGT96
Copy link
Contributor Author

SteveGT96 commented Dec 13, 2024

The 'cancel button' could manage at the top level, I mean by the parent component (just like we're doing with the form title). This way, we keep this logic centralize and easy to maintain.

Furthermore, the 'cancel button' actually looks like the button for the 'primary action' of the form, when it's for a secondary or even tertiary action. We could use the secondary color (grey, I think) or a less expressive one.

Screenshot 2024-12-06 at 10-05-54 Open Hospital

Finally for the icon, I suggest to use the chevron left or the arrow left

@SilverD3, I agree with the refractoring and the styles. If the cancel/reset operation are OK, then let's move that refecatoring and styles in a separate issue(that will also inclue laboratories one).
Are you OK ?

@mwithi
Copy link
Member

mwithi commented Dec 17, 2024

It doesn't make much sense that when I click DISCARD, the popup window is called "Cancel" and the OK (primary) button is for proceeding with the discard while the DISCARD (secondary) is to "discard the discard"... let's use "Back to edit" that is more compliant with what the button does:

image

Moreover, I think the above message should be shown also when the user tries to change page before saving:

chrome-capture-2024-12-17

On the other hand, the RESET button, shows a popup correctly named "Reset", with a primary OK button for proceeding, and a "Back" (secondary) button for "canceling the resetting", that at least is more related with a "back" operation, but I would call it also here "Back to edit".

image

So in general in the popup:

  • the popup should be titled like the button name that generated it
  • the primary button in the popup should repeat the button name to reinforce the operation
  • the secondary button should always be "Back to edit" or "Cancel"

For the page itself, I agree with @SilverD3 that the "Discard" should not appear like a primary at the top, but I don't have better suggestions about it at the moment

@SteveGT96 SteveGT96 requested a review from SilverD3 January 6, 2025 08:21
@SteveGT96
Copy link
Contributor Author

It doesn't make much sense that when I click DISCARD, the popup window is called "Cancel" and the OK (primary) button is for proceeding with the discard while the DISCARD (secondary) is to "discard the discard"... let's use "Back to edit" that is more compliant with what the button does:

image

Moreover, I think the above message should be shown also when the user tries to change page before saving:

chrome-capture-2024-12-17 chrome-capture-2024-12-17

On the other hand, the RESET button, shows a popup correctly named "Reset", with a primary OK button for proceeding, and a "Back" (secondary) button for "canceling the resetting", that at least is more related with a "back" operation, but I would call it also here "Back to edit".

image

So in general in the popup:

  • the popup should be titled like the button name that generated it
  • the primary button in the popup should repeat the button name to reinforce the operation
  • the secondary button should always be "Back to edit" or "Cancel"

For the page itself, I agree with @SilverD3 that the "Discard" should not appear like a primary at the top, but I don't have better suggestions about it at the moment

Hi @mwithi ! I've just updated labels as suggested !

@mwithi
Copy link
Member

mwithi commented Jan 8, 2025

Hi @mwithi ! I've just updated labels as suggested !

Hi @SteveGT96 can you make also that if I was editing and I try to change page it triggers automatically the discharge event with related popup?

@SteveGT96
Copy link
Contributor Author

Let me check that !

@SteveGT96
Copy link
Contributor Author

Hi @mwithi ! I've just updated labels as suggested !

Hi @SteveGT96 can you make also that if I was editing and I try to change page it triggers automatically the discharge event with related popup?

Hi @mwithi ! Could you review it again ?

@mwithi
Copy link
Member

mwithi commented Jan 9, 2025

Hi @mwithi ! Could you review it again ?

I don't see changes yet about it:

chrome-capture-2025-1-9

@SteveGT96
Copy link
Contributor Author

Hi @mwithi ! Could you review it again ?

I don't see changes yet about it:

chrome-capture-2025-1-9 chrome-capture-2025-1-9

You're right. I've just tested the solutions with app bar navigation links and back button.

I've added a quick fix, it's OK now !

Could you confirm @mwithi ?

@mwithi
Copy link
Member

mwithi commented Jan 10, 2025

Could you confirm @mwithi ?

Yes! Well done! I think we can merge this!

One questions: this works only for the admin section, right? what about all other forms in other sections?

@SteveGT96
Copy link
Contributor Author

Could you confirm @mwithi ?

Yes! Well done! I think we can merge this!

One questions: this works only for the admin section, right? what about all other forms in other sections?

We could handle other parts in separate issues !

@mwithi
Copy link
Member

mwithi commented Jan 10, 2025

Could you confirm @mwithi ?

Yes! Well done! I think we can merge this!
One questions: this works only for the admin section, right? what about all other forms in other sections?

We could handle other parts in separate issues !

Sure, what I'm asking is that they have different logic or the same.
@SilverD3 do you approve the code part?

@SteveGT96
Copy link
Contributor Author

I think actually other parts don"t have the same logic like the one in admin section. Should they have the same behaviour/logic ? If yes then we'll hande that in separated issues.

@SilverD3
Copy link
Contributor

@SilverD3 do you approve the code part?

Still reviewing. There are a lot of changed file

Copy link
Contributor

@SilverD3 SilverD3 left a comment

Choose a reason for hiding this comment

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

I still believe that the "cancel form edit" logic can be centralized and manage at a top level, instead of implementing the same logic in all "form components" of the admin section.

I notice that all pages of the admin section are rendered in the component AdminActivityContent (src\components\activities\adminActivity\AdminActivityContent\AdminActivityContent.tsx). We can centralize the "form cancel" logic in this component, and if not suitable, we can still look for a "higher level" component.

This way, we avoid a lot of code duplication.

cy.dataCy("close-dialog").click();
cy.dataCy("dialog-info").should("not.exist");
});

it("should cancel the disease creation", () => {
cy.dataCy("cancel-form").click();
cy.dataCy("approve-dialog").click();
cy.dataCy("approve-dialog").click().click();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a normal behavior? I mean, clicking twice?

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