diff --git a/desktop/menus/mac-app-menu.js b/desktop/menus/mac-app-menu.js index 274b0bc71..106413d39 100644 --- a/desktop/menus/mac-app-menu.js +++ b/desktop/menus/mac-app-menu.js @@ -21,6 +21,13 @@ const buildMacAppMenu = (isAuthenticated) => { { role: 'hide' }, { role: 'hideothers' }, { role: 'unhide' }, + ...(isAuthenticated + ? [ + { type: 'separator' }, + menuItems.emptyTrash(isAuthenticated), + menuItems.signout(isAuthenticated), + ] + : []), { type: 'separator' }, { role: 'quit' }, ]; diff --git a/desktop/menus/menu-items.js b/desktop/menus/menu-items.js index 667f8593b..89449dcc5 100644 --- a/desktop/menus/menu-items.js +++ b/desktop/menus/menu-items.js @@ -16,6 +16,14 @@ const checkForUpdates = { click: updater.pingAndShowProgress.bind(updater), }; +const emptyTrash = (isAuthenticated) => { + return { + label: '&Empty Trash', + visible: isAuthenticated, + click: appCommandSender({ action: 'emptyTrash' }), + }; +}; + const preferences = (isAuthenticated) => { return { label: 'P&references…', @@ -28,8 +36,20 @@ const preferences = (isAuthenticated) => { }; }; +const signout = (isAuthenticated) => { + return { + label: '&Sign Out', + visible: isAuthenticated, + click: appCommandSender({ + action: 'logout', + }), + }; +}; + module.exports = { about, checkForUpdates, + emptyTrash, preferences, + signout, }; diff --git a/lib/navigation-bar/index.tsx b/lib/navigation-bar/index.tsx index df0fac0f4..0e94d4f31 100644 --- a/lib/navigation-bar/index.tsx +++ b/lib/navigation-bar/index.tsx @@ -1,8 +1,7 @@ -import React, { Component, Fragment } from 'react'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import onClickOutside from 'react-onclickoutside'; -import { isElectron } from '../utils/platform'; import ConnectionStatus from '../connection-status'; import NavigationBarItem from './item'; import TagList from '../tag-list'; @@ -91,42 +90,38 @@ export class NavigationBar extends Component { - {(!isElectron || autoHideMenuBar) && ( - -
- } - label="Settings" - onClick={onSettings} - /> -
-
- -
-
- - -
-
- )} +
+ } + label="Settings" + onClick={onSettings} + /> +
+
+ +
+
+ + +
); } diff --git a/lib/state/electron/middleware.ts b/lib/state/electron/middleware.ts index 72e4861c0..58b19da0d 100644 --- a/lib/state/electron/middleware.ts +++ b/lib/state/electron/middleware.ts @@ -5,10 +5,18 @@ import * as S from '../'; export const middleware: S.Middleware = ({ dispatch, getState }) => { window.electron.receive('appCommand', (command) => { switch (command.action) { + case 'emptyTrash': + dispatch(actions.ui.emptyTrash()); + return; + case 'exportNotes': dispatch(actions.data.exportNotes()); return; + case 'logout': + dispatch({ type: 'LOGOUT' }); + return; + case 'printNote': window.print(); return;