From cc1431da605eba1012059345eb3c24469a652662 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Wed, 13 Jul 2022 09:12:43 -0600 Subject: [PATCH] Disable enter submit on mobile on group chat --- web/components/feed/feed-comments.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/components/feed/feed-comments.tsx b/web/components/feed/feed-comments.tsx index 198e9c36..a9f30ee5 100644 --- a/web/components/feed/feed-comments.tsx +++ b/web/components/feed/feed-comments.tsx @@ -32,6 +32,7 @@ import { useEvent } from 'web/hooks/use-event' import { Tipper } from '../tipper' import { CommentTipMap, CommentTips } from 'web/hooks/use-tip-txns' import useMediaQuery from 'react-query/types/devtools/useMediaQuery' +import { useWindowSize } from 'web/hooks/use-window-size' export function FeedCommentThread(props: { contract: Contract @@ -487,7 +488,7 @@ export function CommentInputTextArea(props: { replyToUsername, enterToSubmitOnDesktop, } = props - const isMobile = innerWidth < 768 + const { width } = useWindowSize() const memoizedSetComment = useEvent(setComment) useEffect(() => { if (!replyToUsername || !user || replyToUsername === user.username) return @@ -520,7 +521,8 @@ export function CommentInputTextArea(props: { (enterToSubmitOnDesktop && e.key === 'Enter' && !e.shiftKey && - !isMobile) || + width && + width > 768) || (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) ) { e.preventDefault()