Skip to content
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

Added tooltips to all Icon buttons #4661

Merged
merged 12 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 41 additions & 38 deletions src/components/AvatarWithImagePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import styles from '../styles/styles';
import themeColors from '../styles/themes/default';
import AttachmentPicker from './AttachmentPicker';
import Tooltip from './Tooltip';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import variables from '../styles/variables';

Expand Down Expand Up @@ -99,45 +100,47 @@ class AvatarWithImagePicker extends React.Component {
const additionalStyles = _.isArray(this.props.style) ? this.props.style : [this.props.style];
return (
<View style={[styles.alignItemsCenter, ...additionalStyles]}>
<View style={[styles.pRelative, styles.avatarLarge]}>
{this.props.avatarURL
? (
<Avatar
containerStyles={styles.avatarLarge}
imageStyles={[styles.avatarLarge, styles.alignSelfCenter]}
source={this.props.avatarURL}
/>
)
: (
<DefaultAvatar />
)}
<AttachmentPicker>
{({openPicker}) => (
<>
<Pressable
style={[styles.smallEditIcon, styles.smallAvatarEditIcon]}
onPress={() => this.setState({isMenuVisible: true})}
>
<Icon
src={Pencil}
width={variables.iconSizeSmall}
height={variables.iconSizeSmall}
fill={themeColors.iconReversed}
/>
</Pressable>
<PopoverMenu
isVisible={this.state.isMenuVisible}
onClose={() => this.setState({isMenuVisible: false})}
onItemSelected={() => this.setState({isMenuVisible: false})}
menuItems={this.createMenuItems(openPicker)}
anchorPosition={this.props.anchorPosition}
animationIn="fadeInDown"
animationOut="fadeOutUp"
<Tooltip text={this.props.translate('avatarWithImagePicker.editImage')}>
<View style={[styles.pRelative, styles.avatarLarge]}>
{this.props.avatarURL
? (
<Avatar
containerStyles={styles.avatarLarge}
imageStyles={[styles.avatarLarge, styles.alignSelfCenter]}
source={this.props.avatarURL}
/>
</>
)}
</AttachmentPicker>
</View>
)
: (
<DefaultAvatar />
)}
<AttachmentPicker>
{({openPicker}) => (
<>
<Pressable
style={[styles.smallEditIcon, styles.smallAvatarEditIcon]}
onPress={() => this.setState({isMenuVisible: true})}
>
<Icon
src={Pencil}
width={variables.iconSizeSmall}
height={variables.iconSizeSmall}
fill={themeColors.iconReversed}
/>
</Pressable>
<PopoverMenu
isVisible={this.state.isMenuVisible}
onClose={() => this.setState({isMenuVisible: false})}
onItemSelected={() => this.setState({isMenuVisible: false})}
menuItems={this.createMenuItems(openPicker)}
anchorPosition={this.props.anchorPosition}
animationIn="fadeInDown"
animationOut="fadeOutUp"
/>
</>
)}
</AttachmentPicker>
</View>
</Tooltip>
</View>
);
}
Expand Down
37 changes: 23 additions & 14 deletions src/components/HeaderWithCloseButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Icon from './Icon';
import {Close, Download, BackArrow} from './Icon/Expensicons';
import compose from '../libs/compose';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import Tooltip from './Tooltip';

const propTypes = {
/** Title of the Header */
Expand Down Expand Up @@ -57,34 +58,42 @@ const HeaderWithCloseButton = props => (
]}
>
{props.shouldShowBackButton && (
<TouchableOpacity
onPress={props.onBackButtonPress}
style={[styles.touchableButtonImage]}
>
<Icon src={BackArrow} />
</TouchableOpacity>
<Tooltip text={props.translate('common.back')}>
<TouchableOpacity
onPress={props.onBackButtonPress}
style={[styles.touchableButtonImage]}
>
<Icon src={BackArrow} />
</TouchableOpacity>
</Tooltip>
)}
<Header title={props.title} />
<View style={[styles.reportOptions, styles.flexRow]}>
{
props.shouldShowDownloadButton && (
<Tooltip text={props.translate('common.download')}>

<TouchableOpacity
onPress={props.onDownloadButtonPress}
style={[styles.touchableButtonImage]}
>
<Icon src={Download} />
</TouchableOpacity>
</Tooltip>
)
}

<TouchableOpacity
onPress={props.onCloseButtonPress}
style={[styles.touchableButtonImage]}
accessibilityRole="button"
accessibilityLabel={props.translate('common.close')}
>
<Icon src={Close} />
</TouchableOpacity>
<Tooltip text={props.translate('common.close')}>

<TouchableOpacity
onPress={props.onCloseButtonPress}
style={[styles.touchableButtonImage]}
accessibilityRole="button"
accessibilityLabel={props.translate('common.close')}
>
<Icon src={Close} />
</TouchableOpacity>
</Tooltip>
</View>
</View>
</View>
Expand Down
39 changes: 21 additions & 18 deletions src/components/VideoChatButtonAndMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import withLocalize, {withLocalizePropTypes} from './withLocalize';
import compose from '../libs/compose';
import Navigation from '../libs/Navigation/Navigation';
import ROUTES from '../ROUTES';
import Tooltip from './Tooltip';

const propTypes = {
...withLocalizePropTypes,
Expand Down Expand Up @@ -95,24 +96,26 @@ class VideoChatButtonAndMenu extends Component {
ref={el => this.videoChatIconWrapper = el}
onLayout={this.measureVideoChatIconPosition}
>
<Pressable
onPress={() => {
// If this is the Concierge chat, we'll open the modal for requesting a setup call instead
if (this.props.isConcierge) {
Navigation.navigate(ROUTES.REQUEST_CALL);
return;
}
this.toggleVideoChatMenu();
}}
style={[styles.touchableButtonImage, styles.mr0]}
>
<Icon
src={Phone}
fill={(this.props.isConcierge || this.state.isVideoChatMenuActive)
? themeColors.heading
: themeColors.icon}
/>
</Pressable>
<Tooltip text={this.props.translate('videoChatButtonAndMenu.tooltip')}>
<Pressable
onPress={() => {
// If this is the Concierge chat, we'll open the modal for requesting a setup call instead
if (this.props.isConcierge) {
Navigation.navigate(ROUTES.REQUEST_CALL);
return;
}
this.toggleVideoChatMenu();
}}
style={[styles.touchableButtonImage, styles.mr0]}
>
<Icon
src={Phone}
fill={(this.props.isConcierge || this.state.isVideoChatMenuActive)
? themeColors.heading
: themeColors.icon}
/>
</Pressable>
</Tooltip>
</View>
<Popover
onClose={this.toggleVideoChatMenu}
Expand Down
7 changes: 7 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export default {
contacts: 'Contacts',
recents: 'Recents',
close: 'Close',
download: 'Download',
pin: 'Pin',
unPin: 'Unpin',
back: 'Back',
saveAndContinue: 'Save & Continue',
settings: 'Settings',
termsOfService: 'Terms of Service',
Expand Down Expand Up @@ -101,6 +105,7 @@ export default {
nameEmailOrPhoneNumber: 'Name, email, or phone number',
},
videoChatButtonAndMenu: {
tooltip: 'Video Chat',
zoom: 'Zoom',
googleMeet: 'Google Meet',
},
Expand All @@ -121,6 +126,7 @@ export default {
fileUploadFailed: 'Upload Failed. File is not supported.',
roomIsArchived: 'This chat room has been deleted',
localTime: ({user, time}) => `It's ${time} for ${user}`,
emoji: 'Emoji',
},
reportActionContextMenu: {
copyToClipboard: 'Copy to Clipboard',
Expand Down Expand Up @@ -194,6 +200,7 @@ export default {
avatarWithImagePicker: {
uploadPhoto: 'Upload Photo',
removePhoto: 'Remove Photo',
editImage: 'Edit Photo',
},
profilePage: {
profile: 'Profile',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export default {
contacts: 'Contactos',
recents: 'Recientes',
close: 'Cerrar',
download: 'Descargar',
pin: 'Anclar',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest using Fijar. This is the terminology used in popular apps like WhatsApp and Twitter.

unPin: 'Desanclar',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest using Desfijar. This is the terminology used in popular apps like WhatsApp and Twitter.

back: 'Volver',
saveAndContinue: 'Guardar y Continuar',
settings: 'Configuración',
termsOfService: 'Términos de servicio',
Expand Down Expand Up @@ -101,6 +105,7 @@ export default {
nameEmailOrPhoneNumber: 'Nombre, email o número de teléfono',
},
videoChatButtonAndMenu: {
tooltip: 'Videollamada',
zoom: 'Zoom',
googleMeet: 'Google Meet',
},
Expand All @@ -121,6 +126,7 @@ export default {
fileUploadFailed: 'Subida fallida. El archivo no es compatible.',
roomIsArchived: 'Esta sala de chat ha sido eliminada',
localTime: ({user, time}) => `Son las ${time} para ${user}`,
emoji: 'Emoji',
},
reportActionContextMenu: {
copyToClipboard: 'Copiar al Portapapeles',
Expand Down Expand Up @@ -194,6 +200,7 @@ export default {
avatarWithImagePicker: {
uploadPhoto: 'Subir Foto',
removePhoto: 'Eliminar Foto',
editImage: 'Editar Foto',
},
profilePage: {
profile: 'Perfil',
Expand Down
30 changes: 18 additions & 12 deletions src/pages/home/HeaderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize
import CONST from '../../CONST';
import {getDefaultRoomSubtitle, isDefaultRoom, isArchivedRoom} from '../../libs/reportUtils';
import Text from '../../components/Text';
import Tooltip from '../../components/Tooltip';

const propTypes = {
/** Toggles the navigationMenu open and closed */
Expand Down Expand Up @@ -96,12 +97,14 @@ const HeaderView = (props) => {
<View style={[styles.appContentHeader]} nativeID="drag-area">
<View style={[styles.appContentHeaderTitle, !props.isSmallScreenWidth && styles.pl5]}>
{props.isSmallScreenWidth && (
<Pressable
onPress={props.onNavigationMenuButtonClicked}
style={[styles.LHNToggle]}
>
<Icon src={BackArrow} />
</Pressable>
<Tooltip text={props.translate('common.back')}>
<Pressable
onPress={props.onNavigationMenuButtonClicked}
style={[styles.LHNToggle]}
>
<Icon src={BackArrow} />
</Pressable>
</Tooltip>
)}
{props.report && props.report.reportName && (
<View
Expand Down Expand Up @@ -158,13 +161,16 @@ const HeaderView = (props) => {
{props.report.hasOutstandingIOU && (
<IOUBadge iouReportID={props.report.iouReportID} />
)}

<VideoChatButtonAndMenu isConcierge={isConcierge} />
<Pressable
onPress={() => togglePinnedState(props.report)}
style={[styles.touchableButtonImage, styles.mr0]}
>
<Icon src={Pin} fill={props.report.isPinned ? themeColors.heading : themeColors.icon} />
</Pressable>
<Tooltip text={props.report.isPinned ? props.translate('common.unPin') : props.translate('common.pin')}>
<Pressable
onPress={() => togglePinnedState(props.report)}
style={[styles.touchableButtonImage, styles.mr0]}
>
<Icon src={Pin} fill={props.report.isPinned ? themeColors.heading : themeColors.icon} />
</Pressable>
</Tooltip>
</View>
</View>
)}
Expand Down
33 changes: 19 additions & 14 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {participantPropTypes} from '../sidebar/optionPropTypes';
import currentUserPersonalDetailsPropsTypes from '../../settings/Profile/currentUserPersonalDetailsPropsTypes';
import ParticipantLocalTime from './ParticipantLocalTime';
import {withNetwork, withPersonalDetails} from '../../../components/OnyxProvider';
import Tooltip from '../../../components/Tooltip';

const propTypes = {
/** Beta features list */
Expand Down Expand Up @@ -626,22 +627,26 @@ class ReportActionCompose extends React.Component {
disabled={isBlockedFromConcierge || isArchivedChatRoom}
>
{({hovered, pressed}) => (
<Icon
src={Emoji}
fill={getIconFillColor(getButtonState(hovered, pressed))}
/>
<Tooltip text={this.props.translate('reportActionCompose.emoji')}>
<Icon
src={Emoji}
fill={getIconFillColor(getButtonState(hovered, pressed))}
/>
</Tooltip>
)}
</Pressable>
<TouchableOpacity
style={[styles.chatItemSubmitButton,
this.state.isCommentEmpty
? styles.buttonDisable : styles.buttonSuccess]}
onPress={this.submitForm}
underlayColor={themeColors.componentBG}
disabled={this.state.isCommentEmpty || isBlockedFromConcierge || isArchivedChatRoom}
>
<Icon src={Send} fill={themeColors.componentBG} />
</TouchableOpacity>
<Tooltip text={this.props.translate('common.send')}>
<TouchableOpacity
style={[styles.chatItemSubmitButton,
this.state.isCommentEmpty
? styles.buttonDisable : styles.buttonSuccess]}
onPress={this.submitForm}
underlayColor={themeColors.componentBG}
disabled={this.state.isCommentEmpty || isBlockedFromConcierge || isArchivedChatRoom}
>
<Icon src={Send} fill={themeColors.componentBG} />
</TouchableOpacity>
</Tooltip>
</View>
{this.props.network.isOffline ? (
<View style={[styles.chatItemComposeSecondaryRow]}>
Expand Down
Loading