Use webpack to build
This commit is contained in:
@@ -4,15 +4,12 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>electron-mattermost</title>
|
||||
<script src="../node_modules/react/dist/react.min.js"></script>
|
||||
<script src="../node_modules/react-dom/dist/react-dom.min.js"></script>
|
||||
<script src="../node_modules/react-bootstrap/dist/react-bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="modules/bootstrap/css/bootstrap.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script src="build/index.js"></script>
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -1,5 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const React = require('react');
|
||||
const ReactDOM = require('react-dom');
|
||||
const ReactBootstrap = require('react-bootstrap');
|
||||
|
||||
const Grid = ReactBootstrap.Grid;
|
||||
const Row = ReactBootstrap.Row;
|
||||
const Col = ReactBootstrap.Col;
|
||||
|
@@ -4,15 +4,12 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Settings</title>
|
||||
<script src="../node_modules/react/dist/react.min.js"></script>
|
||||
<script src="../node_modules/react-dom/dist/react-dom.min.js"></script>
|
||||
<script src="../node_modules/react-bootstrap/dist/react-bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="modules/bootstrap/css/bootstrap.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script src="build/settings.js"></script>
|
||||
<script src="settings.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -3,6 +3,10 @@
|
||||
const remote = require('electron').remote;
|
||||
const settings = require('../common/settings');
|
||||
|
||||
const React = require('react');
|
||||
const ReactDOM = require('react-dom');
|
||||
const ReactBootstrap = require('react-bootstrap');
|
||||
|
||||
const Grid = ReactBootstrap.Grid;
|
||||
const Row = ReactBootstrap.Row;
|
||||
const Col = ReactBootstrap.Col;
|
||||
@@ -12,6 +16,10 @@ const ListGroup = ReactBootstrap.ListGroup;
|
||||
const ListGroupItem = ReactBootstrap.ListGroupItem;
|
||||
const Glyphicon = ReactBootstrap.Glyphicon;
|
||||
|
||||
function backToIndex(){
|
||||
window.location = 'index.html';
|
||||
}
|
||||
|
||||
var SettingsPage = React.createClass({
|
||||
getInitialState: function() {
|
||||
var config;
|
||||
@@ -42,10 +50,10 @@ var SettingsPage = React.createClass({
|
||||
currentWindow.setAutoHideMenuBar(config.hideMenuBar);
|
||||
currentWindow.setMenuBarVisibility(!config.hideMenuBar);
|
||||
}
|
||||
window.location = './index.html';
|
||||
backToIndex();
|
||||
},
|
||||
handleCancel: function() {
|
||||
window.location = './index.html';
|
||||
backToIndex();
|
||||
},
|
||||
handleChangeHideMenuBar: function() {
|
||||
this.setState({
|
||||
|
12
src/main.js
12
src/main.js
@@ -7,9 +7,10 @@ const Menu = electron.Menu;
|
||||
const Tray = electron.Tray;
|
||||
const ipc = electron.ipcMain;
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
var settings = require('./common/settings');
|
||||
var appMenu = require('./menus/app');
|
||||
var appMenu = require('./main/menus/app');
|
||||
|
||||
var argv = require('yargs').argv;
|
||||
|
||||
@@ -38,6 +39,7 @@ try {
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
config = settings.loadDefault();
|
||||
console.log('Failed to read or upgrade config.json');
|
||||
}
|
||||
|
||||
@@ -83,9 +85,9 @@ app.on('before-quit', function() {
|
||||
app.on('ready', function() {
|
||||
// set up tray icon to show balloon
|
||||
if (process.platform === 'win32') {
|
||||
trayIcon = new Tray(__dirname + '/resources/tray.png');
|
||||
trayIcon = new Tray(path.resolve(__dirname, 'resources/tray.png'));
|
||||
trayIcon.setToolTip(app.getName());
|
||||
var tray_menu = require('./menus/tray').createDefault();
|
||||
var tray_menu = require('./main/menus/tray').createDefault();
|
||||
trayIcon.setContextMenu(tray_menu);
|
||||
trayIcon.on('click', function() {
|
||||
mainWindow.focus();
|
||||
@@ -95,7 +97,7 @@ app.on('ready', function() {
|
||||
});
|
||||
ipc.on('notified', function(event, arg) {
|
||||
trayIcon.displayBalloon({
|
||||
icon: __dirname + '/resources/appicon.png',
|
||||
icon: path.resolve(__dirname, 'resources/appicon.png'),
|
||||
title: arg.title,
|
||||
content: arg.options.body
|
||||
});
|
||||
@@ -112,7 +114,7 @@ app.on('ready', function() {
|
||||
// follow Electron's defaults
|
||||
window_options = {};
|
||||
}
|
||||
window_options.icon = __dirname + '/resources/appicon.png';
|
||||
window_options.icon = path.resolve(__dirname, 'resources/appicon.png');
|
||||
mainWindow = new BrowserWindow(window_options);
|
||||
if (window_options.maximized) {
|
||||
mainWindow.maximize();
|
||||
|
@@ -15,7 +15,7 @@ var createTemplate = function(mainWindow) {
|
||||
}, {
|
||||
label: 'Settings',
|
||||
click: function(item, focusedWindow) {
|
||||
mainWindow.loadURL('file://' + __dirname + '/../browser/settings.html');
|
||||
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
||||
}
|
||||
}, {
|
||||
label: 'Quit',
|
Reference in New Issue
Block a user