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

Commit 35fe992

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 806e858 + 45dbddb commit 35fe992

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

src/background.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { devMenuTemplate } from "./menu/dev_menu_template";
77
import { editMenuTemplate } from "./menu/edit_menu_template";
88
import createWindow from "./helpers/window";
99
import registerShortcuts from "./helpers/shortcuts";
10+
import registerTouchBar from './helpers/touchbar';
1011

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

6465
registerShortcuts(mainWindow, app);
66+
registerTouchBar(mainWindow);
6567

6668
if (env.name === "development") {
6769
mainWindow.openDevTools();

src/helpers/touchbar.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { TouchBar } from 'electron'
2+
3+
const { TouchBarButton } = TouchBar;
4+
5+
export default (window) => {
6+
7+
const dashboardButton = new TouchBarButton({
8+
label: '🏠 Dashboard',
9+
click: () => {
10+
window.webContents.send('change-path', '/')
11+
}
12+
});
13+
14+
const payButton = new TouchBarButton({
15+
label: '👆 Pay',
16+
click: () => {
17+
window.webContents.send('change-path', '/pay')
18+
}
19+
});
20+
21+
const requestButton = new TouchBarButton({
22+
label: '👇 Request',
23+
click: () => {
24+
window.webContents.send('change-path', '/request')
25+
}
26+
});
27+
28+
const bunqMeButton = new TouchBarButton({
29+
label: '💰 bunq.me requests',
30+
click: () => {
31+
window.webContents.send('change-path', '/bunqme-tab')
32+
}
33+
});
34+
35+
const bar = new TouchBar([
36+
dashboardButton,
37+
payButton,
38+
requestButton,
39+
bunqMeButton
40+
]);
41+
42+
window.setTouchBar(bar);
43+
}

src/react/Components/Layout.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Grid from "material-ui/Grid";
55
import { withStyles } from "material-ui/styles";
66
import MuiThemeProvider from "material-ui/styles/MuiThemeProvider";
77
import createMuiTheme from "material-ui/styles/createMuiTheme";
8+
import { ipcRenderer } from 'electron'
89

910
// custom components
1011
import Logger from "../Helpers/Logger";
@@ -60,6 +61,15 @@ class Layout extends React.Component {
6061
this.state = {
6162
initialBunqConnect: false
6263
};
64+
65+
66+
ipcRenderer.on('change-path', (event, path) => {
67+
const currentPath = this.props.history.location.pathname;
68+
69+
if (currentPath !== path) {
70+
this.props.history.push(path);
71+
}
72+
});
6373
}
6474

6575
componentDidMount() {

0 commit comments

Comments
 (0)