diff --git a/app/main/about.js b/app/main/about.js new file mode 100644 index 00000000..9113c245 --- /dev/null +++ b/app/main/about.js @@ -0,0 +1,37 @@ +'use strict'; +const electron = require('electron'); +const path = require('path'); + + +let aboutWindow; + +function onClosed() { + aboutWindow = null; +} + +function createAboutWindow() { + const aboutwin = new electron.BrowserWindow({ + width: 500, + height: 500, + title: 'About Zulip Desktop', + show: false, + center: true, + fullscreen: false, + fullscreenable: false, + resizable: false + }) + const aboutURL = 'file://' + path.join(__dirname, '../renderer', 'about.html'); + aboutwin.loadURL(aboutURL); + aboutwin.on('closed', onClosed); + + // stop page to update it's title + aboutwin.on('page-title-updated', (e) => { + e.preventDefault(); + }); + + return aboutwin; +} + +exports = module.exports = { + createAboutWindow, onClosed +}; \ No newline at end of file diff --git a/app/index.js b/app/main/index.js similarity index 90% rename from app/index.js rename to app/main/index.js index c0ae5f6b..1f3fe6d6 100644 --- a/app/index.js +++ b/app/main/index.js @@ -5,6 +5,7 @@ const {app, shell} = require('electron'); const tray = require('./tray'); const link = require ('./link_helper'); + const {linkIsInternal} = link; // adds debug features like hotkeys for triggering dev tools and reload @@ -28,7 +29,7 @@ function createMainWindow() { title: 'Zulip', width: 1000, height: 600, - icon: process.platform === 'linux' && path.join(__dirname, 'resources/Icon.png'), + icon: process.platform === 'linux' && path.join(__dirname, '../resources/Icon.png'), minWidth: 800, minHeight: 600 }); @@ -36,9 +37,9 @@ function createMainWindow() { win.loadURL(targetUrl); win.on('closed', onClosed); win.setTitle('Zulip'); - // This will stop page to update it's title - - win.on('page-title-updated',(e) => { + + // stop page to update it's title + win.on('page-title-updated', (e) => { e.preventDefault(); }); diff --git a/app/link_helper.js b/app/main/link_helper.js similarity index 86% rename from app/link_helper.js rename to app/main/link_helper.js index a8da4a83..6cadd92e 100644 --- a/app/link_helper.js +++ b/app/main/link_helper.js @@ -1,6 +1,6 @@ const wurl = require('wurl'); -// Check the link if it's inetrnal +// Check link if it's internal/external function linkIsInternal(currentUrl, newUrl) { var currentDomain = wurl('domain', currentUrl); var newDomain = wurl('domain', newUrl); diff --git a/app/tray.js b/app/main/tray.js similarity index 71% rename from app/tray.js rename to app/main/tray.js index 663c9629..bd2d5e0f 100644 --- a/app/tray.js +++ b/app/main/tray.js @@ -1,16 +1,20 @@ 'use strict'; const path = require('path'); const electron = require('electron'); -const {app, shell} = require('electron'); +const app = require('electron').app; +const {shell} = require('electron'); +const about = require ('./about'); +const { createAboutWindow, onClosed } = about; let tray = null; +let aboutWindow; exports.create = win => { if (process.platform === 'darwin' || tray) { return; } - const iconPath = path.join(__dirname, 'resources', 'Icon.png'); + const iconPath = path.join(__dirname, '../resources', 'Icon.png'); const toggleWin = () => { if (win.isVisible()) { @@ -24,11 +28,16 @@ exports.create = win => { win.reload(); }; + const About = () => { + aboutWindow = createAboutWindow(); + aboutWindow.show(); + }; + const contextMenu = electron.Menu.buildFromTemplate([ { label: 'About', click() { - shell.openExternal('https://github.com/akashnimare/zulip-desktop'); + About(); } }, { @@ -64,5 +73,4 @@ exports.create = win => { tray.setToolTip(`${app.getName()}`); tray.setContextMenu(contextMenu); tray.on('click', toggleWin); -}; - +}; \ No newline at end of file diff --git a/app/renderer/about.html b/app/renderer/about.html new file mode 100644 index 00000000..13617885 --- /dev/null +++ b/app/renderer/about.html @@ -0,0 +1,27 @@ + + + + + + + +
+
+

Version : 0.0.1

+

License : Apache

+

Maintainer : Zulip

+

Found bug?

+
+ + + \ No newline at end of file diff --git a/app/renderer/main.css b/app/renderer/main.css new file mode 100644 index 00000000..1f7c2ec5 --- /dev/null +++ b/app/renderer/main.css @@ -0,0 +1,28 @@ +body { + background: #6BB6C7; +} + +.about { + margin-top: 50px; +} + +.left { + position: absolute; + top:89%; + left:76%; +} + +.about p { + font-size: 20px; + color: rgba(0, 0, 0, 0.62); +} + +.about img { + width:160px; +} + +.detail { + text-align: left; + margin-left: 35%; +} + diff --git a/package.json b/package.json index 61bea6a1..54c4deda 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "bugs": { "url": "https://github.com/zulip/zulip-electron/issues" }, - "main": "app/index.js", + "main": "app/main/index.js", "scripts": { "test": "xo", "start": "electron .",