@plusscommunities/pluss-circles-app-groups 1.2.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/actions/ChatActions.js +81 -0
- package/dist/module/actions/ChatActions.js.map +1 -0
- package/dist/module/actions/GroupActions.js +335 -0
- package/dist/module/actions/GroupActions.js.map +1 -0
- package/dist/module/actions/index.js +41 -0
- package/dist/module/actions/index.js.map +1 -0
- package/dist/module/actions/types.js +26 -0
- package/dist/module/actions/types.js.map +1 -0
- package/dist/module/assets/fonts.js +3 -0
- package/dist/module/assets/fonts.js.map +1 -0
- package/dist/module/components/chat/Chat.js +613 -0
- package/dist/module/components/chat/Chat.js.map +1 -0
- package/dist/module/components/chat/ChatList.js +557 -0
- package/dist/module/components/chat/ChatList.js.map +1 -0
- package/dist/module/components/chat/ContactsList.js +204 -0
- package/dist/module/components/chat/ContactsList.js.map +1 -0
- package/dist/module/components/chat/KioskPeoplePage.js +345 -0
- package/dist/module/components/chat/KioskPeoplePage.js.map +1 -0
- package/dist/module/components/chat/PeopleContainer.js +24 -0
- package/dist/module/components/chat/PeopleContainer.js.map +1 -0
- package/dist/module/components/chat/PeoplePage.js +438 -0
- package/dist/module/components/chat/PeoplePage.js.map +1 -0
- package/dist/module/components/common/index.js +26 -0
- package/dist/module/components/common/index.js.map +1 -0
- package/dist/module/components/events/EventInvitePopup.js +563 -0
- package/dist/module/components/events/EventInvitePopup.js.map +1 -0
- package/dist/module/components/groups/EditGroup.js +548 -0
- package/dist/module/components/groups/EditGroup.js.map +1 -0
- package/dist/module/components/groups/GroupDetails.js +388 -0
- package/dist/module/components/groups/GroupDetails.js.map +1 -0
- package/dist/module/components/groups/GroupsList.js +111 -0
- package/dist/module/components/groups/GroupsList.js.map +1 -0
- package/dist/module/components/groups/GroupsWidget.js +150 -0
- package/dist/module/components/groups/GroupsWidget.js.map +1 -0
- package/dist/module/components/groups/NewGroup.js +703 -0
- package/dist/module/components/groups/NewGroup.js.map +1 -0
- package/dist/module/components/groups/PublicGroup.js +131 -0
- package/dist/module/components/groups/PublicGroup.js.map +1 -0
- package/dist/module/components/groups/PublicGroupAction.js +296 -0
- package/dist/module/components/groups/PublicGroupAction.js.map +1 -0
- package/dist/module/components/notifications/GroupInvite.js +166 -0
- package/dist/module/components/notifications/GroupInvite.js.map +1 -0
- package/dist/module/components/notifications/GroupInviteAction.js +338 -0
- package/dist/module/components/notifications/GroupInviteAction.js.map +1 -0
- package/dist/module/components/notifications/GroupMessage.js +131 -0
- package/dist/module/components/notifications/GroupMessage.js.map +1 -0
- package/dist/module/components/takeover/TakeoverBackground.js +27 -0
- package/dist/module/components/takeover/TakeoverBackground.js.map +1 -0
- package/dist/module/config/index.js +9 -0
- package/dist/module/config/index.js.map +1 -0
- package/dist/module/core.config.js +17 -0
- package/dist/module/core.config.js.map +1 -0
- package/dist/module/feature.config.js +266 -0
- package/dist/module/feature.config.js.map +1 -0
- package/dist/module/index.js +27 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/js/Colors.js +17 -0
- package/dist/module/js/Colors.js.map +1 -0
- package/dist/module/js/NavigationService.js +8 -0
- package/dist/module/js/NavigationService.js.map +1 -0
- package/dist/module/js/Styles.js +3 -0
- package/dist/module/js/Styles.js.map +1 -0
- package/dist/module/js/circles/MapStateToDirectMessages.js +11 -0
- package/dist/module/js/circles/MapStateToDirectMessages.js.map +1 -0
- package/dist/module/js/index.js +21 -0
- package/dist/module/js/index.js.map +1 -0
- package/dist/module/reducers/ChatsReducer.js +82 -0
- package/dist/module/reducers/ChatsReducer.js.map +1 -0
- package/dist/module/reducers/GroupsReducer.js +174 -0
- package/dist/module/reducers/GroupsReducer.js.map +1 -0
- package/dist/module/reducers/reducerKeys.js +4 -0
- package/dist/module/reducers/reducerKeys.js.map +1 -0
- package/dist/module/values.config.default.js +33 -0
- package/dist/module/values.config.default.js.map +1 -0
- package/dist/module/values.config.groups.js +33 -0
- package/dist/module/values.config.groups.js.map +1 -0
- package/dist/module/values.config.js +33 -0
- package/dist/module/values.config.js.map +1 -0
- package/dist/module/webapi/circleActions.js +127 -0
- package/dist/module/webapi/circleActions.js.map +1 -0
- package/dist/module/webapi/helper.js +4 -0
- package/dist/module/webapi/helper.js.map +1 -0
- package/dist/module/webapi/index.js +7 -0
- package/dist/module/webapi/index.js.map +1 -0
- package/dist/module/webapi/messageActions.js +45 -0
- package/dist/module/webapi/messageActions.js.map +1 -0
- package/package.json +55 -0
- package/src/actions/ChatActions.js +92 -0
- package/src/actions/GroupActions.js +368 -0
- package/src/actions/index.js +43 -0
- package/src/actions/types.js +29 -0
- package/src/assets/fonts.js +3 -0
- package/src/components/chat/Chat.js +568 -0
- package/src/components/chat/ChatList.js +491 -0
- package/src/components/chat/ContactsList.js +168 -0
- package/src/components/chat/KioskPeoplePage.js +317 -0
- package/src/components/chat/PeopleContainer.js +21 -0
- package/src/components/chat/PeoplePage.js +418 -0
- package/src/components/common/index.js +26 -0
- package/src/components/events/EventInvitePopup.js +508 -0
- package/src/components/groups/EditGroup.js +486 -0
- package/src/components/groups/GroupDetails.js +335 -0
- package/src/components/groups/GroupsList.js +93 -0
- package/src/components/groups/GroupsWidget.js +134 -0
- package/src/components/groups/NewGroup.js +650 -0
- package/src/components/groups/PublicGroup.js +116 -0
- package/src/components/groups/PublicGroupAction.js +266 -0
- package/src/components/notifications/GroupInvite.js +154 -0
- package/src/components/notifications/GroupInviteAction.js +295 -0
- package/src/components/notifications/GroupMessage.js +114 -0
- package/src/components/takeover/TakeoverBackground.js +26 -0
- package/src/config/index.js +9 -0
- package/src/core.config.js +5 -0
- package/src/feature.config.js +274 -0
- package/src/index.js +24 -0
- package/src/js/Colors.js +17 -0
- package/src/js/NavigationService.js +9 -0
- package/src/js/Styles.js +3 -0
- package/src/js/circles/MapStateToDirectMessages.js +10 -0
- package/src/js/index.js +24 -0
- package/src/reducers/ChatsReducer.js +63 -0
- package/src/reducers/GroupsReducer.js +142 -0
- package/src/reducers/reducerKeys.js +4 -0
- package/src/values.config.default.js +39 -0
- package/src/values.config.groups.js +39 -0
- package/src/values.config.js +39 -0
- package/src/webapi/circleActions.js +104 -0
- package/src/webapi/helper.js +4 -0
- package/src/webapi/index.js +8 -0
- package/src/webapi/messageActions.js +39 -0
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import { Dimensions, ImageBackground, Text, ScrollView, TouchableOpacity, View, KeyboardAvoidingView, Platform } from 'react-native';
|
|
5
|
+
import { Icon } from 'react-native-elements';
|
|
6
|
+
import {
|
|
7
|
+
ProfilePic,
|
|
8
|
+
FormCard,
|
|
9
|
+
FormCardSection,
|
|
10
|
+
Header,
|
|
11
|
+
Input,
|
|
12
|
+
Spinner,
|
|
13
|
+
ImageUploader,
|
|
14
|
+
InlineButton,
|
|
15
|
+
StickyFooter,
|
|
16
|
+
Toggle,
|
|
17
|
+
} from '../common';
|
|
18
|
+
import { TEXT_DARK, LINEGREY, COLOUR_TEAL, getMainBrandingColourFromState } from '../../js/Colors';
|
|
19
|
+
import stylez from '../../js/Styles';
|
|
20
|
+
import NavigationService from '../../js/NavigationService';
|
|
21
|
+
import { COLOUR_PURPLE, COLOUR_TANGERINE, TEXT_LIGHT, getSite, getSiteSettingFromState } from '../../js/index';
|
|
22
|
+
import { createGroup } from '../../actions';
|
|
23
|
+
import EventInvitePopup from '../events/EventInvitePopup';
|
|
24
|
+
import { circleActions } from '../../webapi';
|
|
25
|
+
import { values } from '../../values.config';
|
|
26
|
+
|
|
27
|
+
const PHOTO_WIDTH = Dimensions.get('window').width - 48;
|
|
28
|
+
const PHOTO_HEIGHT = Dimensions.get('window').width > 600 ? PHOTO_WIDTH * 0.6 : PHOTO_WIDTH * 0.8;
|
|
29
|
+
|
|
30
|
+
class NewGroup extends Component {
|
|
31
|
+
constructor(props) {
|
|
32
|
+
super(props);
|
|
33
|
+
|
|
34
|
+
this.state = {
|
|
35
|
+
title: '',
|
|
36
|
+
|
|
37
|
+
submittingGroup: false,
|
|
38
|
+
groupImage: null,
|
|
39
|
+
|
|
40
|
+
selected: [],
|
|
41
|
+
|
|
42
|
+
visibility: 'private',
|
|
43
|
+
|
|
44
|
+
inviteOpen: false,
|
|
45
|
+
|
|
46
|
+
page: 2,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
this.visibilityOptions = [
|
|
50
|
+
{
|
|
51
|
+
text: `Public ${values.entityName}`,
|
|
52
|
+
val: 'public',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
text: `Private ${values.entityName}`,
|
|
56
|
+
val: 'private',
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
onPressBack() {
|
|
62
|
+
NavigationService.goBack();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
onSubmitSend() {
|
|
66
|
+
if (!this.props.connected) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (this.state.submittingGroup) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
this.setState({ submittingGroup: true });
|
|
74
|
+
|
|
75
|
+
const audience = [
|
|
76
|
+
{
|
|
77
|
+
userId: this.props.user.uid,
|
|
78
|
+
profilePic: this.props.user.profilePic,
|
|
79
|
+
displayName: this.props.user.displayName,
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
if (this.state.selected.length > 0) {
|
|
83
|
+
this.state.selected.forEach(user => {
|
|
84
|
+
audience.push({
|
|
85
|
+
userId: user.userId,
|
|
86
|
+
displayName: user.displayName,
|
|
87
|
+
profilePic: user.profilePic,
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
circleActions
|
|
93
|
+
.add(getSite(this.props.user.site), this.state.title, this.state.groupImage, audience, this.state.visibility === 'public')
|
|
94
|
+
.then(res => {
|
|
95
|
+
if (this.props.onSubmissionSuccess) this.props.onSubmissionSuccess(res.data);
|
|
96
|
+
this.props.createGroup(res.data);
|
|
97
|
+
NavigationService.navigate(values.screenCircleChat, {
|
|
98
|
+
chat: res.data,
|
|
99
|
+
new: true,
|
|
100
|
+
back: values.screenCircleChatList,
|
|
101
|
+
});
|
|
102
|
+
})
|
|
103
|
+
.catch(err => {
|
|
104
|
+
console.log('Circle creation error');
|
|
105
|
+
console.log(err);
|
|
106
|
+
this.setState({ submittingGroup: false });
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
onPressToggle(option) {
|
|
111
|
+
this.setState({
|
|
112
|
+
visibility: option.val,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
onChangeTitle(value) {
|
|
117
|
+
this.setState({ title: value });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
onUploadStarted = () => {
|
|
121
|
+
this.setState({
|
|
122
|
+
uploadingImage: true,
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
onUploadSuccess = uri => {
|
|
127
|
+
this.setState({
|
|
128
|
+
uploadingImage: false,
|
|
129
|
+
groupImage: uri.replace('/general/', '/general1400/'),
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
onUploadFailed = () => {
|
|
134
|
+
this.setState({
|
|
135
|
+
uploadingImage: false,
|
|
136
|
+
groupImage: null,
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
addToAudience(user) {
|
|
141
|
+
const newSelected = [...this.state.selected];
|
|
142
|
+
newSelected.push(user);
|
|
143
|
+
|
|
144
|
+
this.setState({ selected: newSelected });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
removeFromAudience(user) {
|
|
148
|
+
let newSelected = [...this.state.selected];
|
|
149
|
+
newSelected = _.filter(newSelected, item => {
|
|
150
|
+
return item.userId !== user.userId;
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
this.setState({ selected: newSelected });
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
closeInvitePopup() {
|
|
157
|
+
this.setState({
|
|
158
|
+
inviteOpen: false,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
openInvite() {
|
|
163
|
+
this.setState({ inviteOpen: true });
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
nextPage() {
|
|
167
|
+
this.setState({ page: 2, title: this.state.title });
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
clickCreate() {
|
|
171
|
+
if (this.state.title.length < 1) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (this.state.uploadingImage) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
this.onSubmitSend();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
showUploadMenu() {
|
|
181
|
+
if (this.state.uploadingImage || this.state.submittingGroup) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this.imageUploader.showUploadMenu();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
renderInvitePopup() {
|
|
188
|
+
return (
|
|
189
|
+
<EventInvitePopup
|
|
190
|
+
isNewEvent
|
|
191
|
+
onNewEventInvite={this.addToAudience.bind(this)}
|
|
192
|
+
onNewEventRemove={this.removeFromAudience.bind(this)}
|
|
193
|
+
isSearchable
|
|
194
|
+
invited={this.state.selected}
|
|
195
|
+
visible={this.state.inviteOpen}
|
|
196
|
+
onClose={this.closeInvitePopup.bind(this)}
|
|
197
|
+
inviteText="Add"
|
|
198
|
+
invitedText="Remove"
|
|
199
|
+
/>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
renderUploadMenu() {
|
|
204
|
+
return (
|
|
205
|
+
<ImageUploader
|
|
206
|
+
ref={ref => (this.imageUploader = ref)}
|
|
207
|
+
onUploadStarted={this.onUploadStarted}
|
|
208
|
+
onUploadSuccess={this.onUploadSuccess}
|
|
209
|
+
onUploadFailed={this.onUploadFailed}
|
|
210
|
+
onLibrarySelected={this.onUploadSuccess}
|
|
211
|
+
size={{ width: 700 }}
|
|
212
|
+
quality={0.8}
|
|
213
|
+
fileName="groupImage"
|
|
214
|
+
popupTitle={`Add ${_.capitalize(values.entityName)} Cover Image`}
|
|
215
|
+
/>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
renderInnerImage() {
|
|
220
|
+
if (!this.state.uploadingImage && this.state.groupImage === null) {
|
|
221
|
+
return (
|
|
222
|
+
<View>
|
|
223
|
+
<Icon name="camera" type="font-awesome" iconStyle={{ color: TEXT_LIGHT, fontSize: 20, marginBottom: 13 }} />
|
|
224
|
+
<Text style={{ fontSize: 13, fontFamily: 'sf-regular', color: TEXT_LIGHT }}>Upload {values.entityName} image</Text>
|
|
225
|
+
</View>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
return this.renderImage();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
renderImage() {
|
|
232
|
+
if (this.state.uploadingImage) {
|
|
233
|
+
return <Spinner />;
|
|
234
|
+
}
|
|
235
|
+
if (this.state.groupImage) {
|
|
236
|
+
return (
|
|
237
|
+
<ImageBackground
|
|
238
|
+
style={{ flex: 1, height: '100%', width: '100%', borderRadius: 4, justifyContent: 'center', alignContent: 'center' }}
|
|
239
|
+
imageStyle={{ borderRadius: 4 }}
|
|
240
|
+
source={{ uri: this.state.groupImage }}
|
|
241
|
+
>
|
|
242
|
+
<View>
|
|
243
|
+
<Icon name="camera" type="font-awesome" iconStyle={{ color: '#fff', fontSize: 20, marginBottom: 13 }} />
|
|
244
|
+
<Text style={{ fontSize: 13, fontFamily: 'sf-regular', color: '#fff', textAlign: 'center' }}>
|
|
245
|
+
Upload {values.entityName} image
|
|
246
|
+
</Text>
|
|
247
|
+
</View>
|
|
248
|
+
</ImageBackground>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
renderPage() {
|
|
255
|
+
return this.renderForm();
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
renderVisibilityToggle() {
|
|
259
|
+
if (!this.props.circleAllowPublicCircles) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
if (this.props.user.category === 'family') {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
return (
|
|
266
|
+
<View style={styles.toggleContainer}>
|
|
267
|
+
<Toggle options={this.visibilityOptions} onPress={this.onPressToggle.bind(this)} activeVal={this.state.visibility} />
|
|
268
|
+
</View>
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
renderTitleEntry() {
|
|
273
|
+
return (
|
|
274
|
+
<View style={styles.container}>
|
|
275
|
+
<ScrollView style={styles.container} keyboardShouldPersistTaps="handled">
|
|
276
|
+
<View style={{ paddingHorizontal: 24, paddingBottom: 10, paddingTop: 20 }}>
|
|
277
|
+
<Input
|
|
278
|
+
autoFocus
|
|
279
|
+
label={this.state.title.length > 0 ? `${_.capitalize(values.entityName)} name` : ' '}
|
|
280
|
+
labelStyle={{ fontSize: 13, color: '#fff' }}
|
|
281
|
+
placeholder={`${_.capitalize(values.entityName)} name`}
|
|
282
|
+
placeholderTextColor="rgba(255,255,255,0.5)"
|
|
283
|
+
value={this.state.title}
|
|
284
|
+
onChangeText={value => {
|
|
285
|
+
this.onChangeTitle(value);
|
|
286
|
+
}}
|
|
287
|
+
textStyle={{ marginTop: 10, fontSize: 28, color: '#fff', fontFamily: 'sf-semibold' }}
|
|
288
|
+
/>
|
|
289
|
+
</View>
|
|
290
|
+
</ScrollView>
|
|
291
|
+
{this.state.title.length > 0 && (
|
|
292
|
+
<View style={[styles.footer, { paddingBottom: 16 }]}>
|
|
293
|
+
<InlineButton
|
|
294
|
+
color="#fff"
|
|
295
|
+
textStyle={{ color: this.props.colourBrandingMain }}
|
|
296
|
+
onPress={this.nextPage.bind(this)}
|
|
297
|
+
touchableStyle={styles.footerButton}
|
|
298
|
+
style={{ height: 50 }}
|
|
299
|
+
fillTouchable
|
|
300
|
+
large
|
|
301
|
+
>
|
|
302
|
+
Create {values.entityName}
|
|
303
|
+
</InlineButton>
|
|
304
|
+
</View>
|
|
305
|
+
)}
|
|
306
|
+
</View>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
renderForm() {
|
|
311
|
+
return (
|
|
312
|
+
<ScrollView style={[styles.container, styles.greyContainer]} keyboardShouldPersistTaps="handled">
|
|
313
|
+
{this.state.submittingGroup && (
|
|
314
|
+
<View style={{ marginTop: 16 }}>
|
|
315
|
+
<Spinner size="small" />
|
|
316
|
+
</View>
|
|
317
|
+
)}
|
|
318
|
+
{this.renderVisibilityToggle()}
|
|
319
|
+
<FormCard style={{ marginTop: 16 }}>
|
|
320
|
+
<FormCardSection
|
|
321
|
+
label={`${_.capitalize(values.entityName)} name`}
|
|
322
|
+
placeholder={`${_.capitalize(values.entityName)} name`}
|
|
323
|
+
textValue={this.state.title}
|
|
324
|
+
onChangeText={value => {
|
|
325
|
+
this.onChangeTitle(value);
|
|
326
|
+
}}
|
|
327
|
+
editable={this.state.submittingGroup === false}
|
|
328
|
+
isValid={() => {
|
|
329
|
+
return this.state.title.length > 1;
|
|
330
|
+
}}
|
|
331
|
+
required
|
|
332
|
+
/>
|
|
333
|
+
</FormCard>
|
|
334
|
+
<View style={{ padding: 24 }}>
|
|
335
|
+
<TouchableOpacity activeOpacity={0.8} onPress={this.showUploadMenu.bind(this)}>
|
|
336
|
+
<View style={styles.imageContainer}>{this.renderInnerImage()}</View>
|
|
337
|
+
</TouchableOpacity>
|
|
338
|
+
</View>
|
|
339
|
+
</ScrollView>
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
renderPreviewAtts() {
|
|
344
|
+
return (
|
|
345
|
+
<View style={styles.attendeePreviews}>
|
|
346
|
+
{this.state.selected.map((user, index) => {
|
|
347
|
+
if (index < 3) {
|
|
348
|
+
return (
|
|
349
|
+
<ProfilePic ProfilePic={user.profilePic} Diameter={36} style={[styles.profilePic, { left: index * -20 }]} key={user.userId} />
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
return null;
|
|
353
|
+
})}
|
|
354
|
+
</View>
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
renderInviteButton() {
|
|
359
|
+
if (this.state.selected.length === 0) {
|
|
360
|
+
return (
|
|
361
|
+
<InlineButton
|
|
362
|
+
color={this.props.colourBrandingMain}
|
|
363
|
+
onPress={this.openInvite.bind(this)}
|
|
364
|
+
touchableStyle={styles.footerButton}
|
|
365
|
+
fillTouchable
|
|
366
|
+
large
|
|
367
|
+
>
|
|
368
|
+
Select members
|
|
369
|
+
</InlineButton>
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
return (
|
|
373
|
+
<View style={{ flexDirection: 'row' }}>
|
|
374
|
+
{this.renderPreviewAtts()}
|
|
375
|
+
<View style={styles.fill}>
|
|
376
|
+
<InlineButton onPress={this.openInvite.bind(this)} style={styles.inviteButton} color={this.props.colourBrandingMain} large>
|
|
377
|
+
Select members
|
|
378
|
+
</InlineButton>
|
|
379
|
+
<Text style={styles.tix}>
|
|
380
|
+
<Text>{this.state.selected.length}</Text>
|
|
381
|
+
{' selected'}
|
|
382
|
+
</Text>
|
|
383
|
+
</View>
|
|
384
|
+
</View>
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
render() {
|
|
389
|
+
return (
|
|
390
|
+
<KeyboardAvoidingView behavior={Platform.OS === 'ios' && 'padding'} style={styles.viewContainer}>
|
|
391
|
+
{this.renderUploadMenu()}
|
|
392
|
+
<View style={[stylez.genericPageContainer, this.state.page === 1 && { backgroundColor: this.props.colourBrandingMain }]}>
|
|
393
|
+
<Header
|
|
394
|
+
leftIcon="close"
|
|
395
|
+
leftIconType="pluss"
|
|
396
|
+
leftText={this.state.page !== 1 && 'Cancel'}
|
|
397
|
+
leftIconStyle={this.state.page !== 1 && { color: this.props.colourBrandingMain }}
|
|
398
|
+
onPressLeft={this.onPressBack.bind(this)}
|
|
399
|
+
rightText={this.state.page !== 1 && 'Done'}
|
|
400
|
+
onPressRight={this.clickCreate.bind(this)}
|
|
401
|
+
optionalRightStyle={this.state.submittingGroup && { opacity: 0.2 }}
|
|
402
|
+
text={this.state.page === 1 ? `Create a ${values.entityName}` : this.state.title.length > 1 ? this.state.title : ' '}
|
|
403
|
+
style={this.state.page === 1 && { backgroundColor: this.props.colourBrandingMain, ...styles.page1Header }}
|
|
404
|
+
textColour={this.state.page === 1 && '#fff'}
|
|
405
|
+
/>
|
|
406
|
+
{this.renderPage()}
|
|
407
|
+
|
|
408
|
+
{this.state.page === 2 && <StickyFooter style={styles.footer}>{this.renderInviteButton()}</StickyFooter>}
|
|
409
|
+
</View>
|
|
410
|
+
|
|
411
|
+
{this.renderInvitePopup()}
|
|
412
|
+
</KeyboardAvoidingView>
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const styles = {
|
|
418
|
+
footer: {
|
|
419
|
+
paddingHorizontal: 16,
|
|
420
|
+
flexDirection: 'row',
|
|
421
|
+
alignItems: 'center',
|
|
422
|
+
},
|
|
423
|
+
footerButton: {
|
|
424
|
+
flex: 1,
|
|
425
|
+
},
|
|
426
|
+
inviteButton: {
|
|
427
|
+
height: 36,
|
|
428
|
+
width: 120,
|
|
429
|
+
justifyContent: 'center',
|
|
430
|
+
alignItems: 'center',
|
|
431
|
+
borderRadius: 5,
|
|
432
|
+
marginLeft: 10,
|
|
433
|
+
},
|
|
434
|
+
inviteButtonText: {
|
|
435
|
+
color: '#fff',
|
|
436
|
+
fontFamily: 'sf-semibold',
|
|
437
|
+
fontSize: 15,
|
|
438
|
+
},
|
|
439
|
+
profilePic: {
|
|
440
|
+
borderWidth: 1,
|
|
441
|
+
borderColor: '#fff',
|
|
442
|
+
},
|
|
443
|
+
fill: {
|
|
444
|
+
flex: 1,
|
|
445
|
+
flexDirection: 'row-reverse',
|
|
446
|
+
},
|
|
447
|
+
attendeePreviews: {
|
|
448
|
+
width: 90,
|
|
449
|
+
height: 36,
|
|
450
|
+
flexDirection: 'row',
|
|
451
|
+
},
|
|
452
|
+
viewContainer: {
|
|
453
|
+
flex: 1,
|
|
454
|
+
backgroundColor: '#fff',
|
|
455
|
+
},
|
|
456
|
+
container: {
|
|
457
|
+
flex: 1,
|
|
458
|
+
position: 'relative',
|
|
459
|
+
},
|
|
460
|
+
greyContainer: {
|
|
461
|
+
backgroundColor: '#f0f0f5',
|
|
462
|
+
},
|
|
463
|
+
section: {
|
|
464
|
+
backgroundColor: '#fff',
|
|
465
|
+
marginTop: 16,
|
|
466
|
+
paddingHorizontal: 24,
|
|
467
|
+
elevation: 1,
|
|
468
|
+
},
|
|
469
|
+
sectionItem: {
|
|
470
|
+
paddingVertical: 16,
|
|
471
|
+
},
|
|
472
|
+
sectionItemUnderline: {
|
|
473
|
+
borderBottomWidth: 1,
|
|
474
|
+
borderBottomColor: LINEGREY,
|
|
475
|
+
},
|
|
476
|
+
errorDot: {
|
|
477
|
+
height: 5,
|
|
478
|
+
width: 5,
|
|
479
|
+
borderRadius: 3,
|
|
480
|
+
backgroundColor: COLOUR_TEAL,
|
|
481
|
+
alignSelf: 'center',
|
|
482
|
+
},
|
|
483
|
+
inputView: {
|
|
484
|
+
width: '100%',
|
|
485
|
+
marginBottom: 5,
|
|
486
|
+
},
|
|
487
|
+
labelStyle: {
|
|
488
|
+
fontSize: 15,
|
|
489
|
+
backgroundColor: 'transparent',
|
|
490
|
+
fontFamily: 'sf-semibold',
|
|
491
|
+
color: TEXT_DARK,
|
|
492
|
+
},
|
|
493
|
+
buttonText: {
|
|
494
|
+
textAlign: 'center',
|
|
495
|
+
fontFamily: 'sf-bold',
|
|
496
|
+
fontSize: 17,
|
|
497
|
+
color: 'white',
|
|
498
|
+
borderRadius: 5,
|
|
499
|
+
},
|
|
500
|
+
uploadButton: {
|
|
501
|
+
width: '100%',
|
|
502
|
+
//height: 150,
|
|
503
|
+
alignContent: 'center',
|
|
504
|
+
position: 'absolute',
|
|
505
|
+
flexDirection: 'row',
|
|
506
|
+
justifyContent: 'center',
|
|
507
|
+
top: 65,
|
|
508
|
+
},
|
|
509
|
+
uploadText: {
|
|
510
|
+
fontFamily: 'sf-regular',
|
|
511
|
+
fontSize: 16,
|
|
512
|
+
textAlign: 'center',
|
|
513
|
+
paddingVertical: 7,
|
|
514
|
+
backgroundColor: 'transparent',
|
|
515
|
+
paddingHorizontal: 20,
|
|
516
|
+
color: TEXT_DARK,
|
|
517
|
+
},
|
|
518
|
+
pageErrorText: {
|
|
519
|
+
backgroundColor: 'transparent',
|
|
520
|
+
color: COLOUR_TANGERINE,
|
|
521
|
+
fontSize: 18,
|
|
522
|
+
fontFamily: 'sf-regular',
|
|
523
|
+
marginTop: 0,
|
|
524
|
+
textAlign: 'center',
|
|
525
|
+
},
|
|
526
|
+
userPopupContainer: {
|
|
527
|
+
flex: 1,
|
|
528
|
+
backgroundColor: '#fff',
|
|
529
|
+
...Platform.select({
|
|
530
|
+
ios: {
|
|
531
|
+
paddingTop: 20,
|
|
532
|
+
},
|
|
533
|
+
}),
|
|
534
|
+
},
|
|
535
|
+
closeContainer: {
|
|
536
|
+
paddingRight: 20,
|
|
537
|
+
paddingTop: 10,
|
|
538
|
+
paddingLeft: 10,
|
|
539
|
+
paddingBottom: 10,
|
|
540
|
+
position: 'absolute',
|
|
541
|
+
right: 0,
|
|
542
|
+
top: 0,
|
|
543
|
+
borderRadius: 5,
|
|
544
|
+
zIndex: 2,
|
|
545
|
+
...Platform.select({
|
|
546
|
+
ios: {
|
|
547
|
+
paddingTop: 30,
|
|
548
|
+
},
|
|
549
|
+
}),
|
|
550
|
+
},
|
|
551
|
+
close: {
|
|
552
|
+
textShadowColor: 'rgba(0,0,0,0.3)',
|
|
553
|
+
textShadowOffset: {
|
|
554
|
+
width: 2,
|
|
555
|
+
height: 1,
|
|
556
|
+
},
|
|
557
|
+
textShadowRadius: 1,
|
|
558
|
+
},
|
|
559
|
+
listItem: {
|
|
560
|
+
paddingBottom: 10,
|
|
561
|
+
paddingHorizontal: 0,
|
|
562
|
+
justifyContent: 'flex-start',
|
|
563
|
+
flexDirection: 'row',
|
|
564
|
+
position: 'relative',
|
|
565
|
+
},
|
|
566
|
+
listItemTextContainer: {
|
|
567
|
+
flex: 1,
|
|
568
|
+
flexDirection: 'column',
|
|
569
|
+
justifyContent: 'space-around',
|
|
570
|
+
paddingLeft: 10,
|
|
571
|
+
},
|
|
572
|
+
searchingContactsContainer: {
|
|
573
|
+
flexDirection: 'row',
|
|
574
|
+
flexWrap: 'wrap',
|
|
575
|
+
alignItems: 'center',
|
|
576
|
+
paddingTop: 20,
|
|
577
|
+
},
|
|
578
|
+
searchingContactsInnerContainer: {
|
|
579
|
+
borderBottomWidth: 1,
|
|
580
|
+
borderBottomColor: '#ccc',
|
|
581
|
+
flexDirection: 'row',
|
|
582
|
+
flexWrap: 'wrap',
|
|
583
|
+
alignItems: 'center',
|
|
584
|
+
flex: 1,
|
|
585
|
+
},
|
|
586
|
+
searchingContacts: {
|
|
587
|
+
flex: 1,
|
|
588
|
+
fontSize: 16,
|
|
589
|
+
fontFamily: 'sf-regular',
|
|
590
|
+
minWidth: 100,
|
|
591
|
+
},
|
|
592
|
+
emptySearchingContacts: {
|
|
593
|
+
opacity: 0.5,
|
|
594
|
+
},
|
|
595
|
+
toText: {
|
|
596
|
+
fontFamily: 'sf-regular',
|
|
597
|
+
fontSize: 12,
|
|
598
|
+
color: TEXT_DARK,
|
|
599
|
+
opacity: 0.5,
|
|
600
|
+
marginRight: 10,
|
|
601
|
+
},
|
|
602
|
+
selectedContact: {
|
|
603
|
+
paddingTop: 10,
|
|
604
|
+
paddingRight: 5,
|
|
605
|
+
fontFamily: 'sf-bold',
|
|
606
|
+
fontSize: 16,
|
|
607
|
+
color: COLOUR_PURPLE,
|
|
608
|
+
},
|
|
609
|
+
page1Header: {
|
|
610
|
+
shadowColor: 'transparent',
|
|
611
|
+
shadowOffset: { width: 0, height: 0 },
|
|
612
|
+
shadowOpacity: 0,
|
|
613
|
+
elevation: 0,
|
|
614
|
+
},
|
|
615
|
+
imageContainer: {
|
|
616
|
+
width: PHOTO_WIDTH,
|
|
617
|
+
height: PHOTO_HEIGHT,
|
|
618
|
+
backgroundColor: '#fff',
|
|
619
|
+
borderStyle: 'dashed',
|
|
620
|
+
justifyContent: 'center',
|
|
621
|
+
alignItems: 'center',
|
|
622
|
+
borderWidth: 1,
|
|
623
|
+
borderColor: LINEGREY,
|
|
624
|
+
borderRadius: 4,
|
|
625
|
+
},
|
|
626
|
+
tix: {
|
|
627
|
+
fontFamily: 'sf-semibold',
|
|
628
|
+
color: TEXT_LIGHT,
|
|
629
|
+
fontSize: 14,
|
|
630
|
+
textAlign: 'center',
|
|
631
|
+
flex: 1,
|
|
632
|
+
alignSelf: 'center',
|
|
633
|
+
},
|
|
634
|
+
toggleContainer: {
|
|
635
|
+
paddingHorizontal: 16,
|
|
636
|
+
marginTop: 16,
|
|
637
|
+
},
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
const mapStateToProps = state => {
|
|
641
|
+
return {
|
|
642
|
+
connected: state.connection.connected,
|
|
643
|
+
user: state.user,
|
|
644
|
+
blockedUserKeys: state[values.reducerKeyChats].blockedUsers,
|
|
645
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
646
|
+
circleAllowPublicCircles: getSiteSettingFromState(state, values.allowPublicKey),
|
|
647
|
+
};
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
export default connect(mapStateToProps, { createGroup })(NewGroup);
|