diff --git a/main.js b/main.js index 95a644143..e7d1b89e5 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,8 @@ const electron = require('electron') +var platform = require('os').platform() // Module to control application life. const app = electron.app +const Tray = electron.Tray // Module to create native browser window. const BrowserWindow = electron.BrowserWindow @@ -10,8 +12,16 @@ let mainWindow function createWindow () { // Create the browser window. - mainWindow = new BrowserWindow({width: 1280, height: 800, icon:__dirname + '/src/img/favicon.ico'}) + mainWindow = new BrowserWindow({width: 1280, height: 800, icon: __dirname + '/src/img/icon.ico'}) + var trayIcon; + if (platform == 'darwin'){ + trayIcon = __dirname + '/src/img/icon.png' + }else{ + trayIcon = __dirname + '/src/img/icon.ico' + } + + appIcon = new Tray(trayIcon) // and load the index.html of the app. mainWindow.loadURL(`file://${__dirname}/index.html`) diff --git a/package.json b/package.json index dcf3bd3ea..a4f54e00f 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "start": "set ENV=development & electron .", "dev": "concurrently -k \"babel-node server.js\" \"npm start\"", "build": "webpack --config webpack.config.production.js && electron-packager . Bloodhound --platform=all --arch=all --overwrite --prune", - "winbuild": "webpack --config webpack.config.production.js && electron-packager . Bloodhound --platform=win32 --arch=all --overwrite --prune" + "winbuild": "webpack --config webpack.config.production.js && electron-packager . BloodHound --platform=win32 --arch=x64 --overwrite --prune" }, "babel": { "presets": [ diff --git a/src/components/SearchContainer/Tabs/PrebuiltQueriesDisplay.jsx b/src/components/SearchContainer/Tabs/PrebuiltQueriesDisplay.jsx index fb7aabffd..f1fce39da 100644 --- a/src/components/SearchContainer/Tabs/PrebuiltQueriesDisplay.jsx +++ b/src/components/SearchContainer/Tabs/PrebuiltQueriesDisplay.jsx @@ -12,16 +12,20 @@ export default class PrebuiltQueriesDisplay extends Component { } componentWillMount() { - fs.readFile('src/components/SearchContainer/Tabs/PrebuiltQueries.json', 'utf8', function(err, data){ - var x = JSON.parse(data) - var y = [] + $.ajax({ + url: 'src/components/SearchContainer/Tabs/prebuiltqueries.json', + type: 'GET', + success: function(response){ + var x = JSON.parse(response) + var y = [] - $.each(x.queries, function(index, el) { - y.push(el) - }); + $.each(x.queries, function(index, el) { + y.push(el) + }); - this.setState({queries: y}) - }.bind(this)) + this.setState({queries: y}) + }.bind(this) + }) } render() { diff --git a/src/img/icon.icns b/src/img/icon.icns new file mode 100644 index 000000000..b26a85e99 Binary files /dev/null and b/src/img/icon.icns differ diff --git a/src/img/icon.ico b/src/img/icon.ico new file mode 100644 index 000000000..8af352676 Binary files /dev/null and b/src/img/icon.ico differ diff --git a/src/img/icon.png b/src/img/icon.png new file mode 100644 index 000000000..23eecac85 Binary files /dev/null and b/src/img/icon.png differ diff --git a/src/img/icon@2x.png b/src/img/icon@2x.png new file mode 100644 index 000000000..12085c6b8 Binary files /dev/null and b/src/img/icon@2x.png differ diff --git a/webpack.config.development.js b/webpack.config.development.js index c9d056801..80819be6c 100644 --- a/webpack.config.development.js +++ b/webpack.config.development.js @@ -25,7 +25,10 @@ var config = { }, plugins: [ new webpack.HotModuleReplacementPlugin(), - ] + ], + node: { + __dirname: true + } }; config.target = webpackTargetElectronRenderer(config);