diff --git a/app/components/channel_icon.js b/app/components/channel_icon.js index b85473c21..edc78b16d 100644 --- a/app/components/channel_icon.js +++ b/app/components/channel_icon.js @@ -9,7 +9,7 @@ import { } from 'react-native'; import Icon from 'react-native-vector-icons/FontAwesome'; -import {OnlineStatus, AwayStatus, OfflineStatus} from 'app/components/status_icons'; +import {AwayAvatar, DndAvatar, OfflineAvatar, OnlineAvatar} from 'app/components/status_icons'; import {General} from 'mattermost-redux/constants'; @@ -90,30 +90,43 @@ export default class ChannelIcon extends React.PureComponent { ); } else if (type === General.DM_CHANNEL) { - if (status === General.ONLINE) { + switch (status) { + case General.AWAY: icon = ( - - ); - } else if (status === General.AWAY) { - icon = ( - ); - } else { + break; + case General.DND: icon = ( - + ); + break; + case General.ONLINE: + icon = ( + + ); + break; + default: + icon = ( + ); + break; } } diff --git a/app/components/channel_intro/channel_intro.js b/app/components/channel_intro/channel_intro.js index bee1cc7ba..993801e5a 100644 --- a/app/components/channel_intro/channel_intro.js +++ b/app/components/channel_intro/channel_intro.js @@ -77,7 +77,6 @@ class ChannelIntro extends PureComponent { size={64} statusBorderWidth={2} statusSize={25} - statusIconSize={15} /> )); diff --git a/app/components/profile_picture/profile_picture.js b/app/components/profile_picture/profile_picture.js index 76bc754a1..a2fdda87d 100644 --- a/app/components/profile_picture/profile_picture.js +++ b/app/components/profile_picture/profile_picture.js @@ -4,8 +4,10 @@ import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; import {Image, Platform, View} from 'react-native'; -import Icon from 'react-native-vector-icons/FontAwesome'; +import {General} from 'mattermost-redux/constants'; + +import {AwayIcon, DndIcon, OfflineIcon, OnlineIcon} from 'app/components/status_icons'; import {makeStyleSheetFromTheme} from 'app/utils/theme'; import placeholder from 'assets/images/profile.jpg'; @@ -13,8 +15,10 @@ import placeholder from 'assets/images/profile.jpg'; import {Client4} from 'mattermost-redux/client'; const statusToIcon = { - online: 'check', - away: 'minus' + away: AwayIcon, + dnd: DndIcon, + offline: OfflineIcon, + online: OnlineIcon }; const STATUS_BUFFER = Platform.select({ @@ -27,7 +31,6 @@ export default class ProfilePicture extends PureComponent { size: PropTypes.number, statusBorderWidth: PropTypes.number, statusSize: PropTypes.number, - statusIconSize: PropTypes.number, user: PropTypes.object, status: PropTypes.string, theme: PropTypes.object.isRequired, @@ -39,8 +42,7 @@ export default class ProfilePicture extends PureComponent { static defaultProps = { size: 128, statusBorderWidth: 2, - statusSize: 14, - statusIconSize: 8 + statusSize: 14 }; componentDidMount() { @@ -50,38 +52,46 @@ export default class ProfilePicture extends PureComponent { } render() { - const style = getStyleSheet(this.props.theme); + const {theme} = this.props; + const style = getStyleSheet(theme); let pictureUrl; if (this.props.user) { pictureUrl = Client4.getProfilePictureUrl(this.props.user.id, this.props.user.last_picture_update); } - let statusIcon; + let Icon; + let iconColor; if (this.props.status && statusToIcon[this.props.status]) { - statusIcon = ( - - ); + Icon = statusToIcon[this.props.status]; + + switch (this.props.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; + } } else { - statusIcon = ( - - ); + Icon = statusToIcon.offline; + iconColor = theme.centerChannelColor; } + const statusIcon = ( + + ); + return ( {this.props.status && - - - {statusIcon} - + + {statusIcon} } @@ -131,13 +117,9 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => { bottom: 0, right: 0, overflow: 'hidden', - alignItems: 'center', - justifyContent: 'center' - }, - statusContainer: { alignItems: 'center', justifyContent: 'center', - overflow: 'hidden' + backgroundColor: theme.centerChannelBg }, status: { color: theme.centerChannelBg @@ -148,6 +130,9 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => { away: { backgroundColor: theme.awayIndicator }, + dnd: { + backgroundColor: 'red' + }, offline: { backgroundColor: theme.centerChannelBg }, diff --git a/app/components/status_icons/away_avatar.js b/app/components/status_icons/away_avatar.js new file mode 100644 index 000000000..173ab564b --- /dev/null +++ b/app/components/status_icons/away_avatar.js @@ -0,0 +1,49 @@ +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React, {PureComponent} from 'react'; +import PropTypes from 'prop-types'; +import {View} from 'react-native'; +import Svg, { + Circle, + G, + Path +} from 'react-native-svg'; + +export default class AwayAvatar extends PureComponent { + static propTypes = { + width: PropTypes.number.isRequired, + height: PropTypes.number.isRequired, + color: PropTypes.string.isRequired + }; + + render() { + const {color, height, width} = this.props; + return ( + + + + + + + + + + ); + } +} diff --git a/app/components/status_icons/away_icon.js b/app/components/status_icons/away_icon.js new file mode 100644 index 000000000..aafa99b27 --- /dev/null +++ b/app/components/status_icons/away_icon.js @@ -0,0 +1,37 @@ +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React, {PureComponent} from 'react'; +import PropTypes from 'prop-types'; +import {View} from 'react-native'; +import Svg, { + Path +} from 'react-native-svg'; + +export default class AwayIcon extends PureComponent { + static propTypes = { + width: PropTypes.number.isRequired, + height: PropTypes.number.isRequired, + color: PropTypes.string.isRequired + }; + + render() { + const {color, height, width} = this.props; + + return ( + + + + + + ); + } +} diff --git a/app/components/status_icons/away.js b/app/components/status_icons/dnd_avatar.js similarity index 93% rename from app/components/status_icons/away.js rename to app/components/status_icons/dnd_avatar.js index 190bbb8b1..f9e833835 100644 --- a/app/components/status_icons/away.js +++ b/app/components/status_icons/dnd_avatar.js @@ -1,4 +1,4 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import React, {PureComponent} from 'react'; @@ -10,7 +10,7 @@ import Svg, { Path } from 'react-native-svg'; -export default class AwayStatus extends PureComponent { +export default class DndAvatar extends PureComponent { static propTypes = { width: PropTypes.number.isRequired, height: PropTypes.number.isRequired, diff --git a/app/components/status_icons/dnd_icon.js b/app/components/status_icons/dnd_icon.js new file mode 100644 index 000000000..384658409 --- /dev/null +++ b/app/components/status_icons/dnd_icon.js @@ -0,0 +1,35 @@ +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React, {PureComponent} from 'react'; +import PropTypes from 'prop-types'; +import {View} from 'react-native'; +import Svg, { + Path +} from 'react-native-svg'; +export default class DndIcon extends PureComponent { + static propTypes = { + width: PropTypes.number.isRequired, + height: PropTypes.number.isRequired, + color: PropTypes.string.isRequired + }; + + render() { + const {color, height, width} = this.props; + return ( + + + + + + ); + } +} diff --git a/app/components/status_icons/index.js b/app/components/status_icons/index.js index 9dc30d8b4..c989b3f1e 100644 --- a/app/components/status_icons/index.js +++ b/app/components/status_icons/index.js @@ -1,12 +1,22 @@ // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. -import OnlineStatus from './online'; -import AwayStatus from './away'; -import OfflineStatus from './offline'; +import AwayAvatar from './away_avatar'; +import AwayIcon from './away_icon'; +import DndAvatar from './dnd_avatar'; +import DndIcon from './dnd_icon'; +import OfflineAvatar from './offline_avatar'; +import OfflineIcon from './offline_icon'; +import OnlineAvatar from './online_avatar'; +import OnlineIcon from './online_icon'; export { - OnlineStatus, - AwayStatus, - OfflineStatus + AwayAvatar, + AwayIcon, + DndAvatar, + DndIcon, + OfflineAvatar, + OfflineIcon, + OnlineAvatar, + OnlineIcon }; diff --git a/app/components/status_icons/offline.js b/app/components/status_icons/offline_avatar.js similarity index 100% rename from app/components/status_icons/offline.js rename to app/components/status_icons/offline_avatar.js diff --git a/app/components/status_icons/offline_icon.js b/app/components/status_icons/offline_icon.js new file mode 100644 index 000000000..6921cd584 --- /dev/null +++ b/app/components/status_icons/offline_icon.js @@ -0,0 +1,37 @@ +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React, {PureComponent} from 'react'; +import PropTypes from 'prop-types'; +import {View} from 'react-native'; +import Svg, { + Path +} from 'react-native-svg'; + +export default class OfflineIcon extends PureComponent { + static propTypes = { + width: PropTypes.number.isRequired, + height: PropTypes.number.isRequired, + color: PropTypes.string.isRequired + }; + + render() { + const {color, height, width} = this.props; + return ( + + + + + + ); + } +} diff --git a/app/components/status_icons/online.js b/app/components/status_icons/online_avatar.js similarity index 100% rename from app/components/status_icons/online.js rename to app/components/status_icons/online_avatar.js diff --git a/app/components/status_icons/online_icon.js b/app/components/status_icons/online_icon.js new file mode 100644 index 000000000..fb0121449 --- /dev/null +++ b/app/components/status_icons/online_icon.js @@ -0,0 +1,36 @@ +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React, {PureComponent} from 'react'; +import PropTypes from 'prop-types'; +import {View} from 'react-native'; +import Svg, { + Path +} from 'react-native-svg'; + +export default class OnlineIcon extends PureComponent { + static propTypes = { + width: PropTypes.number.isRequired, + height: PropTypes.number.isRequired, + color: PropTypes.string.isRequired + }; + + render() { + const {color, height, width} = this.props; + return ( + + + + + + ); + } +} diff --git a/app/screens/user_profile/user_profile.js b/app/screens/user_profile/user_profile.js index 36d97be6f..8c8faa53e 100644 --- a/app/screens/user_profile/user_profile.js +++ b/app/screens/user_profile/user_profile.js @@ -160,7 +160,6 @@ class UserProfile extends PureComponent { size={150} statusBorderWidth={6} statusSize={40} - statusIconSize={18} /> {this.getDisplayName()} {`@${user.username}`} diff --git a/package.json b/package.json index 3f7a34ec5..1767a7ddb 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "react-native-passcode-status": "1.1.0", "react-native-sentry": "0.15.1", "react-native-status-bar-size": "0.3.2", - "react-native-svg": "5.4.2", + "react-native-svg": "6.0.0", "react-native-tooltip": "enahum/react-native-tooltip", "react-native-vector-icons": "4.4.2", "react-native-youtube": "1.0.1", diff --git a/yarn.lock b/yarn.lock index c4ea18a18..2f6bf5db6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3938,7 +3938,7 @@ makeerror@1.0.x: mattermost-redux@mattermost/mattermost-redux#master: version "1.0.1" - resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/c00dc5a7464d5a96e0370b8d210a3b1b0449327b" + resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/5c0383e2ab08b4419c8a99b79f402ab9ba1fa6c8" dependencies: deep-equal "1.0.1" form-data "2.3.1"