From d9279e42ccf38d9839b5e293f94846d6dd31aa54 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Thu, 14 Jul 2022 11:56:40 -0600 Subject: [PATCH] Don't collapse/expand notifs with ctrl/cmd click --- web/pages/notifications.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/web/pages/notifications.tsx b/web/pages/notifications.tsx index 250fae37..f86c4fef 100644 --- a/web/pages/notifications.tsx +++ b/web/pages/notifications.tsx @@ -157,6 +157,11 @@ function IncomeNotificationGroupItem(props: { notifications.some((n) => !n.isSeen) ) + const onClickHandler = (event: React.MouseEvent) => { + if (event.ctrlKey || event.metaKey) return + setExpanded(!expanded) + } + useEffect(() => { setNotificationsAsSeen(notifications) }, [notifications]) @@ -231,7 +236,7 @@ function IncomeNotificationGroupItem(props: { !expanded ? 'hover:bg-gray-100' : '', highlighted && !expanded ? 'bg-indigo-200 hover:bg-indigo-100' : '' )} - onClick={() => setExpanded(!expanded)} + onClick={onClickHandler} > {expanded && (
setExpanded(!expanded)} + onClick={onClickHandler} >
@@ -416,6 +421,12 @@ function NotificationGroupItem(props: { const [highlighted, setHighlighted] = useState( notifications.some((n) => !n.isSeen) ) + + const onClickHandler = (event: React.MouseEvent) => { + if (event.ctrlKey || event.metaKey) return + setExpanded(!expanded) + } + useEffect(() => { setNotificationsAsSeen(notifications) }, [notifications]) @@ -432,7 +443,7 @@ function NotificationGroupItem(props: { !expanded ? 'hover:bg-gray-100' : '', highlighted && !expanded ? 'bg-indigo-200 hover:bg-indigo-100' : '' )} - onClick={() => setExpanded(!expanded)} + onClick={onClickHandler} > {expanded && (