Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centre all notification popups #6271

Merged
merged 1 commit into from
Mar 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions app/scripts/lib/notification-manager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const extension = require('extensionizer')
const height = 620
const width = 360

const NOTIFICATION_HEIGHT = 620
const NOTIFICATION_WIDTH = 360

class NotificationManager {

Expand All @@ -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)
}
Expand Down