From 84090525094b9f9cd7cfc4ee4968243e9c687335 Mon Sep 17 00:00:00 2001 From: olzzon Date: Sat, 20 Nov 2021 07:18:26 +0100 Subject: [PATCH] feat: load and save presets --- public/electron.js | 2 +- src/client/components/mainPage.tsx | 44 ++++++++++++++++++++++++++++++ src/client/styles/MainPage.css | 16 ++++++++++- src/models/SOCKET_IO_CONTANTS.ts | 2 ++ src/server/index.ts | 31 ++++++++++++++++++--- src/server/utils/storage.ts | 44 ++++++++++++++---------------- src/server/webserver/webServer.ts | 25 ++++++++++++++--- 7 files changed, 131 insertions(+), 33 deletions(-) diff --git a/public/electron.js b/public/electron.js index 8df77ae..4100ce9 100644 --- a/public/electron.js +++ b/public/electron.js @@ -9,7 +9,7 @@ function createWindow() { const win = new BrowserWindow({ width: 1280, height: 800, - minWidth: 800, + minWidth: 1000, minHeight: 600, darkTheme: true, webPreferences: { diff --git a/src/client/components/mainPage.tsx b/src/client/components/mainPage.tsx index 4b65a14..01c42d2 100644 --- a/src/client/components/mainPage.tsx +++ b/src/client/components/mainPage.tsx @@ -11,6 +11,8 @@ import { IDiscoveredNdiSource, ISource, ITarget } from '../../models/interfaces' export const socketClient = io() +const presetList = ['Preset 1', 'Preset 2', 'Preset 3', 'Preset 4'] + const MainPage = () => { const [showSettings, setShowSettings] = useState(false) const [targets, setTargets] = useState([]) @@ -50,6 +52,47 @@ const MainPage = () => { setShowSettings(!showSettings) } + const handleLoadPreset = (index: number) => { + if (window.confirm('Are you sure you wan´t to load Preset ' + (index +1))) { + socketClient.emit(IO.LOAD_PRESET, presetList[index]) + } + } + + const handleSavePreset = (index: number) => { + if (window.confirm('SAVE PRESET ' + (index + 1))) { + socketClient.emit(IO.SAVE_PRESET, presetList[index]) + } + } + + const Presets = () => { + return ( + + {presetList.map((preset: string, index: number) => { + return ( + + + + + ) + })} + + ) + } + return (
@@ -60,6 +103,7 @@ const MainPage = () => {
+