Skip to content

Commit

Permalink
feat(electron): init electron
Browse files Browse the repository at this point in the history
  • Loading branch information
kritish-dhaubanjar committed Jan 10, 2025
1 parent 69c3a9d commit 379e590
Show file tree
Hide file tree
Showing 9 changed files with 7,507 additions and 0 deletions.
2 changes: 2 additions & 0 deletions electron/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./build
./dist
Binary file added electron/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions electron/assets/splash.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
width: 100vw;
height: 100vh;
background-image: url('./splash.png');
overflow: hidden;
}
</style>
</head>

<body></body>

</html>
Binary file added electron/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions electron/build
7 changes: 7 additions & 0 deletions electron/electron-builder.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
appId: 'dynamodb-dashboard',
productName: 'DynamoDB Dashboard',
asar: false,
files: ['build', 'assets', 'index.js'],
icon: './assets/icon.png'
}
54 changes: 54 additions & 0 deletions electron/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const server = require('./build/bin/server')
const { app, BrowserWindow } = require('electron/main')

app.disableHardwareAcceleration();

const createWindow = () => {
server.default({ port: 4567, host: 'localhost', debug: true, prefix: "dynamodb" })

const splash = new BrowserWindow({
width: 620,
height: 300,
resizable: false,
frame: false,
autoHideMenuBar: true,
show: false,
webPreferences: {
nodeIntegration: true
},
icon: './assets/icon.png'
})

splash.loadFile('./assets/splash.html')

splash.once('ready-to-show', () => {
splash.show();
});

const win = new BrowserWindow({
minWidth: 1024,
minHeight: 768,
autoHideMenuBar: true,
show: false,
icon: './assets/icon.png'
})

win.once('ready-to-show', () => {
splash.close()
win.show()
})

win.loadURL('http://localhost:4567/dynamodb')
}

app.whenReady().then(() => {
createWindow()

app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})

app.on('window-all-closed', app.quit)
Loading

0 comments on commit 379e590

Please sign in to comment.