-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[web/desktop] feat: tooltip reaction senders #15671
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
luacmartins
merged 21 commits into
Expensify:main
from
margelo:hanno/feat-tolltip-reaction-senders
Mar 14, 2023
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
02eca70
Merge branch 'hanno/change-tooltip-accept-generic-content' of github.…
hannojg 9dd9e31
implementation
hannojg d736530
jsdoc comments
hannojg 55b852f
Merge branch 'main' of github.com:margelo/expensify-app-fork into han…
hannojg 06d798b
Merge branch 'hanno/feat-add-remove-reactions' of github.com:margelo/…
hannojg 705dd64
fix reactioneers names not showing up
hannojg 3a3682a
Merge branch 'main' of github.com:margelo/expensify-app-fork into han…
hannojg 7642ae9
fix emoji preview
hannojg 4e4bc97
Merge branch 'main' of github.com:margelo/expensify-app-fork into han…
hannojg 135d106
change to PersonalDetailsUtils with correct implementation
hannojg e28f7bf
Update src/components/Reactions/ReportActionItemReactions.js
hannojg 79300e1
chain
hannojg 76d6187
Merge branch 'main' of github.com:margelo/expensify-app-fork into han…
hannojg f58a89c
add null handling
hannojg e207e9e
display user's display name as "you"
hannojg af656ec
fix flickering
hannojg ae248ef
Update src/libs/PersonalDetailsUtils.js
hannojg 2b49362
Update src/libs/PersonalDetailsUtils.js
hannojg 511c2f7
Update src/components/Reactions/ReactionTooltipContent.js
hannojg 0b8eb80
Merge branch 'main' of github.com:margelo/expensify-app-fork into han…
hannojg 03d4169
only current account id needs to get stringified
hannojg 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
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,77 @@ | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import PropTypes from 'prop-types'; | ||
| import _ from 'underscore'; | ||
| import styles from '../../styles/styles'; | ||
| import {withPersonalDetails} from '../OnyxProvider'; | ||
| import * as PersonalDetailsUtils from '../../libs/PersonalDetailsUtils'; | ||
| import Text from '../Text'; | ||
| import withCurrentUserPersonalDetails, { | ||
| withCurrentUserPersonalDetailsPropTypes, | ||
| } from '../withCurrentUserPersonalDetails'; | ||
| import compose from '../../libs/compose'; | ||
| import withLocalize from '../withLocalize'; | ||
|
|
||
| const propTypes = { | ||
| /** | ||
| * A list of emoji codes to display in the tooltip. | ||
| */ | ||
| emojiCodes: PropTypes.arrayOf(PropTypes.string).isRequired, | ||
|
|
||
| /** | ||
| * The name of the emoji to display in the tooltip. | ||
| */ | ||
| emojiName: PropTypes.string.isRequired, | ||
|
|
||
| /** | ||
| * A list of account IDs to display in the tooltip. | ||
| */ | ||
| accountIDs: PropTypes.arrayOf(PropTypes.string).isRequired, | ||
|
|
||
| ...withCurrentUserPersonalDetailsPropTypes, | ||
| }; | ||
|
|
||
| const ReactionTooltipContent = (props) => { | ||
| const users = PersonalDetailsUtils.getPersonalDetailsByIDs(props.accountIDs, true); | ||
| const namesString = _.filter(_.map(users, user => user && user.displayName), n => n).join(', '); | ||
|
|
||
| return ( | ||
| <View style={[styles.alignItemsCenter, styles.ph2]}> | ||
| <View style={styles.flexRow}> | ||
| {_.map(props.emojiCodes, emojiCode => ( | ||
| <Text | ||
| key={emojiCode} | ||
| style={styles.reactionEmojiTitle} | ||
| > | ||
| {emojiCode} | ||
| </Text> | ||
| ))} | ||
| </View> | ||
|
|
||
| <Text style={[ | ||
| styles.mt1, | ||
| styles.textMicroBold, | ||
| styles.textReactionSenders, | ||
| ]} | ||
| > | ||
| {namesString} | ||
| </Text> | ||
|
|
||
| <Text style={[ | ||
| styles.textMicro, | ||
| styles.fontColorReactionLabel, | ||
| ]} | ||
| > | ||
| {`reacted with :${props.emojiName}:`} | ||
| </Text> | ||
| </View> | ||
| ); | ||
| }; | ||
|
|
||
| ReactionTooltipContent.propTypes = propTypes; | ||
| ReactionTooltipContent.defaultProps = withCurrentUserPersonalDetails; | ||
| ReactionTooltipContent.displayName = 'ReactionTooltipContent'; | ||
| export default React.memo(compose( | ||
| withPersonalDetails(), | ||
| withLocalize, | ||
| )(ReactionTooltipContent)); | ||
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,43 @@ | ||
| import Onyx from 'react-native-onyx'; | ||
| import _ from 'underscore'; | ||
| import ONYXKEYS from '../ONYXKEYS'; | ||
| import * as Report from './actions/Report'; | ||
| import * as Localize from './Localize'; | ||
|
|
||
| let personalDetails = []; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.PERSONAL_DETAILS, | ||
| callback: val => personalDetails = _.values(val), | ||
| }); | ||
|
|
||
| /** | ||
| * Given a list of account IDs (as string) it will return an array of personal details objects. | ||
| * @param {Array<string>} accountIDs - Array of accountIDs | ||
| * @param {boolean} shouldChangeUserDisplayName - It will replace the current user's personal detail object's displayName with 'You'. | ||
| * @returns {Array} - Array of personal detail objects | ||
| */ | ||
| function getPersonalDetailsByIDs(accountIDs, shouldChangeUserDisplayName = false) { | ||
| const result = []; | ||
| const currentAccountID = Report.getCurrentUserAccountID(); | ||
| _.each(personalDetails, (detail) => { | ||
| for (let i = 0; i < accountIDs.length; i++) { | ||
| if (detail.accountID === accountIDs[i]) { | ||
| if (shouldChangeUserDisplayName && currentAccountID.toString() === detail.accountID) { | ||
| result[i] = { | ||
| ...detail, | ||
| displayName: Localize.translateLocal('common.you'), | ||
| }; | ||
| } else { | ||
| result[i] = detail; | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| }); | ||
| return result; | ||
| } | ||
|
|
||
| export { | ||
| // eslint-disable-next-line import/prefer-default-export | ||
| getPersonalDetailsByIDs, | ||
| }; |
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
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.