Refactoring nowPlayingPage (playback/queue) and converting it to React #5086
Replies: 2 comments 4 replies
-
I created a small proof of concept of splitting nowPlayingPage logic: https://github.com/dkacperski97/jellyfin-web/pull/1/files At first I copied all the logic related to btnPlayPause to a new component (dkacperski97@25b5b0d), but I think the task of watching playerchange, statechange, playbackstart and playbackstop events should be done by parent controller. So I removed this part from btnPlayPause and now remotecontrol after this events are triggered just calls onPlaybackStopped, onStateChanged or onPlayerChange in btnPlayPause. (dkacperski97@7fea3d3). It could be similarly done in React. The value of currentPlayer and state would be passed in props to children components and when the value of them changes after the playerchange, statechange, playbackstart and playbackstop events are triggered, appropriate functions would be executed in children components by useEffect hook. Let me know what you think. |
Beta Was this translation helpful? Give feedback.
-
I really should write some of this down somewhere...
Currently migrating things to React can take 2 different paths:
Currently the experimental layout must be enabled manually under display > layout, but it should become the default in the future (except when the TV layout is used). The experimental layout will also be the target for future redesign efforts. |
Beta Was this translation helpful? Give feedback.
-
I want to start working on refactoring nowPlayingPage and converting it to React, but first I want to know if my plan for it is okay.
Because nowPlayingPage is one of the legacy pages with complex logic, I think the best solution to eventually convert nowPlayingPage to React is to first split the page into smaller components. The logic of for example: btnPlayPause, positionSlider, volumecontrol can be easily moved to separate components. After splitting, such components could be converted to React. Code review of smaller parts would be easier, and it would be also easier to maintain the stable and experimental version of these components if changes had to be made. It's probably not possible to separate everything nicely, but it would be a good start. Perhaps some of the separated components could also be used by nowPlayingBar.
If we don't want to use
any
type in React components for some of the variables, types would need to be added to the playbackmanager. It is over 4000 lines long, so it would be easier to add types only to the functions used by nowPlayingPage. Or would only the full typed manager be accepted in Jellyfin repo?The playlist on nowPlayingPage has drag&drop functionality. Could the React version of playlist component use some npm package to handle it?
Beta Was this translation helpful? Give feedback.
All reactions