Skip to content

Commit

Permalink
update menu when bot is closed to disable Close Tab option
Browse files Browse the repository at this point in the history
  • Loading branch information
Corina committed Nov 6, 2018
1 parent c5adad8 commit 0547bc7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ Setting up a node debugger depends on your tooling. Please refer to the document
for your flavor of tools. For more information on debugging NodeJS in general, refer to [this guide](https://nodejs.org/en/docs/guides/debugging-getting-started/)

#### The Client
Ctrl+Shift+I (Windows) or opt+cmd+i (Mac) when the emulator is in focus will open chrome dev tools for debugging.
For remote debugging, add `--remote-debugging-port=9222` to the `start:electron` script in the `package.json` located in `packages\app\main`.
***

Expand Down
24 changes: 18 additions & 6 deletions packages/app/main/src/appMenuBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { mainWindow } from './main';
import { ConversationService } from './services/conversationService';
import { rememberTheme } from './settingsData/actions/windowStateActions';
import { getStore as getSettingsStore } from './settingsData/store';
import { getActiveBot } from './botHelpers';

declare type MenuOpts = Electron.MenuItemConstructorOptions;

Expand Down Expand Up @@ -142,14 +143,25 @@ export const AppMenuBuilder = new class AppMenuBuilderImpl implements AppMenuBui
.catch(err => console.error('Error opening transcript file from menu: ', err));
}
},
{ type: 'separator' },
{
{ type: 'separator' }
);

const activeBot = getActiveBot();
if (activeBot !== null) {
subMenu.push({
label: 'Close Tab',
click: () => {
mainWindow.commandService.remoteCall(Bot.Close);
click: async () => {
await mainWindow.commandService.remoteCall(Bot.Close);
await mainWindow.commandService.call(SharedConstants.Commands.Electron.UpdateFileMenu);
}
}
);
});
} else {
subMenu.push({
label: 'Close Tab',
enabled: false
});
}

const settingsStore = getSettingsStore();
const settingsState = settingsStore.getState();

Expand Down

0 comments on commit 0547bc7

Please sign in to comment.