diff --git a/src/App.js b/src/App.js index 71a37c4..7edfd9c 100644 --- a/src/App.js +++ b/src/App.js @@ -11,7 +11,7 @@ class App extends Component { super(props); this.state = { discoveries: [], - groups: [], // Currently duscovered patterns and their controllers + groups: [], // Currently discovered patterns and their controllers runningPatternName: null, playlist: [], // Browser-persisted single playlist singleton playlistIndex: 0, @@ -19,9 +19,10 @@ class App extends Component { cloneSource: null, cloneDest: {}, cloneInProgress: false, - showDevControls: false + showDevControls: false, + showCurrentPlaylist: false, } - // The playlist is the only thing currently persisted and it is per-broswer + // The playlist is the only thing currently persisted, and it is per-browser this.state.playlist = JSON.parse(localStorage.getItem(PLAYLIST_KEY)) || [] if (this.state.playlist.length) { @@ -33,6 +34,7 @@ class App extends Component { this._playlistInterval = null this.cloneDialogRef = React.createRef(); + this.playlistDialogRef = React.createRef(); } async poll() { @@ -207,7 +209,20 @@ class App extends Component { this.cloneDialogRef.current && this.cloneDialogRef.current.scrollIntoView(true); }, 100) } - + openPlaylistDialog = async (event) => { + event.preventDefault(); + this.setState({ + showCurrentPlaylist: true + }); + setTimeout(() => { + this.playlistDialogRef.current && this.playlistDialogRef.current.scrollIntoView(true); + }, 100) + if( this.state.showCurrentPlaylist === true ) { + this.setState({ + showCurrentPlaylist: false + }); + } + } closeCloneDialog = async (event) => { event.preventDefault(); this.setState({ @@ -260,7 +275,6 @@ class App extends Component { } } - render() { let cloneDialog = null; if (this.state.cloneSource) { @@ -309,6 +323,44 @@ class App extends Component { ) } + let playlistDialog = null + if (this.state.showCurrentPlaylist) { + playlistDialog = ( +
Pattern
+Duration(seconds)
+