Skip to content

Commit bb444ce

Browse files
authored
Merge pull request #2931 from ecency/nt/bot-filtered-waves
Nt/bot filtered waves
2 parents 915750a + a3aaa19 commit bb444ce

File tree

23 files changed

+357
-365
lines changed

23 files changed

+357
-365
lines changed

src/components/comment/view/commentView.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ const CommentView = ({
6363
const _currentUsername = currentAccountUsername || currentAccount?.username;
6464

6565
const _showSubCommentsToggle = async (force = false) => {
66-
if (!!handleOnToggleReplies && !!comment.commentKey && ((replies && replies.length > 0) || force)) {
66+
if (
67+
!!handleOnToggleReplies &&
68+
!!comment.commentKey &&
69+
((replies && replies.length > 0) || force)
70+
) {
6771
setIsOpeningReplies(true);
6872
await delay(10); // hack to rendering inidcator first before start loading comments
6973
handleOnToggleReplies(comment.commentKey);

src/components/commentsModal/container/commentsModal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import Comments from '../../comments';
77
import styles from '../styles/commentsModal.styles';
88

99
/**
10-
* NOTE: this comments modal is in draft stage, right now rendering of
11-
* content works great but actions do not respond as expected since most
12-
* of action reply on modals and action sheets which causes a conflict with
10+
* NOTE: this comments modal is in draft stage, right now rendering of
11+
* content works great but actions do not respond as expected since most
12+
* of action reply on modals and action sheets which causes a conflict with
1313
* rendering comments in existing modal, similarly some actions require navigation
1414
* to different screen while comments modal is still visible on screen.
1515
*/

src/components/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,5 @@ export {
273273
PostTranslationModal,
274274
ImageViewer,
275275
WalkthroughMarker,
276-
ProposalVoteRequest
277-
276+
ProposalVoteRequest,
278277
};
Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,59 @@
11
import React, { useRef } from 'react';
22
import { View, TouchableOpacity, Text } from 'react-native';
33
import EStyleSheet from 'react-native-extended-stylesheet';
4-
import { CommentsModal, Icon, UserAvatar } from '../..';
5-
import styles from '../styles/botCommentsPreview.styles';
64
import { useIntl } from 'react-intl';
75
import { useNavigation } from '@react-navigation/native';
6+
import { CommentsModal, Icon, UserAvatar } from '../..';
7+
import styles from '../styles/botCommentsPreview.styles';
88
import ROUTES from '../../../constants/routeNames';
99

1010
interface BotCommentsProps {
11-
comments: any[];
11+
comments: any[];
1212
}
1313

1414
export const BotCommentsPreview = ({ comments }: BotCommentsProps) => {
15-
const intl = useIntl();
16-
const navigation = useNavigation();
17-
18-
const commentsModalRef = useRef<typeof CommentsModal>();
15+
const intl = useIntl();
16+
const navigation = useNavigation();
1917

20-
if (!comments?.length) {
21-
return null;
22-
}
18+
const commentsModalRef = useRef<typeof CommentsModal>();
2319

24-
const _onPress = () => {
25-
navigation.navigate({
26-
name: ROUTES.MODALS.BOT_COMMENTS,
27-
params: {
28-
comments
29-
}
30-
});
31-
}
20+
if (!comments?.length) {
21+
return null;
22+
}
3223

33-
return (
34-
<View style={styles.container}>
35-
<View style={styles.labelWrapper}>
36-
<Text style={styles.label}>
37-
{intl.formatMessage({ id: 'comments.bot_comments' })}
38-
</Text>
39-
<Icon
40-
iconType="AntDesign"
41-
name="right"
42-
size={14}
43-
color={EStyleSheet.value('$primaryDarkText')}
44-
/>
45-
</View>
46-
<TouchableOpacity
47-
onPress={_onPress}
48-
>
49-
<View style={styles.botAvatarsWrapper}>
50-
{comments.map((comment) => {
51-
return (
52-
<View style={styles.item}>
53-
<UserAvatar username={comment.author} noAction />
54-
</View>
55-
);
56-
})}
57-
</View>
58-
</TouchableOpacity>
24+
const _onPress = () => {
25+
navigation.navigate({
26+
name: ROUTES.MODALS.BOT_COMMENTS,
27+
params: {
28+
comments,
29+
},
30+
});
31+
};
5932

60-
<CommentsModal ref={commentsModalRef} />
33+
return (
34+
<View style={styles.container}>
35+
<View style={styles.labelWrapper}>
36+
<Text style={styles.label}>{intl.formatMessage({ id: 'comments.bot_comments' })}</Text>
37+
<Icon
38+
iconType="AntDesign"
39+
name="right"
40+
size={14}
41+
color={EStyleSheet.value('$primaryDarkText')}
42+
/>
43+
</View>
44+
<TouchableOpacity onPress={_onPress}>
45+
<View style={styles.botAvatarsWrapper}>
46+
{comments.map((comment) => {
47+
return (
48+
<View style={styles.item}>
49+
<UserAvatar username={comment.author} noAction />
50+
</View>
51+
);
52+
})}
6153
</View>
62-
);
54+
</TouchableOpacity>
55+
56+
<CommentsModal ref={commentsModalRef} />
57+
</View>
58+
);
6359
};

src/components/postsList/container/postsListContainer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ const postsListContainer = (
208208
}
209209
};
210210

211-
const _renderSeparator = () => <Separator style={styles.separator} />
211+
const _renderSeparator = () => <Separator style={styles.separator} />;
212212

213213
const _renderItem = ({ item }: { item: any }) => {
214214
// get image height from cache if available
@@ -231,7 +231,6 @@ const postsListContainer = (
231231
}
232232
/>
233233
);
234-
235234
};
236235

237236
return (

src/components/postsList/view/postsListStyles.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export default EStyleSheet.create({
1111
placeholderWrapper: {
1212
flex: 1,
1313
},
14-
separator:{
15-
backgroundColor:'$primaryLightBackground',
16-
marginBottom:8
17-
}
14+
separator: {
15+
backgroundColor: '$primaryLightBackground',
16+
marginBottom: 8,
17+
},
1818
});

0 commit comments

Comments
 (0)