-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3660a93
commit a3aaa19
Showing
23 changed files
with
338 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,6 +273,5 @@ export { | |
PostTranslationModal, | ||
ImageViewer, | ||
WalkthroughMarker, | ||
ProposalVoteRequest | ||
|
||
ProposalVoteRequest, | ||
}; |
88 changes: 42 additions & 46 deletions
88
src/components/postComments/children/botCommentsPreview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,59 @@ | ||
import React, { useRef } from 'react'; | ||
import { View, TouchableOpacity, Text } from 'react-native'; | ||
import EStyleSheet from 'react-native-extended-stylesheet'; | ||
import { CommentsModal, Icon, UserAvatar } from '../..'; | ||
import styles from '../styles/botCommentsPreview.styles'; | ||
import { useIntl } from 'react-intl'; | ||
import { useNavigation } from '@react-navigation/native'; | ||
import { CommentsModal, Icon, UserAvatar } from '../..'; | ||
import styles from '../styles/botCommentsPreview.styles'; | ||
import ROUTES from '../../../constants/routeNames'; | ||
|
||
interface BotCommentsProps { | ||
comments: any[]; | ||
comments: any[]; | ||
} | ||
|
||
export const BotCommentsPreview = ({ comments }: BotCommentsProps) => { | ||
const intl = useIntl(); | ||
const navigation = useNavigation(); | ||
|
||
const commentsModalRef = useRef<typeof CommentsModal>(); | ||
const intl = useIntl(); | ||
const navigation = useNavigation(); | ||
|
||
if (!comments?.length) { | ||
return null; | ||
} | ||
const commentsModalRef = useRef<typeof CommentsModal>(); | ||
|
||
const _onPress = () => { | ||
navigation.navigate({ | ||
name: ROUTES.MODALS.BOT_COMMENTS, | ||
params: { | ||
comments | ||
} | ||
}); | ||
} | ||
if (!comments?.length) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<View style={styles.labelWrapper}> | ||
<Text style={styles.label}> | ||
{intl.formatMessage({ id: 'comments.bot_comments' })} | ||
</Text> | ||
<Icon | ||
iconType="AntDesign" | ||
name="right" | ||
size={14} | ||
color={EStyleSheet.value('$primaryDarkText')} | ||
/> | ||
</View> | ||
<TouchableOpacity | ||
onPress={_onPress} | ||
> | ||
<View style={styles.botAvatarsWrapper}> | ||
{comments.map((comment) => { | ||
return ( | ||
<View style={styles.item}> | ||
<UserAvatar username={comment.author} noAction /> | ||
</View> | ||
); | ||
})} | ||
</View> | ||
</TouchableOpacity> | ||
const _onPress = () => { | ||
navigation.navigate({ | ||
name: ROUTES.MODALS.BOT_COMMENTS, | ||
params: { | ||
comments, | ||
}, | ||
}); | ||
}; | ||
|
||
<CommentsModal ref={commentsModalRef} /> | ||
return ( | ||
<View style={styles.container}> | ||
<View style={styles.labelWrapper}> | ||
<Text style={styles.label}>{intl.formatMessage({ id: 'comments.bot_comments' })}</Text> | ||
<Icon | ||
iconType="AntDesign" | ||
name="right" | ||
size={14} | ||
color={EStyleSheet.value('$primaryDarkText')} | ||
/> | ||
</View> | ||
<TouchableOpacity onPress={_onPress}> | ||
<View style={styles.botAvatarsWrapper}> | ||
{comments.map((comment) => { | ||
return ( | ||
<View style={styles.item}> | ||
<UserAvatar username={comment.author} noAction /> | ||
</View> | ||
); | ||
})} | ||
</View> | ||
); | ||
</TouchableOpacity> | ||
|
||
<CommentsModal ref={commentsModalRef} /> | ||
</View> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.