<commit_before>import { Menu, MenuItem } from "electron";

export class MainMenu {
  constructor(app, tray) {
    this.app = app;
    this.tray = tray;
  }
  initialize() {
    this.setTrayHandler();
  }
  setTrayHandler() {
    this.tray.on("right-click", () => {
      this.tray.popUpContextMenu(this.buildMenu());
    });
  }
  buildMenu() {
    const menu = new Menu();
    const quitItem = new MenuItem({
      type: "normal",
      label: "Quit",
      id: "quit",
      accelerator: "Q",
      click: (menuItem, browserWindow, event) => {
        this.app.quit();
      }
    });
    menu.append(quitItem);
    return menu;
  }
}<commit_msg>Add about page (fixes #28)<commit_after>import { Menu, MenuItem } from "electron";
const { shell } = require("electron");

export class MainMenu {
  constructor(app, tray) {
    this.app = app;
    this.tray = tray;
    this.websiteUri =
      "http://www.sleeptight.tech/about/v/" + this.inferVersion();
  }
  initialize() {
    this.setTrayHandler();
  }
  setTrayHandler() {
    this.tray.on("right-click", () => {
      this.tray.popUpContextMenu(this.buildMenu());
    });
  }
  buildMenu() {
    const menu = new Menu();
    const aboutItem = new MenuItem({
      type: "normal",
      label: "About",
      id: "about",
      accelerator: "A",
      click: (menuItem, browserWindow, event) => {
        this.openWebSite();
      }
    });
    const quitItem = new MenuItem({
      type: "normal",
      label: "Quit",
      id: "quit",
      accelerator: "Q",
      click: (menuItem, browserWindow, event) => {
        this.app.quit();
      }
    });
    menu.append(aboutItem);
    menu.append(quitItem);
    return menu;
  }
  openWebSite() {
    const uri = this.websiteUri;
    shell.openExternal(uri);
  }
  inferVersion() {
    return this.app.getVersion();
  }
}
{'fraction_non_alphanumeric': 0.16383561643835617, 'fraction_numerical': 0.001095890410958904, 'mean_word_length': 2.478095238095238, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '2808382', 'n_tokens_mistral': 630, 'n_tokens_neox': 617, 'n_words': 124}