-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat: user pill workflow attendees #87705
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
Open
TaduJR
wants to merge
6
commits into
Expensify:main
Choose a base branch
from
TaduJR:feat-user-pill-workflow-attendees
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
08a9906
feat-Add-user-pill-components-for-approval-workflows-and-expense-atte…
TaduJR 19f7171
refactor: Remove manual useMemo for React Compiler compliance
TaduJR b309d00
fix: Add bordered pill styling and alignSelfStart
TaduJR 4f6fc1d
fix: Add attendee pills to expense confirmation page
TaduJR d9370be
feat: Add hover tooltip, accessibility labels, and extend pills to ap…
TaduJR 09856ce
fix: Use CONST.DEFAULT_NUMBER_ID instead of 0 for default accountID
TaduJR 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
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,59 @@ | ||
| import {Str} from 'expensify-common'; | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import type {AvatarSource} from '@libs/UserAvatarUtils'; | ||
| import CONST from '@src/CONST'; | ||
| import Avatar from './Avatar'; | ||
| import Text from './Text'; | ||
| import UserDetailsTooltip from './UserDetailsTooltip'; | ||
|
|
||
| type UserPillProps = { | ||
| /** Avatar source (URL or icon) */ | ||
| avatar?: AvatarSource; | ||
|
|
||
| /** Display name of the user */ | ||
| displayName: string; | ||
|
|
||
| /** Account ID for proper avatar rendering */ | ||
| accountID?: number; | ||
|
|
||
| /** Email/login for tooltip subtitle */ | ||
| email?: string; | ||
| }; | ||
|
|
||
| function UserPill({avatar, displayName, accountID, email}: UserPillProps) { | ||
| const styles = useThemeStyles(); | ||
|
|
||
| return ( | ||
| <UserDetailsTooltip | ||
| accountID={accountID ?? CONST.DEFAULT_NUMBER_ID} | ||
| fallbackUserDetails={{ | ||
| avatar, | ||
| displayName: Str.removeSMSDomain(displayName), | ||
| login: email ?? displayName, | ||
| }} | ||
| > | ||
| <View style={[styles.flexRow, styles.alignItemsCenter, styles.alignSelfStart, styles.userPill]}> | ||
| <Avatar | ||
| source={avatar} | ||
| size={CONST.AVATAR_SIZE.MENTION_ICON} | ||
| type={CONST.ICON_TYPE_AVATAR} | ||
| avatarID={accountID} | ||
| name={displayName} | ||
| /> | ||
| <Text | ||
| style={styles.userPillText} | ||
| numberOfLines={1} | ||
| > | ||
| {Str.removeSMSDomain(displayName)} | ||
| </Text> | ||
| </View> | ||
| </UserDetailsTooltip> | ||
| ); | ||
| } | ||
|
|
||
| UserPill.displayName = 'UserPill'; | ||
|
|
||
| export default UserPill; | ||
| export type {UserPillProps}; |
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,74 @@ | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import type {AvatarSource} from '@libs/UserAvatarUtils'; | ||
| import Text from './Text'; | ||
| import Tooltip from './Tooltip'; | ||
| import UserPill from './UserPill'; | ||
|
|
||
| type UserPillData = { | ||
| /** Avatar source (URL or icon) */ | ||
| avatar?: AvatarSource; | ||
|
|
||
| /** Display name of the user */ | ||
| displayName: string; | ||
|
|
||
| /** Account ID for proper avatar rendering */ | ||
| accountID?: number; | ||
|
|
||
| /** Email/login for tooltip subtitle */ | ||
| email?: string; | ||
| }; | ||
|
|
||
| type UserPillsProps = { | ||
| /** Array of user data to render as pills */ | ||
| users: UserPillData[]; | ||
|
|
||
| /** Maximum number of pills to display before showing "+X more" */ | ||
| maxVisible?: number; | ||
| }; | ||
|
|
||
| const DEFAULT_MAX_VISIBLE = 9; | ||
|
|
||
| function UserPills({users, maxVisible = DEFAULT_MAX_VISIBLE}: UserPillsProps) { | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
|
|
||
| // "+1 more" edge case: if only 1 user would be hidden, show it instead of "+1 more" | ||
| const visibleUsers = users.length <= maxVisible + 1 ? users : users.slice(0, maxVisible); | ||
| const hiddenCount = users.length - visibleUsers.length; | ||
| const hiddenNames = | ||
| hiddenCount > 0 | ||
| ? users | ||
| .slice(visibleUsers.length) | ||
| .map((u) => u.displayName) | ||
| .join(', ') | ||
| : ''; | ||
|
|
||
| return ( | ||
| <View style={[styles.flexRow, styles.flexWrap, styles.userPillsContainer]}> | ||
| {visibleUsers.map((user) => ( | ||
| <UserPill | ||
| key={user.accountID ?? user.displayName} | ||
| avatar={user.avatar} | ||
| displayName={user.displayName} | ||
| accountID={user.accountID} | ||
| email={user.email} | ||
| /> | ||
| ))} | ||
| {hiddenCount > 0 && ( | ||
| <Tooltip text={hiddenNames}> | ||
| <View style={[styles.flexRow, styles.alignItemsCenter]}> | ||
| <Text style={styles.userPillMoreText}>{translate('common.plusMore', {count: hiddenCount})}</Text> | ||
| </View> | ||
| </Tooltip> | ||
| )} | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| UserPills.displayName = 'UserPills'; | ||
|
|
||
| export default UserPills; | ||
| export type {UserPillData, UserPillsProps}; |
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
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
Oops, something went wrong.
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.