mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-23 03:31:56 +00:00
🔳 New About window added
This commit is contained in:
37
app/main/about.js
Normal file
37
app/main/about.js
Normal file
@@ -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
|
||||
};
|
@@ -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();
|
||||
});
|
||||
|
@@ -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);
|
@@ -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);
|
||||
};
|
||||
|
||||
};
|
27
app/renderer/about.html
Normal file
27
app/renderer/about.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="main.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="about">
|
||||
<center><img src="../resources/Icon.png"></center>
|
||||
<center><p class="detail"> Version : 0.0.1 </p>
|
||||
<center><p class="detail"> License : Apache </p>
|
||||
<center><p class="detail"> Maintainer : Zulip </p>
|
||||
<p class="left"><a class="bug" onclick="linkInBrowser()" href="#">Found bug?</a></p>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
function linkInBrowser(event) {
|
||||
|
||||
const shell = require('electron').shell;
|
||||
|
||||
const url = "https://github.com/zulip/zulip-electron/issues/new?body=Please describe your issue and steps to reproduce it."
|
||||
|
||||
shell.openExternal(url);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
28
app/renderer/main.css
Normal file
28
app/renderer/main.css
Normal file
@@ -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%;
|
||||
}
|
||||
|
@@ -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 .",
|
||||
|
Reference in New Issue
Block a user