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: delete collection [FC-0062] #1333

Merged
merged 19 commits into from
Oct 8, 2024

Conversation

navinkarkera
Copy link
Contributor

@navinkarkera navinkarkera commented Sep 26, 2024

Description

Adds delete option to collection card menu. It displays a confirmation box before deleting and a toast with button to undo delete action for 10 seconds.

Supporting information

Testing instructions

Concerns

Adding the undo button in a toast doesn't seem the best option in terms of accessibility.

@openedx-webhooks
Copy link

openedx-webhooks commented Sep 26, 2024

Thanks for the pull request, @navinkarkera!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/2u-tnl. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 26, 2024
@navinkarkera navinkarkera force-pushed the navin/delete-collection branch from 2ebdce8 to 9f9e537 Compare September 27, 2024 13:18
Copy link

codecov bot commented Sep 27, 2024

Codecov Report

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

Project coverage is 93.01%. Comparing base (75f937e) to head (26da705).
Report is 35 commits behind head on master.

Files with missing lines Patch % Lines
...rc/library-authoring/components/CollectionCard.tsx 90.62% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1333   +/-   ##
=======================================
  Coverage   93.00%   93.01%           
=======================================
  Files        1035     1035           
  Lines       19570    19630   +60     
  Branches     4157     4100   -57     
=======================================
+ Hits        18201    18258   +57     
- Misses       1304     1310    +6     
+ Partials       65       62    -3     

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

@navinkarkera navinkarkera marked this pull request as ready for review September 27, 2024 13:45
@navinkarkera navinkarkera requested a review from a team as a code owner September 27, 2024 13:45
@navinkarkera navinkarkera force-pushed the navin/delete-collection branch 3 times, most recently from dabeaa8 to 5088ef4 Compare September 30, 2024 07:10
Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

@navinkarkera I agree with your a11y concerns here, and proposed a way to address them. If you don't agree, I think it's worth asking Product for advice here.

import { Settings as IconSettings } from '@openedx/paragon/icons';
import { capitalize } from 'lodash';

const ProcessingNotification = ({ isShow, title }) => (
const ProcessingNotification = ({ isShow, title, action }) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

Concerns: Adding the undo button in a toast doesn't seem the best option in terms of accessibility.

I was going to reply to this to say that we rely on Paragon components to do the right thing re accessibility, but I see that this ProcessingNotification isn't actually using Paragon's Toast component!

So ya, this is a valid accessibility concern. Do you have time to convert this component to a proper Toast ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have time to convert this component to a proper Toast ?

@pomegranited Took some time but it is done now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please make the UX team aware of us. They originally asked us not to use Toast, because they wanted the same sort of animated notifications on the right-hand side of the screen that are used in the course experience. I do prefer the consistency of using Toast everywhere though.

Copy link
Contributor

Choose a reason for hiding this comment

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

@bradenmacdonald We can move the Toast popup to the bottom-right (for dir=ltr) and make sure it's positioned over the sidebar? Then we get the benefits of the Toast component and UX get their positioning.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pomegranited Sounds good to me, please just confirm with @sdaitzman @jmakowski1123 . I'm not sure why we didn't do that before but I think the Paragon toasts can't be moved?

Copy link
Contributor

Choose a reason for hiding this comment

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

@bradenmacdonald Huh, really? I don't see why not, but I don't have context on this discussion either. Will see what @navinkarkera can do.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pomegranited See #1211 and this comment. As long as you can satisfy those concerns, please definitely convert this to a standard toast :)

Copy link
Contributor Author

@navinkarkera navinkarkera Oct 3, 2024

Choose a reason for hiding this comment

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

@bradenmacdonald @pomegranited Done. Moved standard toast over to right side and it has same animation as before and it automatically goes away after few seconds.

image

Also, if no onClose handler is passed (which is the case in course outline and units), the close icon is hidden at which point it looks same (a bit wider but that can be changed if require) as before.

Before:

image

After

image

@sdaitzman @jmakowski1123 Let me know if this looks good or if you want us to make some changes.

Comment on lines 26 to 30
<Button
variant="primary"
onClick={action.onClick}
>{action.label}
</Button>
Copy link
Contributor

Choose a reason for hiding this comment

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

The toast action button color looks too low contrast against the toast background:

image

I think if we can use a proper Toast component, this issue takes care of itself, e.g.

image

expect(openMenuItem).toHaveAttribute('href', '/library/lb:org1:Demo_Course/collection/collection-display-name/');
});

it('should show confirmation box, delete collection and show toast to undo deletion', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for testing this feature so thoroughly!

@navinkarkera navinkarkera force-pushed the navin/delete-collection branch 4 times, most recently from dbd4c1e to fe44d65 Compare October 2, 2024 13:40
@navinkarkera navinkarkera changed the title feat: delete collection feat: delete collection [FC-0062] Oct 2, 2024
@navinkarkera
Copy link
Contributor Author

@pomegranited Thanks for the review! I have now converted ProcessingNotification to use Toast component from Paragon. We do see a warning from toast component due to passing html node as children instead of string which should be resolved by Rômulo's PR: openedx/paragon#3232

Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

👍 Works perfectly @navinkarkera !

  • I tested this on my tutor dev stack
  • I read through the code and tests
  • I checked for accessibility issues by using my keyboard to navigate
  • Includes documentation
  • User-facing strings are extracted for translation

Copy link
Contributor

@ChrisChV ChrisChV left a comment

Choose a reason for hiding this comment

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

@navinkarkera I added some small comments. Also, you need to fix conflicts

src/course-outline/CourseOutline.test.jsx Outdated Show resolved Hide resolved
src/course-outline/CourseOutline.test.jsx Outdated Show resolved Hide resolved
src/course-unit/CourseUnit.test.jsx Outdated Show resolved Hide resolved
src/course-unit/CourseUnit.test.jsx Outdated Show resolved Hide resolved
src/library-authoring/data/apiHooks.ts Outdated Show resolved Hide resolved
src/library-authoring/data/apiHooks.ts Outdated Show resolved Hide resolved
@navinkarkera navinkarkera force-pushed the navin/delete-collection branch from 5436424 to 316166b Compare October 8, 2024 05:17
@ChrisChV ChrisChV enabled auto-merge (squash) October 8, 2024 16:49
@ChrisChV ChrisChV merged commit 434fea3 into openedx:master Oct 8, 2024
6 checks passed
@ChrisChV ChrisChV deleted the navin/delete-collection branch October 8, 2024 17:25
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants