const {app, BrowserWindow} = require('electron')
const isDev = require('electron-is-dev');
const {TitlebarRespect} = require('electron-titlebar-respect')
const glasstron = require('glasstron-clarity');

function createWindow () {
  const mainWindow = new glasstron.BrowserWindow({
    title: 'App Name',
    minWidth: 400,
    minHeight: 400,
    width: 1200,
    height: 800,
    autoHideMenuBar: true,
    blur: true,
    frame: global.frame,
    titleBarStyle: global.titleBarStyle,
    trafficLightPosition: { x: 25, y: 25 }, // Position of Traffic Light buttons on macOS
    titleBarOverlay: { // Background and Height of Windows titlebar buttons
      color: '#191919', // Background
      symbolColor: 'white', // Icon
      height: '40px',
    },
    webPreferences: {
      webviewTag: true
    }
  })
  if (isDev) {
    mainWindow.loadURL('http://localhost:3000') // Use a URL in development mode
  } else {
    mainWindow.loadFile('app/index.html') // Do NOT use a URL in production mode, as that can create a security risk for your customers who will use this app
  }
}
app.whenReady().then(() => {createWindow()})
