diff --git a/app/actions/navigation/index.js b/app/actions/navigation/index.js index e1985e794..5a4b79bf5 100644 --- a/app/actions/navigation/index.js +++ b/app/actions/navigation/index.js @@ -172,3 +172,12 @@ export function closeModal() { }, getState); }; } + +export function goToModalAccountSettings() { + return async (dispatch, getState) => { + dispatch({ + type: NavigationTypes.NAVIGATION_MODAL, + route: Routes.AccountSettings + }, getState); + }; +} diff --git a/app/navigation/routes.js b/app/navigation/routes.js index 22ae8e616..21c12f5c5 100644 --- a/app/navigation/routes.js +++ b/app/navigation/routes.js @@ -2,6 +2,7 @@ // See License.txt for license information. import { + AccountSettings, ChannelView, ChannelDrawer, ChannelInfo, @@ -29,6 +30,14 @@ export const RouteTransitions = keyMirror({ }); export const Routes = { + AccountSettings: { + key: 'AccountSettings', + transition: RouteTransitions.Horizontal, + component: AccountSettings, + navigationProps: { + title: {id: 'user.settings.modal.title', defaultMessage: 'Account Settings'} + } + }, ChannelInfo: { key: 'ChannelInfo', transition: RouteTransitions.Horizontal, diff --git a/app/scenes/account_settings/account_settings.js b/app/scenes/account_settings/account_settings.js new file mode 100644 index 000000000..957bf2628 --- /dev/null +++ b/app/scenes/account_settings/account_settings.js @@ -0,0 +1,152 @@ +// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React, {PropTypes, PureComponent} from 'react'; +import { + StyleSheet, + TouchableOpacity, + View +} from 'react-native'; +import Icon from 'react-native-vector-icons/FontAwesome'; + +import FormattedText from 'app/components/formatted_text'; +import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme'; + +const getStyleSheet = makeStyleSheetFromTheme((theme) => { + return StyleSheet.create({ + container: { + flex: 1, + backgroundColor: changeOpacity(theme.centerChannelColor, 0.03) + }, + item: { + height: 45, + flexDirection: 'row', + alignItems: 'center' + }, + itemLeftIcon: { + color: changeOpacity(theme.centerChannelColor, 0.5) + }, + itemLeftIconContainer: { + width: 18, + marginRight: 15, + alignItems: 'center', + justifyContent: 'center' + }, + itemText: { + fontSize: 16, + color: theme.centerChannelColor, + flex: 1 + }, + itemRightIcon: { + color: changeOpacity(theme.centerChannelColor, 0.5) + }, + itemsContainer: { + marginTop: 30, + backgroundColor: theme.centerChannelBg, + borderTopWidth: 1, + borderBottomWidth: 1, + borderTopColor: changeOpacity(theme.centerChannelColor, 0.1), + borderBottomColor: changeOpacity(theme.centerChannelColor, 0.1) + }, + itemWrapper: { + marginHorizontal: 15 + }, + separator: { + height: 1, + backgroundColor: changeOpacity(theme.centerChannelColor, 0.1) + }, + wrapper: { + flex: 1, + backgroundColor: theme.centerChannelBg + } + }); +}); + +export default class AccountSettings extends PureComponent { + static propTypes = { + theme: PropTypes.object.isRequired + } + + static navigationProps = { + renderLeftComponent: (props, emitter, theme) => { + return ( + + + + ); + } + }; + + // The enabled arg can be removed once all the scenes have been implemented. + buildItemRow = (icon, id, defaultMessage, action, separator = true, enabled = false) => { + if (!enabled) { + return null; + } + + const {theme} = this.props; + const style = getStyleSheet(theme); + + return ( + + + + + + + + + {separator && } + + ); + } + + renderItems = () => { + return [ + this.buildItemRow('gear', 'user.settings.modal.general', 'General', () => true, true, true), + this.buildItemRow('lock', 'user.settings.modal.security', 'Security', () => true, true, true), + this.buildItemRow('bell', 'user.settings.modal.notifications', 'Notifications', () => true, true, false), + this.buildItemRow('mobile', 'user.settings.modal.display', 'Display', () => true, true, false), + this.buildItemRow('wrench', 'user.settings.modal.advanced', 'Advanced', () => true, false, false) + ]; + } + + render() { + const {theme} = this.props; + const style = getStyleSheet(theme); + + return ( + + + + {this.renderItems()} + + + + ); + } +} diff --git a/app/scenes/account_settings/account_settings_container.js b/app/scenes/account_settings/account_settings_container.js new file mode 100644 index 000000000..46f9433da --- /dev/null +++ b/app/scenes/account_settings/account_settings_container.js @@ -0,0 +1,25 @@ +// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import {bindActionCreators} from 'redux'; + +import {getTheme} from 'service/selectors/entities/preferences'; + +import navigationSceneConnect from '../navigationSceneConnect'; +import AccountSettings from './account_settings'; + +function mapStateToProps(state) { + return { + theme: getTheme(state) + }; +} + +function mapDispatchToProps(dispatch) { + return { + actions: bindActionCreators({ + + }, dispatch) + }; +} + +export default navigationSceneConnect(mapStateToProps, mapDispatchToProps)(AccountSettings); diff --git a/app/scenes/account_settings/index.js b/app/scenes/account_settings/index.js new file mode 100644 index 000000000..5c9275145 --- /dev/null +++ b/app/scenes/account_settings/index.js @@ -0,0 +1,6 @@ +// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import AccountSettingsContainer from './account_settings_container'; + +export default AccountSettingsContainer; diff --git a/app/scenes/index.js b/app/scenes/index.js index 9946c33ad..c3cfc1e5c 100644 --- a/app/scenes/index.js +++ b/app/scenes/index.js @@ -1,6 +1,7 @@ // Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. +import AccountSettings from './account_settings'; import Channel from './channel'; import ChannelDrawer from './channel_drawer'; import ChannelInfo from './channel_info'; @@ -21,6 +22,7 @@ import Thread from './thread'; import UserProfile from './user_profile'; module.exports = { + AccountSettings, ChannelView: Channel, // Special case the name for this one to avoid ambiguity ChannelDrawer, ChannelInfo, diff --git a/app/scenes/right_menu_drawer/right_menu_drawer.js b/app/scenes/right_menu_drawer/right_menu_drawer.js index 060a8dfdc..c1f27d719 100644 --- a/app/scenes/right_menu_drawer/right_menu_drawer.js +++ b/app/scenes/right_menu_drawer/right_menu_drawer.js @@ -50,6 +50,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => { export default class RightMenuDrawer extends React.Component { static propTypes = { actions: React.PropTypes.shape({ + goToModalAccountSettings: React.PropTypes.func.isRequired, goToModalSelectTeam: React.PropTypes.func.isRequired, logout: React.PropTypes.func.isRequired }).isRequired, @@ -62,7 +63,7 @@ export default class RightMenuDrawer extends React.Component { return ( - +