<commit_before>import { app, BrowserWindow, ipcMain } from 'electron'
import { isDev, getAppFolder } from './helpers/app'

// Keep a global reference of the window objects to prevent gc
let mainWindow, onboardingWindow, importWindow, statsWindow

export function openOnboardingWindow() {
  onboardingWindow = new BrowserWindow({
    width: 450,
    height: 320,
    show: false,
    resizable: false,
    titleBarStyle: 'hidden',
    type: 'splash'
  })
  onboardingWindow.loadURL(`file://${getAppFolder()}/src/onboarding.html`)

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

  ipcMain.on('onboarding-finished', () => {
    openMainWindow()
    onboardingWindow.close()
  })

  onboardingWindow.on('closed', () => {
    onboardingWindow = null
  })
}

export function openMainWindow() {
  mainWindow = new BrowserWindow({
    width: 1200,
    height: isDev ? 900 : 710, // create room for dev tools 
    show: false
  })
  mainWindow.loadURL(`file://${getAppFolder()}/src/main.html`)

  if (isDev) {
    mainWindow.webContents.openDevTools()
  }

  mainWindow.once('ready-to-show', () => {
    mainWindow.show()
    mainWindow.focus()
  })

  mainWindow.on('closed', () => {
    mainWindow = null
  })
}

export function openImportWindow() {
  importWindow = new BrowserWindow({
    width: 380,
    height: 260,
    show: false
  })
  importWindow.loadURL(`file://${getAppFolder()}/src/import.html`)

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

  ipcMain.on('import-finished', () => {
    importWindow.close()
  })

  importWindow.on('closed', () => {
    importWindow = null
  })
}


export function openStatsWindow() {
  statsWindow = new BrowserWindow({
    width: 650,
    height: 815,
    show: false
  })
  statsWindow.loadURL(`file://${getAppFolder()}/src/stats.html`)

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

  statsWindow.on('closed', () => {
    statsWindow = null
  })
}

export function allWindowsClosed() {
  return (mainWindow == null && onboardingWindow == null && importWindow == null)<commit_msg>better width<commit_after>import { app, BrowserWindow, ipcMain } from 'electron'
import { isDev, getAppFolder } from './helpers/app'

// Keep a global reference of the window objects to prevent gc
let mainWindow, onboardingWindow, importWindow, statsWindow

export function openOnboardingWindow() {
  onboardingWindow = new BrowserWindow({
    width: 450,
    height: 320,
    show: false,
    resizable: false,
    titleBarStyle: 'hidden',
    type: 'splash'
  })
  onboardingWindow.loadURL(`file://${getAppFolder()}/src/onboarding.html`)

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

  ipcMain.on('onboarding-finished', () => {
    openMainWindow()
    onboardingWindow.close()
  })

  onboardingWindow.on('closed', () => {
    onboardingWindow = null
  })
}

export function openMainWindow() {
  mainWindow = new BrowserWindow({
    width: 1200,
    height: isDev ? 900 : 710, // create room for dev tools
    show: false
  })
  mainWindow.loadURL(`file://${getAppFolder()}/src/main.html`)

  if (isDev) {
    mainWindow.webContents.openDevTools()
  }

  mainWindow.once('ready-to-show', () => {
    mainWindow.show()
    mainWindow.focus()
  })

  mainWindow.on('closed', () => {
    mainWindow = null
  })
}

export function openImportWindow() {
  importWindow = new BrowserWindow({
    width: 380,
    height: 260,
    show: false
  })
  importWindow.loadURL(`file://${getAppFolder()}/src/import.html`)

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

  ipcMain.on('import-finished', () => {
    importWindow.close()
  })

  importWindow.on('closed', () => {
    importWindow = null
  })
}


export function openStatsWindow() {
  statsWindow = new BrowserWindow({
    width: 660,
    height: 815,
    show: false
  })
  statsWindow.loadURL(`file://${getAppFolder()}/src/stats.html`)

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

  statsWindow.on('closed', () => {
    statsWindow = null
  })
}

export function allWindowsClosed() {
  return (mainWindow == null && onboardingWindow == null && importWindow == null)
{'fraction_non_alphanumeric': 0.15901561760530053, 'fraction_numerical': 0.013251301467108376, 'mean_word_length': 3.520855614973262, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6305643', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1334, 'n_words': 262}