1
0
Fork 0
mirror of https://github.com/cheeaun/phanpy.git synced 2025-04-02 06:33:47 +03:00

Disable context menu inside notifications popover

Popovers over popovers ain't easy
This commit is contained in:
Lim Chee Aun 2023-12-16 14:10:33 +08:00
parent 86a362c619
commit 4c7c518d4d
2 changed files with 25 additions and 15 deletions
src

View file

@ -67,7 +67,12 @@ const contentText = {
const AVATARS_LIMIT = 50; const AVATARS_LIMIT = 50;
function Notification({ notification, instance, isStatic }) { function Notification({
notification,
instance,
isStatic,
disableContextMenu,
}) {
const { id, status, account, report, _accounts, _statuses } = notification; const { id, status, account, report, _accounts, _statuses } = notification;
let { type } = notification; let { type } = notification;
@ -300,7 +305,9 @@ function Notification({ notification, instance, isStatic }) {
? `/${instance}/s/${actualStatusID}` ? `/${instance}/s/${actualStatusID}`
: `/s/${actualStatusID}` : `/s/${actualStatusID}`
} }
onContextMenu={(e) => { onContextMenu={
!disableContextMenu
? (e) => {
const post = e.target.querySelector('.status'); const post = e.target.querySelector('.status');
if (post) { if (post) {
// Fire a custom event to open the context menu // Fire a custom event to open the context menu
@ -313,7 +320,9 @@ function Notification({ notification, instance, isStatic }) {
}), }),
); );
} }
}} }
: undefined
}
> >
{isStatic ? ( {isStatic ? (
<Status status={actualStatus} size="s" /> <Status status={actualStatus} size="s" />

View file

@ -179,6 +179,7 @@ function NotificationsMenu({ anchorRef, state, onClose }) {
key={notification.id} key={notification.id}
instance={instance} instance={instance}
notification={notification} notification={notification}
disableContextMenu
/> />
))} ))}
</> </>