From 725369ae6cbc40442e5ad02041317f84f34a84e3 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 31 Aug 2023 18:05:13 +0500 Subject: [PATCH 1/2] relinked handle on user press --- .../comments/container/commentsContainer.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/comments/container/commentsContainer.tsx b/src/components/comments/container/commentsContainer.tsx index 01d6265d02..7f4c96d04f 100644 --- a/src/components/comments/container/commentsContainer.tsx +++ b/src/components/comments/container/commentsContainer.tsx @@ -9,7 +9,7 @@ import { useNavigation } from '@react-navigation/native'; import { getComments, deleteComment } from '../../../providers/hive/dhive'; // Services and Actions import { writeToClipboard } from '../../../utils/clipboard'; -import { toastNotification } from '../../../redux/actions/uiAction'; +import { showProfileModal, toastNotification } from '../../../redux/actions/uiAction'; // Middleware @@ -171,7 +171,7 @@ const CommentsContainer = ({ handleOnCommentsLoaded(); } }) - .catch(() => {}); + .catch(() => { }); } }; @@ -243,6 +243,14 @@ const CommentsContainer = ({ }); }; + + const _handleOnUserPress = (username) => { + if (username) { + dispatch(showProfileModal(username)) + } + + } + const _openReplyThread = (comment) => { postsCachePrimer.cachePost(comment); navigation.navigate({ @@ -298,6 +306,7 @@ const CommentsContainer = ({ handleDeleteComment={_handleDeleteComment} handleOnPressCommentMenu={_handleOnPressCommentMenu} handleOnOptionsPress={handleOnOptionsPress} + handleOnUserPress={_handleOnUserPress} isOwnProfile={isOwnProfile} isHideImage={isHideImage} handleOnVotersPress={_handleOnVotersPress} From d62f049068ecc16f8dcfab9f937347525deaf0cf Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 31 Aug 2023 18:37:53 +0500 Subject: [PATCH 2/2] added new wave length counter and limiter --- .../quickReplyModalContent.tsx | 56 +++++++++++++------ .../quickReplyModal/quickReplyModalStyles.ts | 6 +- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/src/components/quickReplyModal/quickReplyModalContent.tsx b/src/components/quickReplyModal/quickReplyModalContent.tsx index 470f074fff..344608d8fd 100644 --- a/src/components/quickReplyModal/quickReplyModalContent.tsx +++ b/src/components/quickReplyModal/quickReplyModalContent.tsx @@ -6,6 +6,7 @@ import React, { forwardRef, useCallback, Fragment, + useMemo, } from 'react'; import EStyleSheet from 'react-native-extended-stylesheet'; import { @@ -44,6 +45,8 @@ export interface QuickReplyModalContentProps { onClose: () => void; } +const MAX_BODY_LENGTH = 250; + export const QuickReplyModalContent = forwardRef( ({ mode, @@ -82,6 +85,11 @@ export const QuickReplyModalContent = forwardRef( ? `${currentAccount.name}/ecency.waves` //TODO: update author based on selected host : `${currentAccount.name}/${parentAuthor}/${parentPermlink}`; // different draftId for each user acount + + const bodyLengthExceeded = useMemo( + () => commentValue.length > MAX_BODY_LENGTH && mode === 'wave', + [commentValue, mode]); + useImperativeHandle(ref, () => ({ handleSheetClose() { _addQuickCommentIntoCache(); @@ -312,28 +320,40 @@ export const QuickReplyModalContent = forwardRef( } - const _renderExpandBtn = () => ( - - - {mode !== 'wave' && ( + const _renderExpandBtn = () => { + + const _lengthTextStyle = { + ...styles.toolbarSpacer, + color: EStyleSheet.value(bodyLengthExceeded ? '$primaryRed' : '$iconColor') + } + + return ( + - )} + {mode !== 'wave' ? ( + + ) : ( + + {`${commentValue.length}/${MAX_BODY_LENGTH}`} + + )} - - ); + + ); + } @@ -354,7 +374,7 @@ export const QuickReplyModalContent = forwardRef( text={intl.formatMessage({ id: _titleId, })} - isDisable={isUploading} + isDisable={isUploading || bodyLengthExceeded} isLoading={postSubmitter.isSending} /> diff --git a/src/components/quickReplyModal/quickReplyModalStyles.ts b/src/components/quickReplyModal/quickReplyModalStyles.ts index 3c73636290..cca49c166e 100644 --- a/src/components/quickReplyModal/quickReplyModalStyles.ts +++ b/src/components/quickReplyModal/quickReplyModalStyles.ts @@ -121,8 +121,10 @@ export default EStyleSheet.create({ } as ViewStyle, toolbarContainer:{ flexDirection:'row', + alignItems:'center' } as ViewStyle, - expandIcon:{ + toolbarSpacer:{ marginLeft:8 - } as ViewStyle + } as ViewStyle, + });