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

Delete Contribution Flow(frontend) #130

Merged

Conversation

NKoech123
Copy link
Contributor

@NKoech123 NKoech123 commented Aug 2, 2022

Linear Ticket

PRO-287: https://linear.app/govrn/issue/PRO-287/delete-icon-not-deleting-staged-contributions

Description

@jonathanprozzi
Updates:

  • I added a component in apps/protocol-frontend/src/components/DeleteContributionDialog.tsx that triggers
    a dialog when the delete icon is clicked. The dialog enables a User to either cancel the deleting process or proceed.
    Please refer to the screenshots below.

Screen Shot 2022-08-03 at 5 51 32 PM

Later changed the "Delete" Button to "Confirm". I thought "Confirm" makes more sense.

Screen Shot 2022-08-03 at 9 49 39 PM

Contribution Successfully deleted!
Screen Shot 2022-08-03 at 12 52 04 AM

@jonathanprozzi
Copy link
Collaborator

Thanks @NKoech123 ! I'll take a look. I think I know what's going on with this, we need to do a background refresh of the Contributions after the delete -- going to see, and then I can show you what's up if this is what's going on with it.

@NKoech123
Copy link
Contributor Author

Thanks @jonathanprozzi !!

@NKoech123 NKoech123 changed the title enable delete-contribution-icon Enable delete-contribution-icon/Delete Contribution flow Aug 4, 2022
@NKoech123 NKoech123 requested a review from amrro August 4, 2022 00:56
@NKoech123 NKoech123 marked this pull request as ready for review August 4, 2022 00:58
}
aria-label="Delete Contribution"
/>
<DeleteContributionDialog
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, not sure why we'd want to split this off from the Table itself
The delete icon button should be able to call the Dialog

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback. I made some changes based on your comments above (letting the icon button call the Dialog)

<Button
colorScheme='red'
color="brand.primary.600"
backgroundColor="brand.primary.100"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we may want to use red for this -- remove the backgroundColor

@jonathanprozzi
Copy link
Collaborator

@NKoech123 A few comments about the styles (we should stick with white for the dialog since it's a similar UI pattern to our modals -- appreciate that you tried 3 versions!)

The state issues are from the button + handlers being moved into the Dialog itself -- let's keep that split and pass the handler from the ContributionTable -> AlertDialog via the delete icon. So we'll want to add that delete icon back to the Table.

@NKoech123 NKoech123 changed the title Enable delete-contribution-icon/Delete Contribution flow Delete Contribution Flow(frontend) Aug 9, 2022
@jonathanprozzi
Copy link
Collaborator

I'm running this locally and I'm not able to edit/delete any of my contributions -- do you have this locally @NKoech123

@NKoech123
Copy link
Contributor Author

I was able to do all the editing/deleting yesterday and all worked well. Let me jumped on my desk now. Will get back to you in a few minutes

@jonathanprozzi
Copy link
Collaborator

@NKoech123 some of the Prettier settings seem different too -- I'm seeing a lot of extra lines and spaces in the PR. Is everything formatting on save?

setDialog({
...dialog,
isOpen: true, //this opens AlertDialog
title: "Are you sure you want to delete this contribution? You can't undo this action afterwards",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's change the title to: `"Are you sure you want to delete this Contribution? You can't undo this action."

We tend to capitalize Contribution thoughout the app

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment addressed. I have updated the title.

Copy link
Collaborator

@jonathanprozzi jonathanprozzi 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 overall! Delete works great. Have some questions I left as comments throughout.

@NKoech123
Copy link
Contributor Author

I pull from the staging to my branch and I am experience error below:
I dont know if it's something you have seen
Screen Shot 2022-08-10 at 10 23 03 AM

@NKoech123
Copy link
Contributor Author

@jonathanprozzi Thanks for pointing out the extra spaces in the PR. I just noticed that's not a good practice. That's due to me altering pre-existing code and not checking line by line before pushing. I have taken note of that.

@NKoech123
Copy link
Contributor Author

@jonathanprozzi I also saw your comment above about not being able to edit/delete contribution on your side. Initially I didn't have this issue. Now I am seeing this issue. Let me debug the issue at the moment

@NKoech123
Copy link
Contributor Author

> @jonathanprozzi I also saw your comment above about not being able to edit/delete contribution on your side. Initially I didn't have this issue. Now I am seeing this issue. Let me debug the issue at the moment

And finally the actions icons are back and functioning. Let me know if you encounter something interesting on your side.

Screen Shot 2022-08-10 at 3 27 05 PM

@jonathanprozzi
Copy link
Collaborator

Still seeing an odd bug with the Edit and Delete -- it's fine on refresh/initial load and then disabled after navigating back and forth:

delete-disabled.mp4

@NKoech123
Copy link
Contributor Author

NKoech123 commented Aug 12, 2022

HI @jonathanprozzi ,
So I did some debugging to check the values passed in disabled props of IconButton. I also commented out the userData.id line and also the row.original.status.name line at different times and did what you did in the Loom video to test.
I concluded that the icons work well if I comment line with userData.id as shown in the screenshot below.
What might be the cause of this? Any suggestions?
The user IDS are same when logged.
Screen Shot 2022-08-11 at 7 03 40 PM

@jonathanprozzi
Copy link
Collaborator

@alexkeating @NKoech123 - resolved merge conflicts and fixed a few small things. Will fix the type issue too before this is ready

Also, Keating -- the fix you put up earlier with the commit I added on top resolves the remaining bug with this, so we can merge yours first and then this one

@alexkeating alexkeating merged commit e746a2a into staging Aug 13, 2022
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