fix: clamp notification dropdown to viewport, bump ui to 0.2.15
Apply viewport clamping to NotificationCenter dropdown positioning and bump @ciphera-net/ui to 0.2.15 which clamps AppLauncher and UserMenu dropdowns the same way.
This commit is contained in:
@@ -61,7 +61,12 @@ export default function NotificationCenter({ anchor = 'bottom', variant = 'defau
|
|||||||
const updatePosition = useCallback(() => {
|
const updatePosition = useCallback(() => {
|
||||||
if (anchor === 'right' && buttonRef.current) {
|
if (anchor === 'right' && buttonRef.current) {
|
||||||
const rect = buttonRef.current.getBoundingClientRect()
|
const rect = buttonRef.current.getBoundingClientRect()
|
||||||
setFixedPos({ left: rect.right + 8, top: rect.top })
|
let top = rect.top
|
||||||
|
if (panelRef.current) {
|
||||||
|
const maxTop = window.innerHeight - panelRef.current.offsetHeight - 8
|
||||||
|
top = Math.min(top, Math.max(8, maxTop))
|
||||||
|
}
|
||||||
|
setFixedPos({ left: rect.right + 8, top })
|
||||||
}
|
}
|
||||||
}, [anchor])
|
}, [anchor])
|
||||||
|
|
||||||
@@ -95,6 +100,7 @@ export default function NotificationCenter({ anchor = 'bottom', variant = 'defau
|
|||||||
if (open) {
|
if (open) {
|
||||||
fetchNotifications()
|
fetchNotifications()
|
||||||
updatePosition()
|
updatePosition()
|
||||||
|
requestAnimationFrame(() => updatePosition())
|
||||||
}
|
}
|
||||||
}, [open, updatePosition])
|
}, [open, updatePosition])
|
||||||
|
|
||||||
|
|||||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -8,7 +8,7 @@
|
|||||||
"name": "pulse-frontend",
|
"name": "pulse-frontend",
|
||||||
"version": "0.15.0-alpha",
|
"version": "0.15.0-alpha",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ciphera-net/ui": "^0.2.14",
|
"@ciphera-net/ui": "^0.2.15",
|
||||||
"@ducanh2912/next-pwa": "^10.2.9",
|
"@ducanh2912/next-pwa": "^10.2.9",
|
||||||
"@phosphor-icons/react": "^2.1.10",
|
"@phosphor-icons/react": "^2.1.10",
|
||||||
"@simplewebauthn/browser": "^13.2.2",
|
"@simplewebauthn/browser": "^13.2.2",
|
||||||
@@ -1670,9 +1670,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ciphera-net/ui": {
|
"node_modules/@ciphera-net/ui": {
|
||||||
"version": "0.2.14",
|
"version": "0.2.15",
|
||||||
"resolved": "https://npm.pkg.github.com/download/@ciphera-net/ui/0.2.14/6502f8587e7e841c507c670c212f801e047a85a9",
|
"resolved": "https://npm.pkg.github.com/download/@ciphera-net/ui/0.2.15/ec35ffe3be80cb5deca6a05bd2d36d636333a4a9",
|
||||||
"integrity": "sha512-Jb2tG4DNXEwYMLdyQg+BwBpUKcMtmsAnkrtbenhQEiIngRpwgS7YyjtJVa0aDMPkFD4uq6nVMLoSRTMNgxekMg==",
|
"integrity": "sha512-Y2snU21OFbcarVq6QbSkW/pbL3BL9SePf8dBzC36zUvDp5TuhIU7E/21ydVGxGH6Ye6wKw2G1Qsv3xsnsumyPA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@phosphor-icons/react": "^2.1.10",
|
"@phosphor-icons/react": "^2.1.10",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"test:watch": "vitest"
|
"test:watch": "vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ciphera-net/ui": "^0.2.14",
|
"@ciphera-net/ui": "^0.2.15",
|
||||||
"@ducanh2912/next-pwa": "^10.2.9",
|
"@ducanh2912/next-pwa": "^10.2.9",
|
||||||
"@phosphor-icons/react": "^2.1.10",
|
"@phosphor-icons/react": "^2.1.10",
|
||||||
"@simplewebauthn/browser": "^13.2.2",
|
"@simplewebauthn/browser": "^13.2.2",
|
||||||
|
|||||||
Reference in New Issue
Block a user