diff --git a/components/notifications/NotificationCenter.tsx b/components/notifications/NotificationCenter.tsx index bda781c..8c50045 100644 --- a/components/notifications/NotificationCenter.tsx +++ b/components/notifications/NotificationCenter.tsx @@ -61,7 +61,12 @@ export default function NotificationCenter({ anchor = 'bottom', variant = 'defau const updatePosition = useCallback(() => { if (anchor === 'right' && buttonRef.current) { 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]) @@ -95,6 +100,7 @@ export default function NotificationCenter({ anchor = 'bottom', variant = 'defau if (open) { fetchNotifications() updatePosition() + requestAnimationFrame(() => updatePosition()) } }, [open, updatePosition]) diff --git a/package-lock.json b/package-lock.json index 104a248..587ffc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "pulse-frontend", "version": "0.15.0-alpha", "dependencies": { - "@ciphera-net/ui": "^0.2.14", + "@ciphera-net/ui": "^0.2.15", "@ducanh2912/next-pwa": "^10.2.9", "@phosphor-icons/react": "^2.1.10", "@simplewebauthn/browser": "^13.2.2", @@ -1670,9 +1670,9 @@ } }, "node_modules/@ciphera-net/ui": { - "version": "0.2.14", - "resolved": "https://npm.pkg.github.com/download/@ciphera-net/ui/0.2.14/6502f8587e7e841c507c670c212f801e047a85a9", - "integrity": "sha512-Jb2tG4DNXEwYMLdyQg+BwBpUKcMtmsAnkrtbenhQEiIngRpwgS7YyjtJVa0aDMPkFD4uq6nVMLoSRTMNgxekMg==", + "version": "0.2.15", + "resolved": "https://npm.pkg.github.com/download/@ciphera-net/ui/0.2.15/ec35ffe3be80cb5deca6a05bd2d36d636333a4a9", + "integrity": "sha512-Y2snU21OFbcarVq6QbSkW/pbL3BL9SePf8dBzC36zUvDp5TuhIU7E/21ydVGxGH6Ye6wKw2G1Qsv3xsnsumyPA==", "dependencies": { "@phosphor-icons/react": "^2.1.10", "class-variance-authority": "^0.7.1", diff --git a/package.json b/package.json index 5f197de..c13b8aa 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "test:watch": "vitest" }, "dependencies": { - "@ciphera-net/ui": "^0.2.14", + "@ciphera-net/ui": "^0.2.15", "@ducanh2912/next-pwa": "^10.2.9", "@phosphor-icons/react": "^2.1.10", "@simplewebauthn/browser": "^13.2.2",