BioDrop icon indicating copy to clipboard operation
BioDrop copied to clipboard

[FEATURE] Re-ordering tags with Drag-and-Drop

Open SuperGrut opened this issue 3 years ago • 13 comments

Is this a unique feature?

  • [X] I have checked "open" AND "closed" issues and this is not a duplicate

Is your feature request related to a problem/unavailable functionality? Please describe.

I was updating my profile by adding some tags. I added all the tags. I just felt like re-ordering all the programming languages and organize them together. I went ahead to drag and re-order the tags but discovered the feature hasn't been implemented yet🙄.

We can enhance user experience by implementing a drag-and-drop feature that will allow users to organize tags in an order that makes sense to them, aligning with their preferences or the way they prioritize certain skills or interests without having to delete ones that they have already entered.

ReorderingTag

Proposed Solution

A solution similar to the following video that I am recorded from Upwork would be great as far as implementation is considered

https://github.com/EddieHubCommunity/BioDrop/assets/72060440/14c6ab56-a6ed-4c5f-8285-b68a5949d71a

Screenshots

No response

Do you want to work on this issue?

No

If "yes" to above, please explain how you would technically implement this

Edit by Sara Jaoude:

Using the library already in the project react-sortablejs the sorting can be added to components/tag/TagsInput.js

SuperGrut avatar Nov 12 '23 08:11 SuperGrut

To reduce notifications, issues are locked until they are https://github.com/EddieHubCommunity/BioDrop/labels/%F0%9F%8F%81%20status%3A%20ready%20for%20dev and to be assigned. You can learn more in our contributing guide https://github.com/EddieHubCommunity/BioDrop/blob/main/CONTRIBUTING.md

github-actions[bot] avatar Nov 12 '23 08:11 github-actions[bot]

This is a cool idea @akash19coder and will greatly help folks organize. I am going to open this for discussion first as although you linked the potential UI, I am curious what packages or approach are best for implementation here in your opinion. Any thoughts? (Anyone is welcome to offer some ideas)

amandamartin-dev avatar Nov 13 '23 14:11 amandamartin-dev

Hi, I think we can use either react-dnd or react-beautiful-dnd to implement this feature. (I have not used these packages personally as of yet )(I am new in open source learning and discussions so sorry for any inconvenience).

Mohit-karwasra avatar Nov 16 '23 09:11 Mohit-karwasra

Hi, I think we can use either react-dnd or react-beautiful-dnd to implement this feature. (I have not used these packages personally as of yet )(I am new in open source learning and discussions so sorry for any inconvenience).

Thanks for starting the conversation! We are all learning together for sure. I have heard react-dnd mentioned with next before as well, but personally have no experience with it so will wait for others to weigh in before we unlock this issue.

amandamartin-dev avatar Nov 16 '23 15:11 amandamartin-dev

Great discussion 👍 Please note we already have react-sortablejs in the project for drag and drop sorting, I suggest we use the same library and do not add more

ℹ️ eddiejaoude has some opened assigned issues: 🔧View assigned issues

eddiejaoude avatar Nov 17 '23 19:11 eddiejaoude

Thanks Eddie for the insight, I agree there is no use to import one more library for the same. I would love to give this a try and learn something new along the way if I can be assigned this issue. 😁

Mohit-karwasra avatar Nov 18 '23 16:11 Mohit-karwasra

The issue has been unlocked and is now ready for dev. If you would like to work on this issue, you can comment to have it assigned to you. You can learn more in our contributing guide https://github.com/EddieHubCommunity/BioDrop/blob/main/CONTRIBUTING.md

github-actions[bot] avatar Nov 19 '23 12:11 github-actions[bot]

Thanks Eddie for the insight, I agree there is no use to import one more library for the same. I would love to give this a try and learn something new along the way if I can be assigned this issue. 😁

@Mohit-karwasra thank you for your enthusiasm, however as you are a new contributor to this project we ask that you choose issues where the points range from 1-3 (this is 5 points).

SaraJaoude avatar Nov 19 '23 12:11 SaraJaoude

Can I take it up?

This is issue has two things to be taken care of:

  1. Wrapping the tags with react-sortablejs to add a drag and drop functionality.
  2. Once the wrapping is done, we need to modify the index of the tags as well.
  3. Add the newly sorted to database.

Please let me know if I am missing something.

Abhishek-90 avatar Nov 20 '23 14:11 Abhishek-90

@Abhishek-90 I will assign this to you

SaraJaoude avatar Nov 21 '23 12:11 SaraJaoude

I have added the drag and drop functionality to the profile tags. react-sortablejs also had a SwapPlugin which I used to swap items in a list. Please find below a screen record of the new behavior of profile tags.

https://github.com/EddieHubCommunity/BioDrop/assets/43419831/484ac22d-caa1-4391-b9db-cbbeb4687197

This is issue has two things to be taken care of:

  1. Wrapping the tags with react-sortablejs to add a drag and drop functionality.
  2. Once the wrapping is done, we need to modify the index of the tags as well.
  3. Add the newly sorted to database.

The 2nd point above was not needed afterall. The SwapPlugin took care of it.

Raising a PR for the issue.

Abhishek-90 avatar Nov 23 '23 04:11 Abhishek-90

Hello, I have added the changes required to make the tags to swap amongst themselves. However, while testing I encountered this below error in the video.

https://github.com/EddieHubCommunity/BioDrop/assets/43419831/8b8c3479-fed1-460a-9a50-328abf3fbdc3

The reason for this error is in the below code snippet, from TagsInput.js file.

https://github.com/EddieHubCommunity/BioDrop/blob/e3767d0fca2e0ba37d4c5159c972283388cf8c6c/components/tag/TagsInput.js#L61C7-L77C12

As the input field is part of <ul></ul> tags as a list item. This is ul tag is changed to ReactSortable tag as part of solution for this issue, refer below code snippet.

https://github.com/Abhishek-90/BioDrop/blob/af3d35ddb741374a3c0f6fa4228c99682352c0b9/components/tag/TagsInput.js#L70

Solution: Move the Input field out of the <ul> tag and make the Tags appear below the field.

Let me know if I should solve this error as part of this issue or create a seperate issue for it.

Abhishek-90 avatar Nov 24 '23 08:11 Abhishek-90

TagsInput component is being used on the events page as well, hence due to changes in the component the tags of the events are also having the drag-&-drop and swap functionality. Do we need that or we need to find a different solution.

Solution 1: We can create another component for the TagsInput one will have Drag and drop functionality and other won't(one used on events page)

Solution 2: We can add the prop named isSwapable which if true we will use ReactSortable instead of ul tag.

Abhishek-90 avatar Nov 24 '23 10:11 Abhishek-90