mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-03 05:23:17 +00:00
Move About page into WebView.
This commit is contained in:
@@ -9,7 +9,7 @@ const BrowserWindow = electron.BrowserWindow;
|
||||
const shell = electron.shell;
|
||||
const appName = app.getName();
|
||||
|
||||
const {about} = require('./windowmanager');
|
||||
// const {about} = require('./windowmanager');
|
||||
|
||||
function sendAction(action) {
|
||||
const win = BrowserWindow.getAllWindows()[0];
|
||||
@@ -135,8 +135,10 @@ const darwinTpl = [
|
||||
submenu: [
|
||||
{
|
||||
label: 'Zulip desktop',
|
||||
click() {
|
||||
about();
|
||||
click(item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
sendAction('open-about');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ class ServerManagerView {
|
||||
this.$content = document.getElementById('content');
|
||||
|
||||
this.settingsTabIndex = -1;
|
||||
this.aboutTabIndex = -1;
|
||||
this.activeTabIndex = -1;
|
||||
this.webviews = [];
|
||||
this.tabs = [];
|
||||
@@ -104,35 +105,35 @@ class ServerManagerView {
|
||||
}
|
||||
|
||||
openAbout() {
|
||||
if (this.settingsTabIndex !== -1) {
|
||||
this.activateTab(this.settingsTabIndex);
|
||||
if (this.aboutTabIndex !== -1) {
|
||||
this.activateTab(this.aboutTabIndex);
|
||||
return;
|
||||
}
|
||||
const url = 'file://' + __dirname + '/about.html';
|
||||
|
||||
this.settingsTabIndex = this.webviews.length;
|
||||
this.aboutTabIndex = this.webviews.length;
|
||||
|
||||
this.tabs.push(new Tab({
|
||||
url,
|
||||
name: 'Settings',
|
||||
name: 'About',
|
||||
type: Tab.SETTINGS_TAB,
|
||||
$root: this.$tabsContainer,
|
||||
onClick: this.activateTab.bind(this, this.settingsTabIndex)
|
||||
onClick: this.activateTab.bind(this, this.aboutTabIndex)
|
||||
}));
|
||||
|
||||
this.webviews.push(new WebView({
|
||||
$root: this.$content,
|
||||
index: this.settingsTabIndex,
|
||||
index: this.aboutTabIndex,
|
||||
url,
|
||||
name: 'Settings',
|
||||
name: 'About',
|
||||
isActive: () => {
|
||||
return this.settingsTabIndex === this.activeTabIndex;
|
||||
return this.activeTabIndex === this.aboutTabIndex;
|
||||
},
|
||||
onTitleChange: this.updateBadge.bind(this),
|
||||
nodeIntegration: true
|
||||
}));
|
||||
|
||||
this.activateTab(this.settingsTabIndex);
|
||||
this.activateTab(this.aboutTabIndex);
|
||||
}
|
||||
|
||||
activateTab(index) {
|
||||
@@ -191,6 +192,7 @@ class ServerManagerView {
|
||||
}
|
||||
|
||||
ipcRenderer.on('open-settings', this.openSettings.bind(this));
|
||||
ipcRenderer.on('open-about', this.openAbout.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ const createTray = function () {
|
||||
const contextMenu = Menu.buildFromTemplate([{
|
||||
label: 'About',
|
||||
click() {
|
||||
ipcRenderer.send('trayabout');
|
||||
sendAction('open-about');
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>Zulip - Settings</title>
|
||||
<link rel="stylesheet" href="../css/preference.css" type="text/css" media="screen">
|
||||
<link rel="stylesheet" href="css/preference.css" type="text/css" media="screen">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
Reference in New Issue
Block a user