Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Crecket committed Nov 20, 2017
2 parents 806e858 + 45dbddb commit 35fe992
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { devMenuTemplate } from "./menu/dev_menu_template";
import { editMenuTemplate } from "./menu/edit_menu_template";
import createWindow from "./helpers/window";
import registerShortcuts from "./helpers/shortcuts";
import registerTouchBar from './helpers/touchbar';

// Special module holding environment variables which you declared
// in config/env_xxx.json file.
Expand Down Expand Up @@ -62,6 +63,7 @@ app.on("ready", () => {
);

registerShortcuts(mainWindow, app);
registerTouchBar(mainWindow);

if (env.name === "development") {
mainWindow.openDevTools();
Expand Down
43 changes: 43 additions & 0 deletions src/helpers/touchbar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { TouchBar } from 'electron'

const { TouchBarButton } = TouchBar;

export default (window) => {

const dashboardButton = new TouchBarButton({
label: '🏠 Dashboard',
click: () => {
window.webContents.send('change-path', '/')
}
});

const payButton = new TouchBarButton({
label: '👆 Pay',
click: () => {
window.webContents.send('change-path', '/pay')
}
});

const requestButton = new TouchBarButton({
label: '👇 Request',
click: () => {
window.webContents.send('change-path', '/request')
}
});

const bunqMeButton = new TouchBarButton({
label: '💰 bunq.me requests',
click: () => {
window.webContents.send('change-path', '/bunqme-tab')
}
});

const bar = new TouchBar([
dashboardButton,
payButton,
requestButton,
bunqMeButton
]);

window.setTouchBar(bar);
}
10 changes: 10 additions & 0 deletions src/react/Components/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Grid from "material-ui/Grid";
import { withStyles } from "material-ui/styles";
import MuiThemeProvider from "material-ui/styles/MuiThemeProvider";
import createMuiTheme from "material-ui/styles/createMuiTheme";
import { ipcRenderer } from 'electron'

// custom components
import Logger from "../Helpers/Logger";
Expand Down Expand Up @@ -60,6 +61,15 @@ class Layout extends React.Component {
this.state = {
initialBunqConnect: false
};


ipcRenderer.on('change-path', (event, path) => {
const currentPath = this.props.history.location.pathname;

if (currentPath !== path) {
this.props.history.push(path);
}
});
}

componentDidMount() {
Expand Down

0 comments on commit 35fe992

Please sign in to comment.