mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Centre all notification popups
This commit is contained in:
parent
cf3e0c2d53
commit
5bf8a36a87
@ -1,7 +1,6 @@
|
|||||||
const extension = require('extensionizer')
|
const extension = require('extensionizer')
|
||||||
const height = 620
|
const NOTIFICATION_HEIGHT = 620
|
||||||
const width = 360
|
const NOTIFICATION_WIDTH = 360
|
||||||
|
|
||||||
|
|
||||||
class NotificationManager {
|
class NotificationManager {
|
||||||
|
|
||||||
@ -26,13 +25,19 @@ class NotificationManager {
|
|||||||
// bring focus to existing chrome popup
|
// bring focus to existing chrome popup
|
||||||
extension.windows.update(popup.id, { focused: true })
|
extension.windows.update(popup.id, { focused: true })
|
||||||
} else {
|
} 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 }
|
const cb = (currentPopup) => { this._popupId = currentPopup.id }
|
||||||
// create new notification popup
|
// create new notification popup
|
||||||
const creation = extension.windows.create({
|
const creation = extension.windows.create({
|
||||||
url: 'notification.html',
|
url: 'notification.html',
|
||||||
type: 'popup',
|
type: 'popup',
|
||||||
width,
|
width: NOTIFICATION_WIDTH,
|
||||||
height,
|
height: NOTIFICATION_HEIGHT,
|
||||||
|
top: Math.max(notificationTop, 0),
|
||||||
|
left: Math.max(notificationLeft, 0),
|
||||||
}, cb)
|
}, cb)
|
||||||
creation && creation.then && creation.then(cb)
|
creation && creation.then && creation.then(cb)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user