@plusscommunities/pluss-core-app 1.0.7 → 1.1.2
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/assets/icons/reactions/heart.png +0 -0
- package/assets/icons/reactions/party.png +0 -0
- package/assets/icons/reactions/sad.png +0 -0
- package/assets/icons/reactions/smile.png +0 -0
- package/package.json +6 -2
- package/src/actions/FollowerActions.js +40 -0
- package/src/actions/ResidentActions.js +29 -0
- package/src/actions/UserActions.js +221 -0
- package/src/actions/index.js +3 -0
- package/src/actions/types.js +8 -0
- package/src/apis/analyticsActions.js +20 -0
- package/src/apis/contactActions.js +23 -0
- package/src/apis/eventActions.js +147 -0
- package/src/apis/followerActions.js +32 -0
- package/src/apis/index.js +5 -0
- package/src/apis/reactionActions.js +23 -23
- package/src/apis/userActions.js +98 -0
- package/src/colours.js +6 -6
- package/src/components/BackButton.js +57 -0
- package/src/components/CategoryTabs.js +182 -0
- package/src/components/DropDownItem.js +73 -0
- package/src/components/DropDownMenu.js +37 -0
- package/src/components/FontScaleButton.js +38 -0
- package/src/components/FontScalePopup.js +73 -0
- package/src/components/FormattedText.js +131 -0
- package/src/components/ImageUploader.js +9 -20
- package/src/components/Input.js +187 -0
- package/src/components/PlussChat.js +885 -0
- package/src/components/PlussChatMessage.js +208 -0
- package/src/components/PlussChatTime.js +63 -0
- package/src/components/PositionedImage.js +260 -0
- package/src/components/Reaction.js +111 -0
- package/src/components/Reactions.js +75 -0
- package/src/components/StickyFooter.js +34 -0
- package/src/components/TextStyle.js +6 -1
- package/src/components/Toggle.js +84 -0
- package/src/components/TouchableSearchBar.js +62 -0
- package/src/components/UserListPopup.js +140 -0
- package/src/components/UserListing.js +262 -0
- package/src/components/WarningPopup.js +79 -0
- package/src/components/index.js +18 -0
- package/src/config.js +9 -1
- package/src/constants.js +24 -0
- package/src/helper.js +199 -29
- package/src/index.js +3 -1
- package/src/session.js +12 -12
- package/src/styles.js +33 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { LINEGREY } from '../colours';
|
|
4
|
+
import { FOOTER_HEIGHT } from '../constants';
|
|
5
|
+
|
|
6
|
+
class StickyFooter extends PureComponent {
|
|
7
|
+
render() {
|
|
8
|
+
return <View style={[styles.section, this.props.lineSeparated && styles.lineSeparated, this.props.style]}>{this.props.children}</View>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const styles = {
|
|
13
|
+
section: {
|
|
14
|
+
backgroundColor: '#fff',
|
|
15
|
+
height: FOOTER_HEIGHT,
|
|
16
|
+
borderTopWidth: 0,
|
|
17
|
+
shadowColor: '#000',
|
|
18
|
+
shadowOffset: {
|
|
19
|
+
width: 0,
|
|
20
|
+
height: -1,
|
|
21
|
+
},
|
|
22
|
+
shadowOpacity: 0.1,
|
|
23
|
+
shadowRadius: 6,
|
|
24
|
+
elevation: 16,
|
|
25
|
+
},
|
|
26
|
+
lineSeparated: {
|
|
27
|
+
borderTopWidth: 1,
|
|
28
|
+
borderColor: LINEGREY,
|
|
29
|
+
shadowOpacity: 0,
|
|
30
|
+
elevation: 0,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { StickyFooter };
|
|
@@ -14,7 +14,7 @@ class TextStyle extends PureComponent {
|
|
|
14
14
|
|
|
15
15
|
const styles = StyleSheet.create({
|
|
16
16
|
pageHeading: {
|
|
17
|
-
fontFamily: '
|
|
17
|
+
fontFamily: 'sf-bold',
|
|
18
18
|
fontSize: 24,
|
|
19
19
|
color: TEXT_DARKEST,
|
|
20
20
|
},
|
|
@@ -23,6 +23,11 @@ const styles = StyleSheet.create({
|
|
|
23
23
|
fontSize: 14,
|
|
24
24
|
color: TEXT_DARKEST,
|
|
25
25
|
},
|
|
26
|
+
detailLabel: {
|
|
27
|
+
fontFamily: 'sf-bold',
|
|
28
|
+
color: TEXT_DARKEST,
|
|
29
|
+
fontSize: 16,
|
|
30
|
+
},
|
|
26
31
|
});
|
|
27
32
|
|
|
28
33
|
export { TextStyle };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import { Text, View, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import { getMainBrandingColourFromState } from '../colours';
|
|
5
|
+
|
|
6
|
+
class Toggle extends PureComponent {
|
|
7
|
+
render() {
|
|
8
|
+
return (
|
|
9
|
+
<View style={[styles.container, this.props.style]}>
|
|
10
|
+
{this.props.options.map((option, index) => {
|
|
11
|
+
return (
|
|
12
|
+
<TouchableOpacity
|
|
13
|
+
onPress={() => {
|
|
14
|
+
this.props.onPress(option);
|
|
15
|
+
}}
|
|
16
|
+
style={[
|
|
17
|
+
styles.tag,
|
|
18
|
+
{ borderColor: this.props.colourBrandingMain },
|
|
19
|
+
option.val === this.props.activeVal && {
|
|
20
|
+
borderColor: this.props.colourBrandingMain,
|
|
21
|
+
backgroundColor: this.props.colourBrandingMain,
|
|
22
|
+
},
|
|
23
|
+
index === 0 && styles.firstTag,
|
|
24
|
+
index === this.props.options.length - 1 && styles.lastTag,
|
|
25
|
+
this.props.tagStyle,
|
|
26
|
+
]}
|
|
27
|
+
key={option.val}
|
|
28
|
+
>
|
|
29
|
+
<Text
|
|
30
|
+
style={[
|
|
31
|
+
styles.text,
|
|
32
|
+
{ color: this.props.colourBrandingMain },
|
|
33
|
+
option.val === this.props.activeVal && styles.activeText,
|
|
34
|
+
this.props.textStyle,
|
|
35
|
+
]}
|
|
36
|
+
>
|
|
37
|
+
{option.text}
|
|
38
|
+
</Text>
|
|
39
|
+
</TouchableOpacity>
|
|
40
|
+
);
|
|
41
|
+
})}
|
|
42
|
+
</View>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const styles = {
|
|
48
|
+
container: {
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
},
|
|
51
|
+
text: {
|
|
52
|
+
fontFamily: 'sf-semibold',
|
|
53
|
+
fontSize: 14,
|
|
54
|
+
textAlign: 'center',
|
|
55
|
+
},
|
|
56
|
+
activeText: {
|
|
57
|
+
color: '#fff',
|
|
58
|
+
},
|
|
59
|
+
tag: {
|
|
60
|
+
flex: 1,
|
|
61
|
+
height: 34,
|
|
62
|
+
borderWidth: 1,
|
|
63
|
+
borderLeftWidth: 0,
|
|
64
|
+
justifyContent: 'center',
|
|
65
|
+
},
|
|
66
|
+
firstTag: {
|
|
67
|
+
borderLeftWidth: 1,
|
|
68
|
+
borderTopLeftRadius: 4,
|
|
69
|
+
borderBottomLeftRadius: 4,
|
|
70
|
+
},
|
|
71
|
+
lastTag: {
|
|
72
|
+
borderTopRightRadius: 4,
|
|
73
|
+
borderBottomRightRadius: 4,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const mapStateToProps = state => {
|
|
78
|
+
return {
|
|
79
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const toggle = connect(mapStateToProps, {})(Toggle);
|
|
84
|
+
export { toggle as Toggle };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { View, TouchableWithoutFeedback, Text } from 'react-native';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import { getSiteSettingFromState } from '../helper';
|
|
5
|
+
import { TEXT_LIGHT, BOXGREY } from '../colours';
|
|
6
|
+
import { Pl60Icon } from '../fonts';
|
|
7
|
+
import Config, { Services } from '../config';
|
|
8
|
+
|
|
9
|
+
class TouchableSearchBar extends Component {
|
|
10
|
+
onPressSearch = () => {
|
|
11
|
+
Services.navigation.navigate('search', { priorityType: this.props.priorityType, searchName: this.props.searchName });
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
return (
|
|
16
|
+
<TouchableWithoutFeedback onPress={this.onPressSearch}>
|
|
17
|
+
<View style={[styles.searchInputContainer, this.props.headerType !== 'white' && { backgroundColor: '#fff' }, this.props.style]}>
|
|
18
|
+
<Pl60Icon name="Ellipse" style={styles.searchIcon} />
|
|
19
|
+
<Text style={styles.searchText}>{`Search ${this.props.searchName}`}</Text>
|
|
20
|
+
</View>
|
|
21
|
+
</TouchableWithoutFeedback>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const styles = {
|
|
27
|
+
searchInputContainer: {
|
|
28
|
+
flex: 1,
|
|
29
|
+
height: 36,
|
|
30
|
+
marginHorizontal: 16,
|
|
31
|
+
marginVertical: 17,
|
|
32
|
+
borderRadius: 25,
|
|
33
|
+
backgroundColor: BOXGREY,
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
paddingHorizontal: 16,
|
|
38
|
+
},
|
|
39
|
+
searchIcon: {
|
|
40
|
+
fontSize: 14,
|
|
41
|
+
color: TEXT_LIGHT,
|
|
42
|
+
marginRight: 8,
|
|
43
|
+
},
|
|
44
|
+
searchText: {
|
|
45
|
+
fontSize: 14,
|
|
46
|
+
color: TEXT_LIGHT,
|
|
47
|
+
fontFamily: 'sf-medium',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const mapStateToProps = state => {
|
|
52
|
+
return {
|
|
53
|
+
headerType: getSiteSettingFromState(
|
|
54
|
+
state,
|
|
55
|
+
'HeaderType',
|
|
56
|
+
getSiteSettingFromState(state, 'UseGradientHeader', Config.env.hasGradientHeader) ? 'gradient' : 'white',
|
|
57
|
+
),
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const touchableSearchBar = connect(mapStateToProps, {})(TouchableSearchBar);
|
|
62
|
+
export { touchableSearchBar as TouchableSearchBar };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { Text, View, Dimensions, Modal, ScrollView, TouchableWithoutFeedback, Platform } from 'react-native';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import { TEXT_DARK, LINEGREY, getMainBrandingColourFromState } from '../colours';
|
|
5
|
+
import UserListing from './UserListing';
|
|
6
|
+
import { InlineButton } from './InlineButton';
|
|
7
|
+
|
|
8
|
+
const SCREEN_HEIGHT = Dimensions.get('window').height;
|
|
9
|
+
|
|
10
|
+
class UserListPopup extends Component {
|
|
11
|
+
getRenderKey(user, userKey) {
|
|
12
|
+
if (user.id) {
|
|
13
|
+
return `${user.id}${userKey}`;
|
|
14
|
+
}
|
|
15
|
+
if (user.userId) {
|
|
16
|
+
return `${user.userId}${userKey}`;
|
|
17
|
+
}
|
|
18
|
+
return userKey;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
renderHeader() {
|
|
22
|
+
return (
|
|
23
|
+
<View style={styles.titleContainer}>
|
|
24
|
+
<View style={styles.titleContent}>
|
|
25
|
+
<Text style={styles.title}>{this.props.title}</Text>
|
|
26
|
+
</View>
|
|
27
|
+
</View>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
renderScrollContainer() {
|
|
32
|
+
return (
|
|
33
|
+
<ScrollView style={styles.optionsContainer} keyboardShouldPersistTaps="handled">
|
|
34
|
+
{this.props.users.map((user, userIndex) => {
|
|
35
|
+
return <UserListing user={user} key={this.getRenderKey(user, userIndex)} index={userIndex} />;
|
|
36
|
+
})}
|
|
37
|
+
<View style={styles.scrollFooterSpace} />
|
|
38
|
+
</ScrollView>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
renderFooter() {
|
|
43
|
+
return (
|
|
44
|
+
<View style={styles.footer}>
|
|
45
|
+
<InlineButton onPress={this.props.onClose.bind(this)} color={this.props.colourBrandingMain} style={[styles.footerButton]}>
|
|
46
|
+
Done
|
|
47
|
+
</InlineButton>
|
|
48
|
+
</View>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
return (
|
|
54
|
+
<Modal visible={this.props.visible} transparent animationType="slide" onRequestClose={this.props.onClose}>
|
|
55
|
+
<ScrollView keyboardShouldPersistTaps="always">
|
|
56
|
+
<View style={styles.popup}>
|
|
57
|
+
<TouchableWithoutFeedback onPress={this.props.onClose}>
|
|
58
|
+
<View style={styles.popupOverlay} />
|
|
59
|
+
</TouchableWithoutFeedback>
|
|
60
|
+
<View
|
|
61
|
+
style={[
|
|
62
|
+
styles.popupContent,
|
|
63
|
+
{ minHeight: SCREEN_HEIGHT - (Platform.OS === 'android' ? 175 : 150) },
|
|
64
|
+
{ marginTop: 60, minHeight: SCREEN_HEIGHT - (Platform.OS === 'android' ? 85 : 60) },
|
|
65
|
+
]}
|
|
66
|
+
>
|
|
67
|
+
{this.renderHeader()}
|
|
68
|
+
{this.renderScrollContainer()}
|
|
69
|
+
{this.renderFooter()}
|
|
70
|
+
</View>
|
|
71
|
+
</View>
|
|
72
|
+
</ScrollView>
|
|
73
|
+
</Modal>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const styles = {
|
|
79
|
+
popup: {
|
|
80
|
+
flex: 1,
|
|
81
|
+
justifyContent: 'center',
|
|
82
|
+
},
|
|
83
|
+
popupOverlay: {
|
|
84
|
+
position: 'absolute',
|
|
85
|
+
backgroundColor: 'rgba(19, 19, 26, .25)',
|
|
86
|
+
top: 0,
|
|
87
|
+
left: 0,
|
|
88
|
+
right: 0,
|
|
89
|
+
bottom: 0,
|
|
90
|
+
},
|
|
91
|
+
popupContent: {
|
|
92
|
+
borderRadius: 3,
|
|
93
|
+
marginTop: 150,
|
|
94
|
+
backgroundColor: '#fff',
|
|
95
|
+
flex: 1,
|
|
96
|
+
borderTopLeftRadius: 15,
|
|
97
|
+
borderTopRightRadius: 15,
|
|
98
|
+
},
|
|
99
|
+
footer: {
|
|
100
|
+
padding: 8,
|
|
101
|
+
borderTopWidth: 1,
|
|
102
|
+
borderColor: LINEGREY,
|
|
103
|
+
backgroundColor: '#fff',
|
|
104
|
+
},
|
|
105
|
+
footerButton: {
|
|
106
|
+
width: '100%',
|
|
107
|
+
height: 40,
|
|
108
|
+
},
|
|
109
|
+
titleContainer: {
|
|
110
|
+
alignSelf: 'stretch',
|
|
111
|
+
padding: 24,
|
|
112
|
+
paddingTop: 16,
|
|
113
|
+
paddingBottom: 0,
|
|
114
|
+
},
|
|
115
|
+
titleContent: {
|
|
116
|
+
borderColor: LINEGREY,
|
|
117
|
+
borderBottomWidth: 1,
|
|
118
|
+
flexDirection: 'row',
|
|
119
|
+
justifyContent: 'space-between',
|
|
120
|
+
paddingBottom: 15,
|
|
121
|
+
},
|
|
122
|
+
title: {
|
|
123
|
+
fontSize: 15,
|
|
124
|
+
fontFamily: 'sf-semibold',
|
|
125
|
+
color: TEXT_DARK,
|
|
126
|
+
},
|
|
127
|
+
optionsContainer: {
|
|
128
|
+
flex: 1,
|
|
129
|
+
paddingVertical: 8,
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const mapStateToProps = state => {
|
|
134
|
+
return {
|
|
135
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const userListPopup = connect(mapStateToProps, {})(UserListPopup);
|
|
140
|
+
export { userListPopup as UserListPopup };
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import { TouchableOpacity, Text, View } from 'react-native';
|
|
4
|
+
import { connect } from 'react-redux';
|
|
5
|
+
import moment from 'moment';
|
|
6
|
+
import { COLOUR_GREEN, TEXT_DARK, TEXT_LIGHT, getMainBrandingColourFromState, getLightBrandingColourFromState } from '../colours';
|
|
7
|
+
import { Services } from '../config';
|
|
8
|
+
import { ProfilePic } from './ProfilePic';
|
|
9
|
+
import { InlineButton } from './InlineButton';
|
|
10
|
+
import { Spinner } from './Spinner';
|
|
11
|
+
import { followerActions } from '../apis';
|
|
12
|
+
import { addFollower } from '../actions';
|
|
13
|
+
|
|
14
|
+
class UserListing extends Component {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
this.state = { pending: false };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
onPress() {
|
|
21
|
+
const { hidden } = this.props.me;
|
|
22
|
+
if (hidden && _.includes(hidden, 'people')) return;
|
|
23
|
+
|
|
24
|
+
if (this.props.onPress) {
|
|
25
|
+
this.props.onPress();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const user = { ...this.props.user };
|
|
29
|
+
if (_.isUndefined(user.key)) {
|
|
30
|
+
user.key = user.userId;
|
|
31
|
+
}
|
|
32
|
+
if (_.isUndefined(user.id)) {
|
|
33
|
+
user.id = user.userId;
|
|
34
|
+
}
|
|
35
|
+
Services.navigation.navigate('profile', { user });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
onFollowUser() {
|
|
39
|
+
const userToSave = {
|
|
40
|
+
profilePic: this.props.user.profilePic,
|
|
41
|
+
displayName: this.props.user.displayName,
|
|
42
|
+
id: this.props.user.id,
|
|
43
|
+
};
|
|
44
|
+
this.setState({ pending: true });
|
|
45
|
+
followerActions
|
|
46
|
+
.addFollower(userToSave, this.props.myId)
|
|
47
|
+
.then(() => {
|
|
48
|
+
this.props.addFollower(userToSave);
|
|
49
|
+
})
|
|
50
|
+
.catch(() => {
|
|
51
|
+
this.setState({ pending: false });
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
getTimeText(input) {
|
|
56
|
+
const gug = moment.unix(input);
|
|
57
|
+
if (
|
|
58
|
+
gug.isBefore(
|
|
59
|
+
moment()
|
|
60
|
+
.local()
|
|
61
|
+
.startOf('d'),
|
|
62
|
+
)
|
|
63
|
+
) {
|
|
64
|
+
return gug.format('D MMM');
|
|
65
|
+
}
|
|
66
|
+
return gug.format('h:mma');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
getProfilePic() {
|
|
70
|
+
if (this.props.user.profilePic == null) return null;
|
|
71
|
+
let profilePic = this.props.user.profilePic;
|
|
72
|
+
if (!_.isUndefined(this.props.user.profilePicThumb) && !_.isEmpty(this.props.user.profilePicThumb)) {
|
|
73
|
+
profilePic = this.props.user.profilePicThumb;
|
|
74
|
+
} else if (this.props.user.profilePic.indexOf('.amazonaws.com/1400/') > -1) {
|
|
75
|
+
profilePic = profilePic.replace('/1400/', '/300/');
|
|
76
|
+
}
|
|
77
|
+
return profilePic;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
getLastMessage(chat) {
|
|
81
|
+
if (typeof chat.lastMessage === 'string') {
|
|
82
|
+
return chat.lastMessage;
|
|
83
|
+
}
|
|
84
|
+
// TODO recognise user name of last message
|
|
85
|
+
return chat.lastMessage.text;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
renderFollowButton() {
|
|
89
|
+
if (this.props.user.privateChat) {
|
|
90
|
+
return (
|
|
91
|
+
<View style={{ justifyContent: 'flex-start' }}>
|
|
92
|
+
<Text style={[styles.chatTimeStamp, this.props.user.unread > 0 && { color: TEXT_DARK, fontFamily: 'sf-bold' }]}>
|
|
93
|
+
{this.getTimeText(this.props.user.Changed)}
|
|
94
|
+
</Text>
|
|
95
|
+
<View style={[{ flexDirection: 'row-reverse', marginTop: 2 }, this.props.user.unread === 0 && { opacity: 0 }]}>
|
|
96
|
+
<View style={styles.counter}>
|
|
97
|
+
<Text style={styles.counterText}>{this.props.user.unread}</Text>
|
|
98
|
+
</View>
|
|
99
|
+
</View>
|
|
100
|
+
</View>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!this.props.showFriendsButton) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// self
|
|
109
|
+
if (this.props.myId === this.props.user.id) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// already following
|
|
114
|
+
if (this.props.isFollowing) {
|
|
115
|
+
return (
|
|
116
|
+
<InlineButton
|
|
117
|
+
color={this.props.colourBrandingLight}
|
|
118
|
+
style={styles.friendsButton}
|
|
119
|
+
textStyle={{ color: this.props.colourBrandingMain }}
|
|
120
|
+
disabled
|
|
121
|
+
>
|
|
122
|
+
Friends
|
|
123
|
+
</InlineButton>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// in process of following
|
|
128
|
+
if (this.state.pending) {
|
|
129
|
+
return (
|
|
130
|
+
<InlineButton style={[styles.friendsButton, { borderColor: this.props.colourBrandingMain, borderWidth: 1 }]} disabled noText>
|
|
131
|
+
<Spinner size="small" color={this.props.colourBrandingMain} />
|
|
132
|
+
</InlineButton>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// not following yet
|
|
137
|
+
return (
|
|
138
|
+
<InlineButton
|
|
139
|
+
onPress={this.onFollowUser.bind(this)}
|
|
140
|
+
color="#fff"
|
|
141
|
+
style={[styles.friendsButton, { borderColor: this.props.colourBrandingMain, borderWidth: 1 }]}
|
|
142
|
+
textStyle={{ color: this.props.colourBrandingMain }}
|
|
143
|
+
>
|
|
144
|
+
Add friend
|
|
145
|
+
</InlineButton>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
renderStatusText() {
|
|
150
|
+
if (!this.props.statusText) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return <Text style={styles.statusText}>{this.props.statusText}</Text>;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
render() {
|
|
157
|
+
return (
|
|
158
|
+
<View style={this.props.containerStyle}>
|
|
159
|
+
<TouchableOpacity activeOpacity={0.9} onPress={this.onPress.bind(this)} disabled={this.props.onPressDisabled}>
|
|
160
|
+
<View style={[styles.listItem, this.props.listItemStyle]}>
|
|
161
|
+
{this.renderStatusText()}
|
|
162
|
+
<ProfilePic ProfilePic={this.getProfilePic()} Diameter={42} />
|
|
163
|
+
<View style={[styles.fill, styles.flexRowReverse, styles.alignCenter]}>
|
|
164
|
+
{this.props.rightContent}
|
|
165
|
+
{this.renderFollowButton()}
|
|
166
|
+
<View style={styles.fill}>
|
|
167
|
+
<View style={styles.listItemTextContainer}>
|
|
168
|
+
<Text style={styles.contactName} numberOfLines={1}>
|
|
169
|
+
{this.props.user.displayName}
|
|
170
|
+
</Text>
|
|
171
|
+
{this.props.user.privateChat && (
|
|
172
|
+
<Text style={styles.chatLastMessage} numberOfLines={1}>
|
|
173
|
+
{this.getLastMessage(this.props.user)}
|
|
174
|
+
</Text>
|
|
175
|
+
)}
|
|
176
|
+
{this.props.subText}
|
|
177
|
+
</View>
|
|
178
|
+
</View>
|
|
179
|
+
</View>
|
|
180
|
+
</View>
|
|
181
|
+
</TouchableOpacity>
|
|
182
|
+
</View>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const styles = {
|
|
188
|
+
listItem: {
|
|
189
|
+
paddingVertical: 8,
|
|
190
|
+
paddingHorizontal: 16,
|
|
191
|
+
justifyContent: 'flex-start',
|
|
192
|
+
flexDirection: 'row',
|
|
193
|
+
position: 'relative',
|
|
194
|
+
},
|
|
195
|
+
listItemTextContainer: {
|
|
196
|
+
flex: 1,
|
|
197
|
+
flexDirection: 'column',
|
|
198
|
+
justifyContent: 'space-around',
|
|
199
|
+
paddingLeft: 16,
|
|
200
|
+
},
|
|
201
|
+
contactName: {
|
|
202
|
+
fontSize: 15,
|
|
203
|
+
fontFamily: 'sf-semibold',
|
|
204
|
+
backgroundColor: 'rgba(255,255,255,0)',
|
|
205
|
+
color: TEXT_DARK,
|
|
206
|
+
},
|
|
207
|
+
statusText: {
|
|
208
|
+
position: 'absolute',
|
|
209
|
+
top: 0,
|
|
210
|
+
left: 82,
|
|
211
|
+
fontFamily: 'sf-semibold',
|
|
212
|
+
fontSize: 12,
|
|
213
|
+
color: TEXT_LIGHT,
|
|
214
|
+
},
|
|
215
|
+
fill: {
|
|
216
|
+
flex: 1,
|
|
217
|
+
},
|
|
218
|
+
alignCenter: {
|
|
219
|
+
alignItems: 'center',
|
|
220
|
+
},
|
|
221
|
+
flexRowReverse: {
|
|
222
|
+
flexDirection: 'row-reverse',
|
|
223
|
+
},
|
|
224
|
+
friendsButton: {
|
|
225
|
+
width: 100,
|
|
226
|
+
},
|
|
227
|
+
counter: {
|
|
228
|
+
borderRadius: 10,
|
|
229
|
+
height: 20,
|
|
230
|
+
justifyContent: 'center',
|
|
231
|
+
minWidth: 20,
|
|
232
|
+
paddingHorizontal: 4,
|
|
233
|
+
backgroundColor: COLOUR_GREEN,
|
|
234
|
+
},
|
|
235
|
+
counterText: {
|
|
236
|
+
color: '#fff',
|
|
237
|
+
fontSize: 12,
|
|
238
|
+
fontFamily: 'sf-semibold',
|
|
239
|
+
textAlign: 'center',
|
|
240
|
+
},
|
|
241
|
+
chatTimeStamp: {
|
|
242
|
+
fontSize: 10,
|
|
243
|
+
fontFamily: 'sf-semibold',
|
|
244
|
+
color: TEXT_LIGHT,
|
|
245
|
+
},
|
|
246
|
+
chatLastMessage: {
|
|
247
|
+
fontSize: 13,
|
|
248
|
+
fontFamily: 'sf-medium',
|
|
249
|
+
color: TEXT_LIGHT,
|
|
250
|
+
marginRight: 5,
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const mapStateToProps = state => {
|
|
255
|
+
return {
|
|
256
|
+
me: state.user,
|
|
257
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
258
|
+
colourBrandingLight: getLightBrandingColourFromState(state),
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export default connect(mapStateToProps, { addFollower })(UserListing);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import { View, Text, Dimensions } from 'react-native';
|
|
4
|
+
import { connect } from 'react-redux';
|
|
5
|
+
import { Pl60Icon } from '../fonts';
|
|
6
|
+
import { COLOUR_GREEN, TEXT_DARK, getMainBrandingColourFromState } from '../colours';
|
|
7
|
+
import { MiddlePopup } from './MiddlePopup';
|
|
8
|
+
import { InlineButton } from './InlineButton';
|
|
9
|
+
|
|
10
|
+
const SCREEN_WIDTH = Dimensions.get('window').width;
|
|
11
|
+
|
|
12
|
+
class WarningPopup extends PureComponent {
|
|
13
|
+
render() {
|
|
14
|
+
return (
|
|
15
|
+
<MiddlePopup visible={this.props.visible} onClose={this.props.onClose} style={styles.popup}>
|
|
16
|
+
{this.props.isSuccess && <Pl60Icon style={styles.icon} name="circleoutlined" />}
|
|
17
|
+
<Text style={styles.text}>{this.props.confirmText}</Text>
|
|
18
|
+
<View style={{ marginTop: 16, paddingHorizontal: 24 }}>
|
|
19
|
+
<Text style={[styles.infoText, this.props.infoTextStyle]}>{this.props.infoText}</Text>
|
|
20
|
+
</View>
|
|
21
|
+
<InlineButton
|
|
22
|
+
onPress={this.props.onClose}
|
|
23
|
+
color={this.props.ctaButton ? this.props.colourBrandingMain : '#fff'}
|
|
24
|
+
style={styles.button}
|
|
25
|
+
textStyle={[styles.closeText, { color: this.props.ctaButton ? '#fff' : this.props.colourBrandingMain }]}
|
|
26
|
+
large
|
|
27
|
+
>
|
|
28
|
+
{!_.isUndefined(this.props.buttonText) ? this.props.buttonText : 'Close'}
|
|
29
|
+
</InlineButton>
|
|
30
|
+
</MiddlePopup>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const styles = {
|
|
36
|
+
popup: {
|
|
37
|
+
width: 'auto',
|
|
38
|
+
maxWidth: SCREEN_WIDTH - 34,
|
|
39
|
+
paddingVertical: 16,
|
|
40
|
+
},
|
|
41
|
+
icon: {
|
|
42
|
+
marginTop: 20,
|
|
43
|
+
paddingBottom: 16,
|
|
44
|
+
fontSize: 52,
|
|
45
|
+
color: COLOUR_GREEN,
|
|
46
|
+
},
|
|
47
|
+
text: {
|
|
48
|
+
fontFamily: 'sf-bold',
|
|
49
|
+
fontSize: 24,
|
|
50
|
+
lineHeight: 24,
|
|
51
|
+
color: TEXT_DARK,
|
|
52
|
+
textAlign: 'center',
|
|
53
|
+
marginTop: 8,
|
|
54
|
+
},
|
|
55
|
+
infoText: {
|
|
56
|
+
fontFamily: 'sf-regular',
|
|
57
|
+
fontSize: 16,
|
|
58
|
+
lineHeight: 22,
|
|
59
|
+
color: TEXT_DARK,
|
|
60
|
+
textAlign: 'left',
|
|
61
|
+
},
|
|
62
|
+
button: {
|
|
63
|
+
width: 130,
|
|
64
|
+
marginTop: 20,
|
|
65
|
+
},
|
|
66
|
+
closeText: {
|
|
67
|
+
fontFamily: 'sf-medium',
|
|
68
|
+
fontSize: 15,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const mapStateToProps = state => {
|
|
73
|
+
return {
|
|
74
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const warningPopup = connect(mapStateToProps, {})(WarningPopup);
|
|
79
|
+
export { warningPopup as WarningPopup };
|