Add Electron GUI and packaging scripts

This commit is contained in:
thePR0M3TH3AN
2025-06-19 13:04:11 -04:00
parent 52f243ab26
commit b54b051405
11 changed files with 167 additions and 0 deletions

16
gui/README.md Normal file
View File

@@ -0,0 +1,16 @@
# VoxVera GUI
This directory contains a minimal Electron wrapper around the `voxvera` CLI.
It exposes a simple "Quickstart" button so non-technical users can generate
flyers without touching the command line.
## Development
```
cd gui/electron
npm install
npm start
```
The Electron app invokes the `voxvera` binary from your `PATH`.
Make sure it is installed before launching the GUI.

16
gui/electron/index.html Normal file
View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>VoxVera GUI</title>
</head>
<body>
<h1>VoxVera</h1>
<button id="quickstart">Quickstart</button>
<script>
document.getElementById('quickstart').addEventListener('click', () => {
window.voxvera.quickstart();
});
</script>
</body>
</html>

28
gui/electron/main.js Normal file
View File

@@ -0,0 +1,28 @@
const { app, BrowserWindow, ipcMain } = require('electron');
const { spawn } = require('child_process');
const path = require('path');
function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
});
win.loadFile('index.html');
}
app.whenReady().then(createWindow);
ipcMain.handle('run-quickstart', async () => {
return new Promise((resolve, reject) => {
const proc = spawn('voxvera', ['quickstart'], { stdio: 'inherit' });
proc.on('close', code => resolve(code));
proc.on('error', err => reject(err));
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});

11
gui/electron/package.json Normal file
View File

@@ -0,0 +1,11 @@
{
"name": "voxvera-gui",
"version": "0.1.0",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron": "^29.0.0"
}
}

5
gui/electron/preload.js Normal file
View File

@@ -0,0 +1,5 @@
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('voxvera', {
quickstart: () => ipcRenderer.invoke('run-quickstart')
});