Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[WIP] Button to delete tracks from playlist #378
Conversation
Remove '&' from last.fm track name
…en the album view If the album is not found, we open the artist view.
Multiple queue popovers fix
Fix to #192 : add ability to click on album name in dashboard to open
Testing out Github actions
Feature/lyrics
Feature/dashboard/add and play track
Toast notifications, closes #169
Autoradio Averager + enhancement
add remote-redux-devtool
The slider will be shown when an a min and a max value are given to the settings of a NUMBER setting
This comment has been minimized.
This comment has been minimized.
|
not 100% sure, but I think that this will be false of |
This comment has been minimized.
This comment has been minimized.
|
Correct, thanks. Changed to a |
This comment has been minimized.
This comment has been minimized.
|
if you're changing these from consts to regular variables, you should also change their names to regular camel case, since uppercase suggests const and could lead to some confusion |
This comment has been minimized.
This comment has been minimized.
|
Agreed. |
|
If you look at this function, renaming is accomplished by cloning the playlist, changing the name of the new copy, and calling updatePlaylist. The old playlist will be replaced with this copy, because they have the same id. To delete a track from a playlist, you should create a similar function, that instead of changing the name of the cloned playlist will filter its tracks (just don't use updatedPlaylist.tracks = _.filter(updatedPlaylist.tracks, track => track.id !== trackToRemove.id )BTW. This workflow makes me think it'd be a good idea to prepare a couple of simple functionalities to implement for people who are learning and would like to contribute to some open source project but who don't feel too confident yet, so that they can solve a real life problem while being guided in a friendly way, both learning and contributing. |
|
Thanks for the guidance, I'll try my best to implement the above example-code into a delete-track function! To answer your above-mentioned idea about making some issues that contain a couple of simple functionalities to implement for people who are learning and would like to contribute to some open source project: |
This comment has been minimized.
This comment has been minimized.
|
The code is still not quite working as I want it to work and I can't really read me to what mistake I have made. Can you see what I haven't gone right? |
|
It was right to have Take a look how You have to do something similar, except instead of changing the name you are going to change the list of the tracks. As a hint, you're going to need the playlist and the track id as arguments. The steps that you'll need to take are:
And then after you have this function, you can connect it to the button like you already did (by supplying it in the |
|
Thanks, I'll give it my best shot! |
This comment has been minimized.
This comment has been minimized.
|
Hey @nukeop , I know my attempt is a trainwreck of a code, but I simply cannot make the deleteTrack-code work. The more I read about React and how it all works, the more confused and lost I feel. |
|
You almost got it. Just remember that you don't have to modify anything in actions/playlists.js to make this work. You can revert your changes there. Maybe I'm explaining this too chaotically. I'll try to explain it better in a bit. |
|
Hi nuke, I'm sorry it's been a while since I last made a pull request, I've been on vacation. |
|
No problems, we don't have deadlines here. You can contribute at your own pace. I'll test your code now. |
|
The code is still not working, but I'm pretty sure I'm getting close. |
|
Hey @nukeop this should be the final and working code if I'm not wrong :-) |
|
Yes, I think you've nailed it. I'll verify so that we're 100% sure. Btw, this could be a good opportunity to add a test for this function too. I'll check if I can add code to your branch and if not I'll add it in a comment and ask you to commit it, if you agree. |
|
I'll add the tests after you correct this small issue and merge everything, so you don't have to worry about it. |
|
This is how I intend to test the updatePlaylist function after your changes, for reference. I implemented dependency injection for deletePlaylist here, updatePlaylist will be refactored similarly. |
|
Hi Nuke, I'm experiencing some issues with opening the app on my computer common to the error I've had before with only the logo of the app appearing when running the app in the browser. Even though I am pretty sure I can code the last bit without looking at the result of the code in the app, I still want to make sure it works before I push it to Github. I just want to make you know, that I haven't forgot about this issue and that i'll soon be pushing the final bit of code up :-) |
|
No problem, take as much time as you need. |
|
Hi nuke, I finally got time again to work on this project, as I have been taking a bunch of React courses and freelance work to really understand what this app is all about and how it really works. It's been a time since I've last worked in the dev version of Nuclear and now my gitbash throws me an error every time I try to use npm run:watch in the app directory saying ''webpack-dev-server' is not recognized as an internal or external command'. I downloaded webpack for this project, but is does not seem to work, do you have any suggestions for why this error might appear? |
|
I've changed the architecture in a major way recently. You can either try using docker (it's just one command to run dev mode now), or you could clone the repo, cd to |

Hey nukeop, I made some changes in my effort to create a delete function that deletes tracks. So far it's not working but I'm pretty sure I've done something right some places. I tried to create a function just like the function that delete the entire playlists by mimicking some of the code from the "deletePlaylist" function. I just don't know, if that is even the right thing to do.
I appreciate the help and hope that the adding I made is not all bad.