radiant-player / radiant-player-electron

:zap: The future Radiant Player 2.0
https://radiant-player.github.io
32 stars 8 forks source link

Back button #11

Open chrismou opened 8 years ago

chrismou commented 8 years ago

Implement a back button for navigating back from within the player.

For bonus points, also implement a forward button (as Radiant v1 currently has)

jacobwgillespie commented 8 years ago

Back / forward are already implemented as keyboard shortcuts, just need to get their state into the shared redux store and add buttons to the custom titlebar.

matthewdias commented 8 years ago

from what I can tell theyre already in the store via menu.js? If i tried to tackle this, what would be the best method to insert the buttons in the webview? Or should I just put them in the titlebar? They would look kind of out of place to the left of the hamburger menu.

jacobwgillespie commented 8 years ago

The buttons are there yes, but the state of webview.canGoBack() and webview.canGoForward() would need to exist in the redux store so that the buttons could be enabled or disabled conditionally. As a plus the menu items could enable / disable conditionally as well.

https://github.com/electron/electron/blob/master/docs/api/web-view-tag.md#webviewcangoback

I would either add the buttons to the titlebar and somehow detect when the menu opens on GPM to dynamically move / hide them, or I would extend the gpm module (the one here) that is injected into the webview to mount a new react component for the back/forward buttons to the right of the hamburger menu and connect its props to the IPC interface. Either isn't necessarily trivial, though I suspect that the second option will work out to be the "best" option.

matthewdias commented 8 years ago

Ah I didnt see that module. That indeed sounds like the better option.

jacobwgillespie commented 8 years ago

I should probably update the README / docs to better cover what's already been written. 😃