mattermost-mobile/app/components/user_status/user_status.js
Chris Duarte 1a3558bc5e Auto responder feature (#1500)
* Add Auto Responder support

Add Auto Responder message support for <Post/>

Add Out Of Office support

Add Confirmation dialog for Out Of Office status reset

Fixing styling issues

Ensure AutoResponder is enabled in settings with ooo status

Save AutoResponder according to Out Of Office status

Fix copy for AutoResponder hint

Fix eslint errors

* Add constants from Redux

* Small refactor

* Add name consistency with the feature "auto responder"

* Add minimum server version of 4.9 for AutoResponder support

* Add ViewTypes.PROFILE_PICTURE_SIZE in post_profile_picture

* Add ExperimentalEnableAutomaticReplies flag

* Update copy and auto responder styles

* Remove unwanted imports

* AutoResponder feauture in 4.9

* Add AutoResponder Thread support

* Fix OOF copy from review

* Change copy for Auto Responder

* Address feedback

* Fix license headers

* Status name translated in Alert

* Add umbrella icon for AutoResponder

* Fix minor issues with rebase

* Fix License headers
2018-06-22 13:09:37 -04:00

61 lines
1.5 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {PureComponent} from 'react';
import {Image} from 'react-native';
import PropTypes from 'prop-types';
import {General} from 'mattermost-redux/constants';
import away from 'assets/images/status/away.png';
import dnd from 'assets/images/status/dnd.png';
import offline from 'assets/images/status/offline.png';
import online from 'assets/images/status/online.png';
const statusToIcon = {
away,
dnd,
offline,
ooo: offline,
online,
};
export default class UserStatus extends PureComponent {
static propTypes = {
size: PropTypes.number,
status: PropTypes.string,
theme: PropTypes.object.isRequired,
};
static defaultProps = {
size: 14,
status: General.OFFLINE,
};
render() {
const {size, status, theme} = this.props;
const Icon = statusToIcon[status];
let iconColor;
switch (status) {
case General.AWAY:
iconColor = theme.awayIndicator;
break;
case General.DND:
iconColor = theme.dndIndicator;
break;
case General.ONLINE:
iconColor = theme.onlineIndicator;
break;
default:
iconColor = theme.centerChannelColor;
break;
}
return (
<Image
source={Icon}
style={{height: size, width: size, tintColor: iconColor}}
/>
);
}
}