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

Typing indicator ellipses #5933

Merged
merged 10 commits into from
Nov 2, 2021
2 changes: 1 addition & 1 deletion src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default {
newMsg: ({count}) => `${count} new message${count > 1 ? 's' : ''}`,
},
reportTypingIndicator: {
isTyping: 'is typing...',
isTyping: 'is typing',
Copy link
Member

Choose a reason for hiding this comment

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

I think we should keep this as it is??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did add ... back to typing....

image

I am not sure if two ... look fine. But upto you guys.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, I think it's fine for now since is typing... is pretty standard if there's no animation for a user typing.

areTyping: 'are typing...',
multipleUsers: 'Multiple users',
},
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default {
newMsg: ({count}) => `${count} mensaje${count > 1 ? 's' : ''} nuevo${count > 1 ? 's' : ''}`,
},
reportTypingIndicator: {
isTyping: 'está escribiendo...',
isTyping: 'está escribiendo',
areTyping: 'están escribiendo...',
multipleUsers: 'Varios usuarios',
},
Expand Down
21 changes: 8 additions & 13 deletions src/pages/home/report/ReportTypingIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import _ from 'underscore';
import {withOnyx} from 'react-native-onyx';
import compose from '../../../libs/compose';
import ONYXKEYS from '../../../ONYXKEYS';
import styles from '../../../styles/styles';
import styles, {getTypingIndicatorTextStyle} from '../../../styles/styles';
import {getDisplayName} from '../../../libs/actions/PersonalDetails';
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
import Text from '../../../components/Text';

const propTypes = {
/** Key-value pairs of user logins and whether or not they are typing. Keys are logins. */
userTypingStatuses: PropTypes.objectOf(PropTypes.bool),

...withLocalizePropTypes,
...windowDimensionsPropTypes,
};

const defaultProps = {
Expand Down Expand Up @@ -53,33 +55,25 @@ class ReportTypingIndicator extends React.Component {
return <View style={[styles.chatItemComposeSecondaryRow]} />;
case 1:
return (
<View style={[styles.chatItemComposeSecondaryRow]}>
<View style={[styles.chatItemComposeSecondaryRow, styles.flexRow]}>
<Text
style={[
styles.chatItemComposeSecondaryRowSubText,
styles.chatItemComposeSecondaryRowOffset,
getTypingIndicatorTextStyle(this.props.isSmallScreenWidth),
Copy link
Member

Choose a reason for hiding this comment

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

We will not need it. See comment below...

]}
numberOfLines={1}
>
{getDisplayName(this.state.usersTyping[0])}
{` ${this.props.translate('reportTypingIndicator.isTyping')}`}
</Text>
</View>
);
case 2:
return (
<View style={[styles.chatItemComposeSecondaryRow]}>
<Text
style={[
styles.chatItemComposeSecondaryRowSubText,
styles.chatItemComposeSecondaryRowOffset,
styles.ml1,
Copy link
Member

Choose a reason for hiding this comment

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

I think we should take the natural gap of 1 char.

]}
numberOfLines={1}
>
{getDisplayName(this.state.usersTyping[0])}
{` ${this.props.translate('common.and')} `}
{getDisplayName(this.state.usersTyping[1])}
{` ${this.props.translate('reportTypingIndicator.areTyping')}`}
{` ${this.props.translate('reportTypingIndicator.isTyping')}`}
</Text>
</View>
);
Expand Down Expand Up @@ -108,6 +102,7 @@ ReportTypingIndicator.displayName = 'ReportTypingIndicator';

export default compose(
withLocalize,
withWindowDimensions,
Copy link
Member

Choose a reason for hiding this comment

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

Seems like unsued now.

withOnyx({
userTypingStatuses: {
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${reportID}`,
Expand Down
17 changes: 17 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2179,6 +2179,22 @@ const webViewStyles = {
},
};

/**
* Return typing indicator text style
* @param {Boolean} isSmallScreenWidth
*
* @returns {Object}
*/
function getTypingIndicatorTextStyle(isSmallScreenWidth) {
return isSmallScreenWidth
? {
maxWidth: 200,
}
: {
maxWidth: 500,
};
}

Copy link
Member

Choose a reason for hiding this comment

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

Hmm. This is supposed to be fluid. Take max available space with hiding is typing...

/**
* Takes safe area insets and returns padding to use for a View
*
Expand Down Expand Up @@ -2461,4 +2477,5 @@ export {
getModalPaddingStyles,
getFontFamilyMonospace,
getEmojiPickerStyle,
getTypingIndicatorTextStyle,
};