diff --git a/src/components/AvatarWithIndicator.js b/src/components/AvatarWithIndicator.js index 4c7d4dcf1baa..399bd610121c 100644 --- a/src/components/AvatarWithIndicator.js +++ b/src/components/AvatarWithIndicator.js @@ -9,6 +9,8 @@ import styles from '../styles/styles'; import Icon from './Icon'; import {Sync} from './Icon/Expensicons'; import SpinningIndicatorAnimation from '../styles/animation/SpinningIndicatorAnimation'; +import Tooltip from './Tooltip'; +import withLocalize, {withLocalizePropTypes} from './withLocalize'; const propTypes = { /** Is user active? */ @@ -22,12 +24,18 @@ const propTypes = { // Whether we show the sync indicator isSyncing: PropTypes.bool, + + /** To show a tooltip on hover */ + tooltipText: PropTypes.string, + + ...withLocalizePropTypes, }; const defaultProps = { isActive: false, size: 'default', isSyncing: false, + tooltipText: '', }; class AvatarWithIndicator extends PureComponent { @@ -55,6 +63,24 @@ class AvatarWithIndicator extends PureComponent { this.animation.stop(); } + /** + * Returns user status as text + * + * @returns {String} + */ + userStatus() { + if (this.props.isSyncing) { + return this.props.translate('profilePage.syncing'); + } + + if (this.props.isActive) { + return this.props.translate('profilePage.online'); + } + + if (!this.props.isActive) { + return this.props.translate('profilePage.offline'); + } + } render() { const indicatorStyles = [ @@ -69,20 +95,24 @@ class AvatarWithIndicator extends PureComponent { - - - {this.props.isSyncing && ( - - )} - + + + + + + {this.props.isSyncing && ( + + )} + + ); } @@ -90,4 +120,4 @@ class AvatarWithIndicator extends PureComponent { AvatarWithIndicator.defaultProps = defaultProps; AvatarWithIndicator.propTypes = propTypes; -export default AvatarWithIndicator; +export default withLocalize(AvatarWithIndicator); diff --git a/src/languages/en.js b/src/languages/en.js index bde22d3861bd..65e76aa5f069 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -231,6 +231,9 @@ export default { setMyTimezoneAutomatically: 'Set my timezone automatically', timezone: 'Timezone', growlMessageOnSave: 'Your profile was successfully saved', + online: 'Online', + offline: 'Offline', + syncing: 'Syncing', }, addSecondaryLoginPage: { addPhoneNumber: 'Add phone number', diff --git a/src/languages/es.js b/src/languages/es.js index b46ff9ae7e50..c2a33cb33ea8 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -231,6 +231,9 @@ export default { setMyTimezoneAutomatically: 'Configura mi zona horaria automáticamente', timezone: 'Zona horaria', growlMessageOnSave: 'Tu perfil se ha guardado correctamente', + online: 'En línea', + offline: 'Desconectado', + syncing: 'Sincronizando', }, addSecondaryLoginPage: { addPhoneNumber: 'Agregar número de teléfono', diff --git a/src/pages/home/sidebar/SidebarLinks.js b/src/pages/home/sidebar/SidebarLinks.js index f91faad43215..c8225e3ddde5 100644 --- a/src/pages/home/sidebar/SidebarLinks.js +++ b/src/pages/home/sidebar/SidebarLinks.js @@ -213,19 +213,18 @@ class SidebarLinks extends React.Component { - - - - - + + +