diff --git a/src/node/index.js b/src/node/index.js index 360a4c7..9b43f4d 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -1,6 +1,6 @@ import fs from 'fs' import yargs from 'yargs' -import { app, shell } from 'electron' +import { app, shell, BrowserWindow } from 'electron' import { pollPublicData, pollSpreadsheetData, processData } from './data' import StreamWindow from './StreamWindow' @@ -52,6 +52,8 @@ async function main() { const streamWindow = new StreamWindow() streamWindow.init() + let browseWindow = null + const clientState = {} const getInitialState = () => clientState let broadcastState = () => {} @@ -62,6 +64,11 @@ async function main() { streamWindow.setListeningView(msg.viewIdx) } else if (msg.type === 'reload-view') { streamWindow.reloadView(msg.viewIdx) + } else if (msg.type === 'browse') { + if (!browseWindow || browseWindow.isDestroyed()) { + browseWindow = new BrowserWindow() + } + browseWindow.loadURL(msg.url) } } diff --git a/src/static/life-ring-regular.svg b/src/static/life-ring-regular.svg new file mode 100644 index 0000000..3c0f07e --- /dev/null +++ b/src/static/life-ring-regular.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/web/control.js b/src/web/control.js index 57802c9..4e545ee 100644 --- a/src/web/control.js +++ b/src/web/control.js @@ -9,6 +9,7 @@ import '../index.css' import { GRID_COUNT } from '../constants' import SoundIcon from '../static/volume-up-solid.svg' import ReloadIcon from '../static/redo-alt-solid.svg' +import LifeRingIcon from '../static/life-ring-regular.svg' function emptyStateIdxMap() { return new Map( @@ -113,6 +114,15 @@ function App({ wsEndpoint }) { ) }, []) + const handleBrowse = useCallback((url) => { + wsRef.current.send( + JSON.stringify({ + type: 'browse', + url, + }), + ) + }, []) + return (