From 0cf173d7bafc1a4c5be3e514141ec4606cbd025b Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Mon, 26 Apr 2021 14:06:22 -0400 Subject: [PATCH] Added AddChannelTeamView --- app/i18n/locales/en.json | 5 +- app/stacks/InsideStack.js | 6 ++ app/views/AddChannelTeamView.js | 123 ++++++++++++++++++++++++++++++++ app/views/TeamChannelsView.js | 3 +- 4 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 app/views/AddChannelTeamView.js diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json index 58438f319..06e3167eb 100644 --- a/app/i18n/locales/en.json +++ b/app/i18n/locales/en.json @@ -716,5 +716,8 @@ "Read_Only_Team": "Read Only Team", "Broadcast_Team": "Broadcast Team", "creating_team" : "creating team", - "team-name-already-exists": "A team with that name already exists" + "team-name-already-exists": "A team with that name already exists", + "Add_Channel_to_Team": "Add Channel to Team", + "Create_New": "Create New", + "Add_Existing": "Add Existing" } diff --git a/app/stacks/InsideStack.js b/app/stacks/InsideStack.js index bda56f0d2..9052b1310 100644 --- a/app/stacks/InsideStack.js +++ b/app/stacks/InsideStack.js @@ -71,6 +71,7 @@ import ShareView from '../views/ShareView'; import CreateDiscussionView from '../views/CreateDiscussionView'; import QueueListView from '../ee/omnichannel/views/QueueListView'; +import AddChannelTeamView from '../views/AddChannelTeamView'; // ChatsStackNavigator const ChatsStack = createStackNavigator(); @@ -174,6 +175,11 @@ const ChatsStackNavigator = () => { component={TeamChannelsView} options={TeamChannelsView.navigationOptions} /> + { + const { navigation, isMasterDetail, theme } = this.props; + + const options = { + headerShown: true, + headerTitleAlign: 'center', + headerTitle: () => ( + + ) + }; + + if (isMasterDetail) { + options.headerLeft = () => ; + } else { + options.headerLeft = () => ( + navigation.pop()} + tintColor={themes[theme].headerTintColor} + /> + ); + } + + navigation.setOptions(options); + } + + renderButton = ({ + onPress, testID, title, icon, first + }) => { + const { theme } = this.props; + + return ( + onPress()} + style={{ backgroundColor: themes[theme].backgroundColor }} + testID={testID} + theme={theme} + > + + + {title} + + + ); + } + + render() { + const { navigation } = this.props; + + return ( + + + + {this.renderButton({ + onPress: navigation.navigate('NewMessageStackNavigator', { screen: 'CreateChannelView', isTeam: false }), + title: I18n.t('Create_New'), + icon: 'channel-public', + testID: 'add-channel-team-view-create-channel', + first: true + })} + {this.renderButton({ + // onPress: navigation.navigate('AddExistingChannelView'), + title: I18n.t('Add_Existing'), + icon: 'team', + testID: 'add-channel-team-view-create-channel' + })} + + + ); + } +} + +AddChannelTeamView.propTypes = { + route: PropTypes.object, + navigation: PropTypes.object, + isMasterDetail: PropTypes.bool, + theme: PropTypes.string +}; + +export default withDimensions(withTheme(AddChannelTeamView)); diff --git a/app/views/TeamChannelsView.js b/app/views/TeamChannelsView.js index 15724ab5c..83c206298 100644 --- a/app/views/TeamChannelsView.js +++ b/app/views/TeamChannelsView.js @@ -146,7 +146,7 @@ class TeamChannelsView extends React.Component { return; } - const headerTitlePosition = getHeaderTitlePosition({ insets, numIconsRight: 1 }); + const headerTitlePosition = getHeaderTitlePosition({ insets, numIconsRight: 2 }); if (isSearching) { return { @@ -201,6 +201,7 @@ class TeamChannelsView extends React.Component { options.headerRight = () => ( + navigation.navigate('AddChannelTeamView')} /> ); return options;