aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2019-03-12 23:36:05 +0800
committerGitHub <noreply@github.com>2019-03-12 23:36:05 +0800
commit10691d7d33636eefe40acc694d56cf19ffa7e4ab (patch)
treef6b4408ddd0b7cce6761036c05b6b6e27f05a8a1
parent4812fdb7b9918118e2d0305cf2d7a535185d0a4a (diff)
parent5bf8a36a8785332dc3287badab4050d028eb08af (diff)
downloadtangerine-wallet-browser-10691d7d33636eefe40acc694d56cf19ffa7e4ab.tar
tangerine-wallet-browser-10691d7d33636eefe40acc694d56cf19ffa7e4ab.tar.gz
tangerine-wallet-browser-10691d7d33636eefe40acc694d56cf19ffa7e4ab.tar.bz2
tangerine-wallet-browser-10691d7d33636eefe40acc694d56cf19ffa7e4ab.tar.lz
tangerine-wallet-browser-10691d7d33636eefe40acc694d56cf19ffa7e4ab.tar.xz
tangerine-wallet-browser-10691d7d33636eefe40acc694d56cf19ffa7e4ab.tar.zst
tangerine-wallet-browser-10691d7d33636eefe40acc694d56cf19ffa7e4ab.zip
Merge pull request #6271 from whymarrh/centre-notificatons
Centre all notification popups
-rw-r--r--app/scripts/lib/notification-manager.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/app/scripts/lib/notification-manager.js b/app/scripts/lib/notification-manager.js
index 969a9459a..a97e89ffc 100644
--- a/app/scripts/lib/notification-manager.js
+++ b/app/scripts/lib/notification-manager.js
@@ -1,7 +1,6 @@
const extension = require('extensionizer')
-const height = 620
-const width = 360
-
+const NOTIFICATION_HEIGHT = 620
+const NOTIFICATION_WIDTH = 360
class NotificationManager {
@@ -26,13 +25,19 @@ class NotificationManager {
// bring focus to existing chrome popup
extension.windows.update(popup.id, { focused: true })
} else {
+ const screenWidth = window.screen.width
+ const screenHeight = window.screen.height
+ const notificationTop = (screenHeight / 2) - (NOTIFICATION_HEIGHT / 2)
+ const notificationLeft = (screenWidth / 2) - (NOTIFICATION_WIDTH / 2)
const cb = (currentPopup) => { this._popupId = currentPopup.id }
// create new notification popup
const creation = extension.windows.create({
url: 'notification.html',
type: 'popup',
- width,
- height,
+ width: NOTIFICATION_WIDTH,
+ height: NOTIFICATION_HEIGHT,
+ top: Math.max(notificationTop, 0),
+ left: Math.max(notificationLeft, 0),
}, cb)
creation && creation.then && creation.then(cb)
}