diff --git a/.electron-vue/build.config.js b/.electron-vue/build.config.js index 776eb49..553e41d 100644 --- a/.electron-vue/build.config.js +++ b/.electron-vue/build.config.js @@ -9,7 +9,7 @@ module.exports = { asar: true, dir: path.join(__dirname, '../'), icon: path.join(__dirname, '../build/icons/icon'), - ignore: /(^\/(src|test|\.[a-z]+|README|yarn|dist\/web))|\.gitkeep/, + ignore: /(^\/(src|test|\.[a-z]+|README|yarn|static|dist\/web))|\.gitkeep/, out: path.join(__dirname, '../build'), overwrite: true, platform: process.env.BUILD_TARGET || 'all' diff --git a/src/main/index.js b/src/main/index.js index aac0864..8c99e13 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -1,4 +1,7 @@ -import {app, BrowserWindow} from 'electron'; +import {app, BrowserWindow, Menu} from 'electron'; + +import AppMenu from './menu'; + /** * Set `__static` path to static files in production @@ -26,6 +29,9 @@ function createWindow() { width: 1000, }); + const menu = Menu.buildFromTemplate(AppMenu.mainMenu()); + Menu.setApplicationMenu(menu); + mainWindow.loadURL(winURL); mainWindow.on('closed', () => { diff --git a/src/main/menu.js b/src/main/menu.js new file mode 100644 index 0000000..83162d7 --- /dev/null +++ b/src/main/menu.js @@ -0,0 +1,110 @@ +const {app} = require('electron'); + +/** main app menu */ +class AppMenu { + /** construct main Menu template. + * @return {Array} the menu template. + */ + static mainMenu() { + const template = [ + { + label: 'File', + submenu: [ + {label: 'Connect to Twitch…'}, + {label: 'Disconnect from Twitch'}, + {label: 'Settings'}, + {type: 'separator'}, + {role: 'quit'}, + ], + }, + { + label: 'Edit', + submenu: [ + {role: 'undo'}, + {role: 'redo'}, + ], + }, + { + label: 'View', + submenu: [ + {role: 'reload'}, + {role: 'forcereload'}, + {role: 'toggledevtools'}, + {type: 'separator'}, + {role: 'resetzoom'}, + {role: 'zoomin'}, + {role: 'zoomout'}, + {type: 'separator'}, + {role: 'togglefullscreen'}, + ], + }, + { + role: 'window', + submenu: [ + {role: 'minimize'}, + {role: 'close'}, + ], + }, + { + role: 'help', + submenu: [ + { + label: 'SourceCode @ Github', + click() { + require('electron').shell.openExternal('https://github.com/bmhm/alttpr-vue-twitch-chat-tracker'); + }, + }, + { + label: 'ElectronJs', + click() { + require('electron').shell.openExternal('https://electronjs.org'); + }, + }, + ], + }, + ]; + + if (process.platform === 'darwin') { + template.unshift({ + label: app.getName(), + submenu: [ + {role: 'about'}, + {type: 'separator'}, + {role: 'services', submenu: []}, + {type: 'separator'}, + {role: 'hide'}, + {role: 'hideothers'}, + {role: 'unhide'}, + {type: 'separator'}, + {role: 'quit'}, + ], + }); + + // Edit menu + template[1].submenu.push( + {type: 'separator'}, + { + label: 'Speech', + submenu: [ + {role: 'startspeaking'}, + {role: 'stopspeaking'}, + ], + } + ); + + // Window menu + template[3].submenu = [ + {role: 'close'}, + {role: 'minimize'}, + {role: 'zoom'}, + {type: 'separator'}, + {role: 'front'}, + ]; + } + + return template; + } +} + + +export default AppMenu; diff --git a/src/renderer/components/TrackerBoss.vue b/src/renderer/components/TrackerBoss.vue index a1fa796..9a63e54 100644 --- a/src/renderer/components/TrackerBoss.vue +++ b/src/renderer/components/TrackerBoss.vue @@ -34,18 +34,18 @@ export default { state: 'deactivated', index: 0, rewards: [ - '/static/bosses/reward0.svg', - '/static/bosses/reward1.svg', - '/static/bosses/reward2.svg', - '/static/bosses/reward3.png', - '/static/bosses/reward4.png', + './static/bosses/reward0.svg', + './static/bosses/reward1.svg', + './static/bosses/reward2.svg', + './static/bosses/reward3.png', + './static/bosses/reward4.png', ], medallionIndex: 0, medallions: [ - '/static/bosses/medallion0.png', - '/static/items/bombos.svg', - '/static/bosses/medallion2.png', - '/static/bosses/medallion3.png', + './static/bosses/medallion0.png', + './static/items/bombos.svg', + './static/bosses/medallion2.png', + './static/bosses/medallion3.png', ], }; }, diff --git a/src/renderer/views/Tracker.vue b/src/renderer/views/Tracker.vue index 865f208..33f2d7f 100644 --- a/src/renderer/views/Tracker.vue +++ b/src/renderer/views/Tracker.vue @@ -66,88 +66,88 @@ export default { data() { return { items: [ - {id: 'bow', title: 'bow', images: ['/static/items/bow0.png'], update: ItemUpdate.bow}, - {id: 'silvers', title: 'silver arrows', update: ItemUpdate.arrows, images: ['/static/items/silvers.png']}, + {id: 'bow', title: 'bow', images: ['./static/items/bow0.png'], update: ItemUpdate.bow}, + {id: 'silvers', title: 'silver arrows', update: ItemUpdate.arrows, images: ['./static/items/silvers.png']}, {id: 'boomerangs', title: 'Boomerangs', update: ItemUpdate.boomerang, images: [ - '/static/items/boomerang0.png', - '/static/items/boomerang1.png', - '/static/items/boomerang2.png', + './static/items/boomerang0.png', + './static/items/boomerang1.png', + './static/items/boomerang2.png', ]}, - {id: 'hookshot', title: 'Hookshot', images: ['/static/items/hookshot.png']}, - {id: 'mushroom', title: 'mushroom', images: ['/static/items/mushroom.png']}, - {id: 'powder', title: 'powder', images: ['/static/items/powder.png']}, + {id: 'hookshot', title: 'Hookshot', images: ['./static/items/hookshot.png']}, + {id: 'mushroom', title: 'mushroom', images: ['./static/items/mushroom.png']}, + {id: 'powder', title: 'powder', images: ['./static/items/powder.png']}, - {id: 'firerod', title: 'firerod', images: ['/static/items/firerod.png']}, - {id: 'icerod', title: 'icerod', images: ['/static/items/icerod.png']}, + {id: 'firerod', title: 'firerod', images: ['./static/items/firerod.png']}, + {id: 'icerod', title: 'icerod', images: ['./static/items/icerod.png']}, - {id: 'bombos', title: 'bombos', images: ['/static/items/bombos.svg']}, - {id: 'ether', title: 'ether', images: ['/static/items/ether.png']}, - {id: 'quake', title: 'quake', images: ['/static/items/quake.png']}, + {id: 'bombos', title: 'bombos', images: ['./static/items/bombos.svg']}, + {id: 'ether', title: 'ether', images: ['./static/items/ether.png']}, + {id: 'quake', title: 'quake', images: ['./static/items/quake.png']}, - {id: 'lantern', title: 'lantern', images: ['/static/items/lantern.png']}, + {id: 'lantern', title: 'lantern', images: ['./static/items/lantern.png']}, /* next 12 */ - {id: 'hammer', title: 'hammer', images: ['/static/items/hammer.png']}, - {id: 'flute', title: 'flute', images: ['/static/items/flute.png']}, + {id: 'hammer', title: 'hammer', images: ['./static/items/hammer.png']}, + {id: 'flute', title: 'flute', images: ['./static/items/flute.png']}, - {id: 'net', title: 'net', images: ['/static/items/net.png']}, - {id: 'book', title: 'book', images: ['/static/items/book.png']}, - {id: 'shovel', title: 'shovel', images: ['/static/items/shovel.png']}, + {id: 'net', title: 'net', images: ['./static/items/net.png']}, + {id: 'book', title: 'book', images: ['./static/items/book.png']}, + {id: 'shovel', title: 'shovel', images: ['./static/items/shovel.png']}, {id: 'bottle', title: 'bottle', images: [ - '/static/items/bottle0.png', - '/static/items/bottle1.png', - '/static/items/bottle2.png', - '/static/items/bottle3.png', - '/static/items/bottle4.png', + './static/items/bottle0.png', + './static/items/bottle1.png', + './static/items/bottle2.png', + './static/items/bottle3.png', + './static/items/bottle4.png', ]}, - {id: 'byrna', title: 'byrna', images: ['/static/items/byrna.png']}, - {id: 'somaria', title: 'somaria', images: ['/static/items/somaria.png']}, + {id: 'byrna', title: 'byrna', images: ['./static/items/byrna.png']}, + {id: 'somaria', title: 'somaria', images: ['./static/items/somaria.png']}, - {id: 'cape', title: 'cape', images: ['/static/items/cape.png']}, - {id: 'mirror', title: 'mirror', images: ['/static/items/mirror.png']}, - {id: 'moonpearl', title: 'moonpearl', images: ['/static/items/moonpearl.png']}, + {id: 'cape', title: 'cape', images: ['./static/items/cape.png']}, + {id: 'mirror', title: 'mirror', images: ['./static/items/mirror.png']}, + {id: 'moonpearl', title: 'moonpearl', images: ['./static/items/moonpearl.png']}, - {id: 'boots', title: 'boots', images: ['/static/items/boots.png']}, + {id: 'boots', title: 'boots', images: ['./static/items/boots.png']}, {id: 'gloves', title: 'gloves', images: [ - '/static/items/glove1.png', - '/static/items/glove2.png', + './static/items/glove1.png', + './static/items/glove2.png', ]}, - {id: 'flippers', title: 'flippers', images: ['/static/items/flippers.png']}, + {id: 'flippers', title: 'flippers', images: ['./static/items/flippers.png']}, - // {id: 'magic', title: 'magic', images: ['/static/items/magic.png']}, + // {id: 'magic', title: 'magic', images: ['./static/items/magic.png']}, {id: 'sword', title: 'sword', images: [ - '/static/items/sword1.png', - '/static/items/sword2.png', - '/static/items/sword3.png', - '/static/items/sword4.png', + './static/items/sword1.png', + './static/items/sword2.png', + './static/items/sword3.png', + './static/items/sword4.png', ]}, {id: 'shield', title: 'shield', images: [ - '/static/items/shield1.png', - '/static/items/shield2.png', - '/static/items/shield3.png', + './static/items/shield1.png', + './static/items/shield2.png', + './static/items/shield3.png', ]}, {id: 'mail', title: 'mail', images: [ - '/static/items/mail0.png', - '/static/items/mail1.png', - '/static/items/mail2.png', + './static/items/mail0.png', + './static/items/mail1.png', + './static/items/mail2.png', ]}, - {id: 'aga1', title: 'Agahnim', images: ['/static/items/aga1.png']}, + {id: 'aga1', title: 'Agahnim', images: ['./static/items/aga1.png']}, ], bosses: [ - {id: 'knights', title: 'Amos Knights', image: '/static/bosses/knights.png'}, - {id: 'lanmolas', title: 'lanmolas', image: '/static/bosses/lanmolas.png'}, - {id: 'moldorm', title: 'moldorm', image: '/static/bosses/moldorm.png'}, + {id: 'knights', title: 'Amos Knights', image: './static/bosses/knights.png'}, + {id: 'lanmolas', title: 'lanmolas', image: './static/bosses/lanmolas.png'}, + {id: 'moldorm', title: 'moldorm', image: './static/bosses/moldorm.png'}, /* dark world */ - {id: 'helmasaur', title: 'helmasaur', image: '/static/bosses/helmasaur.png', hasMedallion: false}, - {id: 'arrghus', title: 'arrghus', image: '/static/bosses/arrghus.png', hasMedallion: false}, - {id: 'mothula', title: 'mothula', image: '/static/bosses/mothula.png', hasMedallion: false}, - - {id: 'blind', title: 'blind', image: '/static/bosses/blind.png', hasMedallion: false}, - {id: 'kholdstare', title: 'kholdstare', image: '/static/bosses/kholdstare.png', hasMedallion: false}, - {id: 'vitreous', title: 'vitreous', image: '/static/bosses/vitreous.png', hasMedallion: true}, - {id: 'trinexx', title: 'Trinexx', image: '/static/bosses/trinexx.png', hasMedallion: true}, + {id: 'helmasaur', title: 'helmasaur', image: './static/bosses/helmasaur.png', hasMedallion: false}, + {id: 'arrghus', title: 'arrghus', image: './static/bosses/arrghus.png', hasMedallion: false}, + {id: 'mothula', title: 'mothula', image: './static/bosses/mothula.png', hasMedallion: false}, + + {id: 'blind', title: 'blind', image: './static/bosses/blind.png', hasMedallion: false}, + {id: 'kholdstare', title: 'kholdstare', image: './static/bosses/kholdstare.png', hasMedallion: false}, + {id: 'vitreous', title: 'vitreous', image: './static/bosses/vitreous.png', hasMedallion: true}, + {id: 'trinexx', title: 'Trinexx', image: './static/bosses/trinexx.png', hasMedallion: true}, ], }; },