-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[IMPROVEMENT] Threads layout tweaks #2686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e6df05f
improvement: Thread Details
djorkaeffalexandre 2051ad9
fix: re-render Thread Messages Item
djorkaeffalexandre 6de195b
fix: update snapshots
djorkaeffalexandre 7f6362d
improve: thread details component
djorkaeffalexandre cbee4d0
fix: cast replies length
djorkaeffalexandre 0602f9f
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.R…
djorkaeffalexandre a0168b7
improvement: format date of threads
djorkaeffalexandre a5c0fa4
chore: merge develop
djorkaeffalexandre f072c09
improvement: thread details styles
djorkaeffalexandre c467cd8
fix: wrap text
djorkaeffalexandre c7d9d2c
tests: update snapshot
djorkaeffalexandre a668268
improvement: use same date format for all dates
djorkaeffalexandre 16f9d91
Merge branch 'develop' into improvement.threads-layout
diegolmello 4488559
Icon size 24
diegolmello 8f40801
Remove date
diegolmello 18d2cfa
Remove prop drill
diegolmello bb3eeac
Badge position
diegolmello 0adaef1
Badge container tweak
diegolmello 63712d2
Fix inline style
diegolmello b475fcd
Move ThreadDetails to containers
diegolmello 395a99d
Update stories
diegolmello 2e9521f
Fix lint
diegolmello 62b6660
Remove wrong prop
diegolmello File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7,418 changes: 4,410 additions & 3,008 deletions
7,418
__tests__/__snapshots__/Storyshots.test.js.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| import React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import { View, Text, StyleSheet } from 'react-native'; | ||
| import Touchable from 'react-native-platform-touchable'; | ||
|
|
||
| import { CustomIcon } from '../../lib/Icons'; | ||
| import { themes } from '../../constants/colors'; | ||
| import { formatDate } from '../../utils/room'; | ||
| import sharedStyles from '../Styles'; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| container: { | ||
| flex: 1, | ||
| width: '100%', | ||
| flexDirection: 'row', | ||
| alignItems: 'center' | ||
| }, | ||
| detailsContainer: { | ||
| flex: 1, | ||
| marginRight: 48, | ||
| flexDirection: 'row' | ||
| }, | ||
| detailContainer: { | ||
| flexDirection: 'row', | ||
| alignItems: 'center', | ||
| marginRight: 8, | ||
| maxWidth: '32%' | ||
| }, | ||
| timeDetailContainer: { | ||
| flex: 1, | ||
| maxWidth: '50%' | ||
| }, | ||
| detailText: { | ||
| fontSize: 10, | ||
| marginLeft: 2, | ||
| ...sharedStyles.textSemibold | ||
| }, | ||
| badgeContainer: { | ||
| right: 0, | ||
| position: 'absolute', | ||
| flexDirection: 'row', | ||
| alignItems: 'center' | ||
| }, | ||
| badge: { | ||
| width: 8, | ||
| height: 8, | ||
| borderRadius: 4, | ||
| marginRight: 8 | ||
| } | ||
| }); | ||
|
|
||
| const ThreadDetails = ({ | ||
| item, | ||
| user, | ||
| badgeColor, | ||
| toggleFollowThread, | ||
| style, | ||
| theme | ||
| }) => { | ||
| let tlm; | ||
| if (item?.tlm) { | ||
| tlm = formatDate(item.tlm); | ||
| } | ||
|
|
||
| let { tcount } = item; | ||
| if (tcount >= 1000) { | ||
| tcount = '+999'; | ||
| } else if (tcount >= 100) { | ||
| tcount = '+99'; | ||
| } | ||
|
|
||
| let replies = item?.replies?.length ?? 0; | ||
| if (replies >= 1000) { | ||
| replies = '+999'; | ||
| } else if (replies >= 100) { | ||
| replies = '+99'; | ||
| } | ||
|
|
||
| const isFollowing = item.replies?.find(u => u === user?.id); | ||
|
|
||
| return ( | ||
| <View style={[styles.container, style]}> | ||
| <View style={styles.detailsContainer}> | ||
| <View style={styles.detailContainer}> | ||
| <CustomIcon name='threads' size={20} color={themes[theme].auxiliaryText} /> | ||
| <Text style={[styles.detailText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>{tcount}</Text> | ||
| </View> | ||
|
|
||
| <View style={styles.detailContainer}> | ||
| <CustomIcon name='user' size={20} color={themes[theme].auxiliaryText} /> | ||
| <Text style={[styles.detailText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>{replies}</Text> | ||
| </View> | ||
|
|
||
| <View style={[styles.detailContainer, styles.timeDetailContainer]}> | ||
| <CustomIcon name='clock' size={20} color={themes[theme].auxiliaryText} /> | ||
| <Text style={[styles.detailText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>{tlm}</Text> | ||
| </View> | ||
| </View> | ||
|
|
||
| <Touchable style={styles.badgeContainer} onPress={() => toggleFollowThread?.(isFollowing, item.id)}> | ||
| <> | ||
| {badgeColor ? <View style={[styles.badge, { backgroundColor: badgeColor }]} /> : null } | ||
| <CustomIcon | ||
| size={24} | ||
| name={isFollowing ? 'notification' : 'notification-disabled'} | ||
| color={themes[theme].auxiliaryTintColor} | ||
| /> | ||
| </> | ||
| </Touchable> | ||
| </View> | ||
| ); | ||
| }; | ||
| ThreadDetails.propTypes = { | ||
| item: PropTypes.object, | ||
| user: PropTypes.object, | ||
| badgeColor: PropTypes.string, | ||
| toggleFollowThread: PropTypes.func, | ||
| style: PropTypes.object, | ||
| theme: PropTypes.string | ||
| }; | ||
|
|
||
| export default ThreadDetails; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.