Added AddChannelTeamView
This commit is contained in:
parent
69214bee93
commit
0cf173d7ba
|
@ -716,5 +716,8 @@
|
||||||
"Read_Only_Team": "Read Only Team",
|
"Read_Only_Team": "Read Only Team",
|
||||||
"Broadcast_Team": "Broadcast Team",
|
"Broadcast_Team": "Broadcast Team",
|
||||||
"creating_team" : "creating 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"
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ import ShareView from '../views/ShareView';
|
||||||
import CreateDiscussionView from '../views/CreateDiscussionView';
|
import CreateDiscussionView from '../views/CreateDiscussionView';
|
||||||
|
|
||||||
import QueueListView from '../ee/omnichannel/views/QueueListView';
|
import QueueListView from '../ee/omnichannel/views/QueueListView';
|
||||||
|
import AddChannelTeamView from '../views/AddChannelTeamView';
|
||||||
|
|
||||||
// ChatsStackNavigator
|
// ChatsStackNavigator
|
||||||
const ChatsStack = createStackNavigator();
|
const ChatsStack = createStackNavigator();
|
||||||
|
@ -174,6 +175,11 @@ const ChatsStackNavigator = () => {
|
||||||
component={TeamChannelsView}
|
component={TeamChannelsView}
|
||||||
options={TeamChannelsView.navigationOptions}
|
options={TeamChannelsView.navigationOptions}
|
||||||
/>
|
/>
|
||||||
|
<ChatsStack.Screen
|
||||||
|
name='AddChannelTeamView'
|
||||||
|
component={AddChannelTeamView}
|
||||||
|
options={AddChannelTeamView.navigationOptions}
|
||||||
|
/>
|
||||||
<ChatsStack.Screen
|
<ChatsStack.Screen
|
||||||
name='MarkdownTableView'
|
name='MarkdownTableView'
|
||||||
component={MarkdownTableView}
|
component={MarkdownTableView}
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
import React from 'react';
|
||||||
|
import { View, Text, StyleSheet } from 'react-native';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { HeaderBackButton } from '@react-navigation/stack';
|
||||||
|
|
||||||
|
import sharedStyles from './Styles';
|
||||||
|
import { CustomIcon } from '../lib/Icons';
|
||||||
|
import Touch from '../utils/touch';
|
||||||
|
import StatusBar from '../containers/StatusBar';
|
||||||
|
import RoomHeader from '../containers/RoomHeader';
|
||||||
|
import { withTheme } from '../theme';
|
||||||
|
import * as HeaderButton from '../containers/HeaderButton';
|
||||||
|
import SafeAreaView from '../containers/SafeAreaView';
|
||||||
|
import { withDimensions } from '../dimensions';
|
||||||
|
import { themes } from '../constants/colors';
|
||||||
|
import I18n from '../i18n';
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
button: {
|
||||||
|
height: 46,
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center'
|
||||||
|
},
|
||||||
|
buttonIcon: {
|
||||||
|
marginLeft: 18,
|
||||||
|
marginRight: 16
|
||||||
|
},
|
||||||
|
buttonText: {
|
||||||
|
fontSize: 17,
|
||||||
|
...sharedStyles.textRegular
|
||||||
|
},
|
||||||
|
buttonContainer: {
|
||||||
|
paddingVertical: 25
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
class AddChannelTeamView extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.teamId = props.route.params?.teamId;
|
||||||
|
this.setHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
setHeader = () => {
|
||||||
|
const { navigation, isMasterDetail, theme } = this.props;
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
headerShown: true,
|
||||||
|
headerTitleAlign: 'center',
|
||||||
|
headerTitle: () => (
|
||||||
|
<RoomHeader title={I18n.t('Add_Channel_to_Team')} />
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isMasterDetail) {
|
||||||
|
options.headerLeft = () => <HeaderButton.CloseModal navigation={navigation} />;
|
||||||
|
} else {
|
||||||
|
options.headerLeft = () => (
|
||||||
|
<HeaderBackButton
|
||||||
|
labelVisible={false}
|
||||||
|
onPress={() => navigation.pop()}
|
||||||
|
tintColor={themes[theme].headerTintColor}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
navigation.setOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderButton = ({
|
||||||
|
onPress, testID, title, icon, first
|
||||||
|
}) => {
|
||||||
|
const { theme } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Touch
|
||||||
|
onPress={() => onPress()}
|
||||||
|
style={{ backgroundColor: themes[theme].backgroundColor }}
|
||||||
|
testID={testID}
|
||||||
|
theme={theme}
|
||||||
|
>
|
||||||
|
<View style={[first ? sharedStyles.separatorVertical : sharedStyles.separatorBottom, styles.button, { borderColor: themes[theme].separatorColor }]}>
|
||||||
|
<CustomIcon style={[styles.buttonIcon, { color: themes[theme].tintColor }]} size={24} name={icon} />
|
||||||
|
<Text style={[styles.buttonText, { color: themes[theme].tintColor }]}>{title}</Text>
|
||||||
|
</View>
|
||||||
|
</Touch>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { navigation } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SafeAreaView testID='add-channel-team-view'>
|
||||||
|
<StatusBar />
|
||||||
|
<View style={styles.buttonContainer}>
|
||||||
|
{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'
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
</SafeAreaView>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AddChannelTeamView.propTypes = {
|
||||||
|
route: PropTypes.object,
|
||||||
|
navigation: PropTypes.object,
|
||||||
|
isMasterDetail: PropTypes.bool,
|
||||||
|
theme: PropTypes.string
|
||||||
|
};
|
||||||
|
|
||||||
|
export default withDimensions(withTheme(AddChannelTeamView));
|
|
@ -146,7 +146,7 @@ class TeamChannelsView extends React.Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const headerTitlePosition = getHeaderTitlePosition({ insets, numIconsRight: 1 });
|
const headerTitlePosition = getHeaderTitlePosition({ insets, numIconsRight: 2 });
|
||||||
|
|
||||||
if (isSearching) {
|
if (isSearching) {
|
||||||
return {
|
return {
|
||||||
|
@ -201,6 +201,7 @@ class TeamChannelsView extends React.Component {
|
||||||
options.headerRight = () => (
|
options.headerRight = () => (
|
||||||
<HeaderButton.Container>
|
<HeaderButton.Container>
|
||||||
<HeaderButton.Item iconName='search' onPress={this.onSearchPress} />
|
<HeaderButton.Item iconName='search' onPress={this.onSearchPress} />
|
||||||
|
<HeaderButton.Item iconName='create' onPress={() => navigation.navigate('AddChannelTeamView')} />
|
||||||
</HeaderButton.Container>
|
</HeaderButton.Container>
|
||||||
);
|
);
|
||||||
return options;
|
return options;
|
||||||
|
|
Loading…
Reference in New Issue