@plusscommunities/pluss-core-app 1.4.9 → 1.5.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/FollowerActions.js +34 -0
- package/dist/module/actions/FollowerActions.js.map +1 -0
- package/dist/module/actions/MediaActions.js +20 -0
- package/dist/module/actions/MediaActions.js.map +1 -0
- package/dist/module/actions/ResidentActions.js +26 -0
- package/dist/module/actions/ResidentActions.js.map +1 -0
- package/dist/module/actions/UserActions.js +214 -0
- package/dist/module/actions/UserActions.js.map +1 -0
- package/dist/module/actions/index.js +5 -0
- package/dist/module/actions/index.js.map +1 -0
- package/dist/module/actions/types.js +14 -0
- package/dist/module/actions/types.js.map +1 -0
- package/dist/module/apis/analyticsActions.js +20 -0
- package/dist/module/apis/analyticsActions.js.map +1 -0
- package/dist/module/apis/contactActions.js +27 -0
- package/dist/module/apis/contactActions.js.map +1 -0
- package/dist/module/apis/eventActions.js +163 -0
- package/dist/module/apis/eventActions.js.map +1 -0
- package/dist/module/apis/fileActions.js +96 -0
- package/dist/module/apis/fileActions.js.map +1 -0
- package/dist/module/apis/followerActions.js +38 -0
- package/dist/module/apis/followerActions.js.map +1 -0
- package/dist/module/apis/index.js +11 -0
- package/dist/module/apis/index.js.map +1 -0
- package/dist/module/apis/notificationActions.js +60 -0
- package/dist/module/apis/notificationActions.js.map +1 -0
- package/dist/module/apis/profileActions.js +14 -0
- package/dist/module/apis/profileActions.js.map +1 -0
- package/dist/module/apis/reactionActions.js +78 -0
- package/dist/module/apis/reactionActions.js.map +1 -0
- package/dist/module/apis/typeActions.js +15 -0
- package/dist/module/apis/typeActions.js.map +1 -0
- package/dist/module/apis/userActions.js +104 -0
- package/dist/module/apis/userActions.js.map +1 -0
- package/{assets → dist/module/assets}/icons/reactions/heart.png +0 -0
- package/{assets → dist/module/assets}/icons/reactions/party.png +0 -0
- package/{assets → dist/module/assets}/icons/reactions/sad.png +0 -0
- package/{assets → dist/module/assets}/icons/reactions/smile.png +0 -0
- package/dist/module/colours.js +149 -0
- package/dist/module/colours.js.map +1 -0
- package/dist/module/components/AddButton.js +45 -0
- package/dist/module/components/AddButton.js.map +1 -0
- package/dist/module/components/Attachment.js +59 -0
- package/dist/module/components/Attachment.js.map +1 -0
- package/dist/module/components/AudienceSelectorLauncher.js +70 -0
- package/dist/module/components/AudienceSelectorLauncher.js.map +1 -0
- package/dist/module/components/AudienceSelectorPage.js +376 -0
- package/dist/module/components/AudienceSelectorPage.js.map +1 -0
- package/dist/module/components/BackButton.js +62 -0
- package/dist/module/components/BackButton.js.map +1 -0
- package/dist/module/components/CategoryTabs.js +171 -0
- package/dist/module/components/CategoryTabs.js.map +1 -0
- package/dist/module/components/CommentReply.js +363 -0
- package/dist/module/components/CommentReply.js.map +1 -0
- package/dist/module/components/CommentSection.js +785 -0
- package/dist/module/components/CommentSection.js.map +1 -0
- package/dist/module/components/ConfirmPopup.js +85 -0
- package/dist/module/components/ConfirmPopup.js.map +1 -0
- package/dist/module/components/ConfirmationPopup.js +77 -0
- package/dist/module/components/ConfirmationPopup.js.map +1 -0
- package/dist/module/components/DropDownItem.js +82 -0
- package/dist/module/components/DropDownItem.js.map +1 -0
- package/dist/module/components/DropDownMenu.js +46 -0
- package/dist/module/components/DropDownMenu.js.map +1 -0
- package/dist/module/components/EmptyStateMain.js +50 -0
- package/dist/module/components/EmptyStateMain.js.map +1 -0
- package/dist/module/components/EmptyStateWidget.js +52 -0
- package/dist/module/components/EmptyStateWidget.js.map +1 -0
- package/dist/module/components/FontScaleButton.js +37 -0
- package/dist/module/components/FontScaleButton.js.map +1 -0
- package/dist/module/components/FontScalePopup.js +77 -0
- package/dist/module/components/FontScalePopup.js.map +1 -0
- package/dist/module/components/FormCard.js +28 -0
- package/dist/module/components/FormCard.js.map +1 -0
- package/dist/module/components/FormCardSection.js +240 -0
- package/dist/module/components/FormCardSection.js.map +1 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js +77 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -0
- package/dist/module/components/FormattedText.js +145 -0
- package/dist/module/components/FormattedText.js.map +1 -0
- package/dist/module/components/GenericInput.js +161 -0
- package/dist/module/components/GenericInput.js.map +1 -0
- package/dist/module/components/GenericInputSection.js +174 -0
- package/dist/module/components/GenericInputSection.js.map +1 -0
- package/dist/module/components/Header.js +491 -0
- package/dist/module/components/Header.js.map +1 -0
- package/dist/module/components/ImagePopup.js +257 -0
- package/dist/module/components/ImagePopup.js.map +1 -0
- package/dist/module/components/ImageUploadProgress.js +72 -0
- package/dist/module/components/ImageUploadProgress.js.map +1 -0
- package/dist/module/components/ImageUploader.js +850 -0
- package/dist/module/components/ImageUploader.js.map +1 -0
- package/dist/module/components/InlineButton.js +72 -0
- package/dist/module/components/InlineButton.js.map +1 -0
- package/dist/module/components/Input.js +164 -0
- package/dist/module/components/Input.js.map +1 -0
- package/dist/module/components/LoadingCircles.js +224 -0
- package/dist/module/components/LoadingCircles.js.map +1 -0
- package/dist/module/components/LoadingIndicator.js +95 -0
- package/dist/module/components/LoadingIndicator.js.map +1 -0
- package/dist/module/components/LoadingStateWidget.js +51 -0
- package/dist/module/components/LoadingStateWidget.js.map +1 -0
- package/dist/module/components/MediaPlayer.js +440 -0
- package/dist/module/components/MediaPlayer.js.map +1 -0
- package/dist/module/components/MiddlePopup.js +46 -0
- package/dist/module/components/MiddlePopup.js.map +1 -0
- package/dist/module/components/PDFPopup.js +188 -0
- package/dist/module/components/PDFPopup.js.map +1 -0
- package/dist/module/components/PlussChat.js +997 -0
- package/dist/module/components/PlussChat.js.map +1 -0
- package/dist/module/components/PlussChatMessage.js +204 -0
- package/dist/module/components/PlussChatMessage.js.map +1 -0
- package/dist/module/components/PlussChatTime.js +66 -0
- package/dist/module/components/PlussChatTime.js.map +1 -0
- package/dist/module/components/Popup.js +138 -0
- package/dist/module/components/Popup.js.map +1 -0
- package/dist/module/components/PopupMenu.js +128 -0
- package/dist/module/components/PopupMenu.js.map +1 -0
- package/dist/module/components/PositionedImage.js +333 -0
- package/dist/module/components/PositionedImage.js.map +1 -0
- package/dist/module/components/ProfilePic.js +119 -0
- package/dist/module/components/ProfilePic.js.map +1 -0
- package/dist/module/components/RadioButton.js +84 -0
- package/dist/module/components/RadioButton.js.map +1 -0
- package/dist/module/components/Reaction.js +129 -0
- package/dist/module/components/Reaction.js.map +1 -0
- package/dist/module/components/Reactions.js +84 -0
- package/dist/module/components/Reactions.js.map +1 -0
- package/dist/module/components/SharingTools.js +162 -0
- package/dist/module/components/SharingTools.js.map +1 -0
- package/dist/module/components/Spinner.js +25 -0
- package/dist/module/components/Spinner.js.map +1 -0
- package/dist/module/components/StickyFooter.js +37 -0
- package/dist/module/components/StickyFooter.js.map +1 -0
- package/dist/module/components/TextStyle.js +34 -0
- package/dist/module/components/TextStyle.js.map +1 -0
- package/dist/module/components/Toggle.js +70 -0
- package/dist/module/components/Toggle.js.map +1 -0
- package/dist/module/components/TouchableSearchBar.js +73 -0
- package/dist/module/components/TouchableSearchBar.js.map +1 -0
- package/dist/module/components/UserListPopup.js +146 -0
- package/dist/module/components/UserListPopup.js.map +1 -0
- package/dist/module/components/UserListing.js +291 -0
- package/dist/module/components/UserListing.js.map +1 -0
- package/dist/module/components/VideoPopup.js +123 -0
- package/dist/module/components/VideoPopup.js.map +1 -0
- package/dist/module/components/WarningPopup.js +87 -0
- package/dist/module/components/WarningPopup.js.map +1 -0
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +325 -0
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -0
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js +123 -0
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -0
- package/dist/module/components/index.js +53 -0
- package/dist/module/components/index.js.map +1 -0
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +416 -0
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -0
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +405 -0
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -0
- package/dist/module/config.js +27 -0
- package/dist/module/config.js.map +1 -0
- package/dist/module/constants.js +16 -0
- package/dist/module/constants.js.map +1 -0
- package/dist/module/fonts/index.js +2 -0
- package/dist/module/fonts/index.js.map +1 -0
- package/dist/module/fonts/pluss60-icons.js +5 -0
- package/dist/module/fonts/pluss60-icons.js.map +1 -0
- package/dist/module/fonts/pluss60-icons.json +1097 -0
- package/dist/module/helper.js +436 -0
- package/dist/module/helper.js.map +1 -0
- package/dist/module/index.js +13 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/session.js +54 -0
- package/dist/module/session.js.map +1 -0
- package/dist/module/styles.js +67 -0
- package/dist/module/styles.js.map +1 -0
- package/package.json +22 -5
- package/src/assets/icons/reactions/heart.png +0 -0
- package/src/assets/icons/reactions/party.png +0 -0
- package/src/assets/icons/reactions/sad.png +0 -0
- package/src/assets/icons/reactions/smile.png +0 -0
- package/src/components/CommentReply.js +0 -2
- package/src/constants.js +4 -4
- package/src/helper.js +4 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import { View, TouchableOpacity, TouchableWithoutFeedback, StyleSheet, Text } from 'react-native';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import { getMainBrandingColourFromState, LINEGREY, TEXT_DARKEST } from '../colours';
|
|
5
|
+
|
|
6
|
+
class RadioButton extends PureComponent {
|
|
7
|
+
render() {
|
|
8
|
+
const {
|
|
9
|
+
size,
|
|
10
|
+
isActive,
|
|
11
|
+
value,
|
|
12
|
+
onPress,
|
|
13
|
+
colourBrandingMain,
|
|
14
|
+
style,
|
|
15
|
+
label
|
|
16
|
+
} = this.props;
|
|
17
|
+
const iconSize = size || 20;
|
|
18
|
+
const innerSize = iconSize - 8;
|
|
19
|
+
const content = /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
|
|
20
|
+
onPress: () => onPress(value)
|
|
21
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
22
|
+
style: [styles.container, {
|
|
23
|
+
width: iconSize,
|
|
24
|
+
height: iconSize,
|
|
25
|
+
borderRadius: iconSize / 2
|
|
26
|
+
}, style]
|
|
27
|
+
}, isActive && /*#__PURE__*/React.createElement(View, {
|
|
28
|
+
style: {
|
|
29
|
+
width: innerSize,
|
|
30
|
+
height: innerSize,
|
|
31
|
+
borderRadius: innerSize / 2,
|
|
32
|
+
backgroundColor: colourBrandingMain
|
|
33
|
+
}
|
|
34
|
+
})));
|
|
35
|
+
|
|
36
|
+
if (label) {
|
|
37
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
38
|
+
onPress: () => onPress(value),
|
|
39
|
+
key: label,
|
|
40
|
+
style: styles.radioOption,
|
|
41
|
+
hitSlop: {
|
|
42
|
+
top: 8,
|
|
43
|
+
left: 8,
|
|
44
|
+
bottom: 8,
|
|
45
|
+
right: 8
|
|
46
|
+
}
|
|
47
|
+
}, content, /*#__PURE__*/React.createElement(Text, {
|
|
48
|
+
style: styles.radioOptionText
|
|
49
|
+
}, label));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return content;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const styles = StyleSheet.create({
|
|
58
|
+
container: {
|
|
59
|
+
borderColor: LINEGREY,
|
|
60
|
+
borderWidth: 1,
|
|
61
|
+
backgroundColor: '#fff',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
justifyContent: 'center'
|
|
64
|
+
},
|
|
65
|
+
radioOption: {
|
|
66
|
+
flexDirection: 'row',
|
|
67
|
+
marginRight: 26
|
|
68
|
+
},
|
|
69
|
+
radioOptionText: {
|
|
70
|
+
fontFamily: 'sf-medium',
|
|
71
|
+
fontSize: 14,
|
|
72
|
+
color: TEXT_DARKEST
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const mapStateToProps = state => {
|
|
77
|
+
return {
|
|
78
|
+
colourBrandingMain: getMainBrandingColourFromState(state)
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const radioButton = connect(mapStateToProps, {})(RadioButton);
|
|
83
|
+
export { radioButton as RadioButton };
|
|
84
|
+
//# sourceMappingURL=RadioButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["RadioButton.js"],"names":["React","PureComponent","View","TouchableOpacity","TouchableWithoutFeedback","StyleSheet","Text","connect","getMainBrandingColourFromState","LINEGREY","TEXT_DARKEST","RadioButton","render","size","isActive","value","onPress","colourBrandingMain","style","label","props","iconSize","innerSize","content","styles","container","width","height","borderRadius","backgroundColor","radioOption","top","left","bottom","right","radioOptionText","create","borderColor","borderWidth","alignItems","justifyContent","flexDirection","marginRight","fontFamily","fontSize","color","mapStateToProps","state","radioButton"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,SAASC,IAAT,EAAeC,gBAAf,EAAiCC,wBAAjC,EAA2DC,UAA3D,EAAuEC,IAAvE,QAAmF,cAAnF;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,SAASC,8BAAT,EAAyCC,QAAzC,EAAmDC,YAAnD,QAAuE,YAAvE;;AAEA,MAAMC,WAAN,SAA0BV,aAA1B,CAAwC;AACtCW,EAAAA,MAAM,GAAG;AACP,UAAM;AAAEC,MAAAA,IAAF;AAAQC,MAAAA,QAAR;AAAkBC,MAAAA,KAAlB;AAAyBC,MAAAA,OAAzB;AAAkCC,MAAAA,kBAAlC;AAAsDC,MAAAA,KAAtD;AAA6DC,MAAAA;AAA7D,QAAuE,KAAKC,KAAlF;AACA,UAAMC,QAAQ,GAAGR,IAAI,IAAI,EAAzB;AACA,UAAMS,SAAS,GAAGD,QAAQ,GAAG,CAA7B;AAEA,UAAME,OAAO,gBACX,oBAAC,wBAAD;AAA0B,MAAA,OAAO,E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,GADoB;AAQ/BV,EAAAA,WAAW,EAAE;AACXW,IAAAA,aAAa,EAAE,KADJ;AAEXC,IAAAA,WAAW,EAAE;AAFF,GARkB;AAY/BP,EAAAA,eAAe,EAAE;AACfQ,IAAAA,UAAU,EAAE,WADG;AAEfC,IAAAA,QAAQ,EAAE,EAFK;AAGfC,IAAAA,KAAK,EAAEnC;AAHQ;AAZc,CAAlB,CAAf;;AAmBA,MAAMoC,eAAe,GAAGC,KAAK,IAAI;AAC/B,SAAO;AACL9B,IAAAA,kBAAkB,EAAET,8BAA8B,CAACuC,KAAD;AAD7C,GAAP;AAGD,CAJD;;AAMA,MAAMC,WAAW,GAAGzC,OAAO,CAACuC,eAAD,EAAkB,EAAlB,CAAP,CAA6BnC,WAA7B,CAApB;AACA,SAASqC,WAAW,IAAIrC,WAAxB","sourcesContent":["import React, { PureComponent } from 'react';\nimport { View, TouchableOpacity, TouchableWithoutFeedback, StyleSheet, Text } from 'react-native';\nimport { connect } from 'react-redux';\nimport { getMainBrandingColourFromState, LINEGREY, TEXT_DARKEST } from '../colours';\n\nclass RadioButton extends PureComponent {\n render() {\n const { size, isActive, value, onPress, colourBrandingMain, style, label } = this.props;\n const iconSize = size || 20;\n const innerSize = iconSize - 8;\n\n const content = (\n <TouchableWithoutFeedback onPress={() => onPress(value)}>\n <View style={[styles.container, { width: iconSize, height: iconSize, borderRadius: iconSize / 2 }, style]}>\n {isActive && (\n <View style={{ width: innerSize, height: innerSize, borderRadius: innerSize / 2, backgroundColor: colourBrandingMain }} />\n )}\n </View>\n </TouchableWithoutFeedback>\n );\n\n if (label) {\n return (\n <TouchableOpacity\n onPress={() => onPress(value)}\n key={label}\n style={styles.radioOption}\n hitSlop={{ top: 8, left: 8, bottom: 8, right: 8 }}\n >\n {content}\n <Text style={styles.radioOptionText}>{label}</Text>\n </TouchableOpacity>\n );\n }\n\n return content;\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n borderColor: LINEGREY,\n borderWidth: 1,\n backgroundColor: '#fff',\n alignItems: 'center',\n justifyContent: 'center',\n },\n radioOption: {\n flexDirection: 'row',\n marginRight: 26,\n },\n radioOptionText: {\n fontFamily: 'sf-medium',\n fontSize: 14,\n color: TEXT_DARKEST,\n },\n});\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst radioButton = connect(mapStateToProps, {})(RadioButton);\nexport { radioButton as RadioButton };\n"]}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import { View, Text, Image, TouchableOpacity } from 'react-native';
|
|
5
|
+
import { connect } from 'react-redux';
|
|
6
|
+
import _ from 'lodash';
|
|
7
|
+
import { getReactions, getShadowStyle } from '../helper';
|
|
8
|
+
import { BG_GREY, TEXT_DARK, getMainBrandingColourFromState } from '../colours';
|
|
9
|
+
import { reactionActions } from '../apis';
|
|
10
|
+
|
|
11
|
+
class Reaction extends Component {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "onPressReaction", () => {
|
|
16
|
+
if (!this.props.reactions[this.props.userId]) {
|
|
17
|
+
reactionActions.add(this.props.entityId, this.props.entityType, this.props.reaction.key, this.props.site);
|
|
18
|
+
this.props.onLike();
|
|
19
|
+
} else {
|
|
20
|
+
reactionActions.remove(this.props.entityId, this.props.entityType, this.props.reaction.key);
|
|
21
|
+
this.props.onUnlike();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getStyleType() {
|
|
27
|
+
if (this.props.reactions[this.props.userId]) {
|
|
28
|
+
return 'ThisHL';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (this.props.anyHighlighted) {
|
|
32
|
+
return 'OtherHL';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return 'Default';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getTopReaction() {
|
|
39
|
+
return _.maxBy(Object.keys(this.props.reactions), key => {
|
|
40
|
+
return Object.keys(this.props.reactions[key]).length;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
getIcon(topReaction) {
|
|
45
|
+
return _.find(getReactions(), r => {
|
|
46
|
+
return r.key === topReaction;
|
|
47
|
+
}).icon;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
render() {
|
|
51
|
+
if (this.props.topReactionOnly) {
|
|
52
|
+
const topReaction = this.getTopReaction();
|
|
53
|
+
|
|
54
|
+
if (!topReaction) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
59
|
+
style: [styles.container, styles.containerThisHL, this.props.style]
|
|
60
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
61
|
+
style: [styles.image, this.props.imageStyle],
|
|
62
|
+
source: this.getIcon(topReaction)
|
|
63
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
64
|
+
style: [styles.count, this.props.countStyle]
|
|
65
|
+
}, Object.keys(this.props.reactions[topReaction]).length));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
69
|
+
style: styles.touchable,
|
|
70
|
+
onPress: this.onPressReaction,
|
|
71
|
+
disabled: this.props.user.type === 'KIOSK'
|
|
72
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
73
|
+
style: [styles.container, styles[`container${this.getStyleType()}`], this.props.style]
|
|
74
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
75
|
+
style: [styles.image, this.props.imageStyle],
|
|
76
|
+
source: this.props.reaction.icon
|
|
77
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
78
|
+
style: [styles.count, this.getStyleType() === 'ThisHL' && {
|
|
79
|
+
color: this.props.colourBrandingMain
|
|
80
|
+
}, this.props.countStyle]
|
|
81
|
+
}, Object.keys(this.props.reactions).length)));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const styles = {
|
|
87
|
+
touchable: {
|
|
88
|
+
marginHorizontal: 4,
|
|
89
|
+
width: 60,
|
|
90
|
+
height: 30
|
|
91
|
+
},
|
|
92
|
+
container: {
|
|
93
|
+
width: 60,
|
|
94
|
+
height: 30,
|
|
95
|
+
borderRadius: 15,
|
|
96
|
+
backgroundColor: BG_GREY,
|
|
97
|
+
flexDirection: 'row-reverse',
|
|
98
|
+
alignItems: 'center',
|
|
99
|
+
paddingHorizontal: 8
|
|
100
|
+
},
|
|
101
|
+
containerThisHL: { ...getShadowStyle()
|
|
102
|
+
},
|
|
103
|
+
containerOtherHL: {
|
|
104
|
+
opacity: 0.5
|
|
105
|
+
},
|
|
106
|
+
image: {
|
|
107
|
+
width: 20,
|
|
108
|
+
height: 20,
|
|
109
|
+
resizeMode: 'contain'
|
|
110
|
+
},
|
|
111
|
+
count: {
|
|
112
|
+
fontFamily: 'sf-medium',
|
|
113
|
+
color: TEXT_DARK,
|
|
114
|
+
flex: 1,
|
|
115
|
+
textAlign: 'center',
|
|
116
|
+
fontSize: 16
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const mapStateToProps = state => {
|
|
121
|
+
return {
|
|
122
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
123
|
+
user: state.user
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const reaction = connect(mapStateToProps, {})(Reaction);
|
|
128
|
+
export { reaction as Reaction };
|
|
129
|
+
//# sourceMappingURL=Reaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Reaction.js"],"names":["React","Component","View","Text","Image","TouchableOpacity","connect","_","getReactions","getShadowStyle","BG_GREY","TEXT_DARK","getMainBrandingColourFromState","reactionActions","Reaction","props","reactions","userId","add","entityId","entityType","reaction","key","site","onLike","remove","onUnlike","getStyleType","anyHighlighted","getTopReaction","maxBy","Object","keys","length","getIcon","topReaction","find","r","icon","render","topReactionOnly","styles","container","containerThisHL","style","image","imageStyle","count","countStyle","touchable","onPressReaction","user","type","color","colourBrandingMain","marginHorizontal","width","height","borderRadius","backgroundColor","flexDirection","alignItems","paddingHorizontal","containerOtherHL","opacity","resizeMode","fontFamily","flex","textAlign","fontSize","mapStateToProps","state"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,KAArB,EAA4BC,gBAA5B,QAAoD,cAApD;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,OAAOC,CAAP,MAAc,QAAd;AACA,SAASC,YAAT,EAAuBC,cAAvB,QAA6C,WAA7C;AACA,SAASC,OAAT,EAAkBC,SAAlB,EAA6BC,8BAA7B,QAAmE,YAAnE;AACA,SAASC,eAAT,QAAgC,SAAhC;;AAEA,MAAMC,QAAN,SAAuBb,SAAvB,CAAiC;AAAA;AAAA;;AAAA,6CACb,MAAM;AACtB,UAAI,CAAC,KAAKc,KAAL,CAAWC,SAAX,CAAqB,KAAKD,KAAL,CAAWE,MAAhC,CAAL,EAA8C;AAC5CJ,QAAAA,eAAe,CAACK,GAAhB,CAAoB,KAAKH,KAAL,CAAWI,QAA/B,EAAyC,KAAKJ,KAAL,CAAWK,UAApD,EAAgE,KAAKL,KAAL,CAAWM,QAAX,CAAoBC,GAApF,EAAyF,KAAKP,KAAL,CAAWQ,IAApG;AACA,aAAKR,KAAL,CAAWS,MAAX;AACD,OAHD,MAGO;AACLX,QAAAA,eAAe,CAACY,MAAhB,CAAuB,KAAKV,KAAL,CAAWI,QAAlC,EAA4C,KAAKJ,KAAL,CAAWK,UAAvD,EAAmE,KAAKL,KAAL,CAAWM,QAAX,CAAoB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AK,EAAE,EAFE;AAGTC,IAAAA,MAAM,EAAE;AAHC,GADE;AAMbf,EAAAA,SAAS,EAAE;AACTc,IAAAA,KAAK,EAAE,EADE;AAETC,IAAAA,MAAM,EAAE,EAFC;AAGTC,IAAAA,YAAY,EAAE,EAHL;AAITC,IAAAA,eAAe,EAAEjD,OAJR;AAKTkD,IAAAA,aAAa,EAAE,aALN;AAMTC,IAAAA,UAAU,EAAE,QANH;AAOTC,IAAAA,iBAAiB,EAAE;AAPV,GANE;AAebnB,EAAAA,eAAe,EAAE,EACf,GAAGlC,cAAc;AADF,GAfJ;AAkBbsD,EAAAA,gBAAgB,EAAE;AAChBC,IAAAA,OAAO,EAAE;AADO,GAlBL;AAqBbnB,EAAAA,KAAK,EAAE;AACLW,IAAAA,KAAK,EAAE,EADF;AAELC,IAAAA,MAAM,EAAE,EAFH;AAGLQ,IAAAA,UAAU,EAAE;AAHP,GArBM;AA0BblB,EAAAA,KAAK,EAAE;AACLmB,IAAAA,UAAU,EAAE,WADP;AAELb,IAAAA,KAAK,EAAE1C,SAFF;AAGLwD,IAAAA,IAAI,EAAE,CAHD;AAILC,IAAAA,SAAS,EAAE,QAJN;AAKLC,IAAAA,QAAQ,EAAE;AALL;AA1BM,CAAf;;AAmCA,MAAMC,eAAe,GAAGC,KAAK,IAAI;AAC/B,SAAO;AACLjB,IAAAA,kBAAkB,EAAE1C,8BAA8B,CAAC2D,KAAD,CAD7C;AAELpB,IAAAA,IAAI,EAAEoB,KAAK,CAACpB;AAFP,GAAP;AAID,CALD;;AAOA,MAAM9B,QAAQ,GAAGf,OAAO,CAACgE,eAAD,EAAkB,EAAlB,CAAP,CAA6BxD,QAA7B,CAAjB;AACA,SAASO,QAAQ,IAAIP,QAArB","sourcesContent":["import React, { Component } from 'react';\nimport { View, Text, Image, TouchableOpacity } from 'react-native';\nimport { connect } from 'react-redux';\nimport _ from 'lodash';\nimport { getReactions, getShadowStyle } from '../helper';\nimport { BG_GREY, TEXT_DARK, getMainBrandingColourFromState } from '../colours';\nimport { reactionActions } from '../apis';\n\nclass Reaction extends Component {\n onPressReaction = () => {\n if (!this.props.reactions[this.props.userId]) {\n reactionActions.add(this.props.entityId, this.props.entityType, this.props.reaction.key, this.props.site);\n this.props.onLike();\n } else {\n reactionActions.remove(this.props.entityId, this.props.entityType, this.props.reaction.key);\n this.props.onUnlike();\n }\n };\n\n getStyleType() {\n if (this.props.reactions[this.props.userId]) {\n return 'ThisHL';\n }\n if (this.props.anyHighlighted) {\n return 'OtherHL';\n }\n return 'Default';\n }\n\n getTopReaction() {\n return _.maxBy(Object.keys(this.props.reactions), key => {\n return Object.keys(this.props.reactions[key]).length;\n });\n }\n\n getIcon(topReaction) {\n return _.find(getReactions(), r => {\n return r.key === topReaction;\n }).icon;\n }\n\n render() {\n if (this.props.topReactionOnly) {\n const topReaction = this.getTopReaction();\n if (!topReaction) {\n return null;\n }\n return (\n <View style={[styles.container, styles.containerThisHL, this.props.style]}>\n <Image style={[styles.image, this.props.imageStyle]} source={this.getIcon(topReaction)} />\n <Text style={[styles.count, this.props.countStyle]}>{Object.keys(this.props.reactions[topReaction]).length}</Text>\n </View>\n );\n }\n return (\n <TouchableOpacity style={styles.touchable} onPress={this.onPressReaction} disabled={this.props.user.type === 'KIOSK'}>\n <View style={[styles.container, styles[`container${this.getStyleType()}`], this.props.style]}>\n <Image style={[styles.image, this.props.imageStyle]} source={this.props.reaction.icon} />\n <Text style={[styles.count, this.getStyleType() === 'ThisHL' && { color: this.props.colourBrandingMain }, this.props.countStyle]}>\n {Object.keys(this.props.reactions).length}\n </Text>\n </View>\n </TouchableOpacity>\n );\n }\n}\n\nconst styles = {\n touchable: {\n marginHorizontal: 4,\n width: 60,\n height: 30,\n },\n container: {\n width: 60,\n height: 30,\n borderRadius: 15,\n backgroundColor: BG_GREY,\n flexDirection: 'row-reverse',\n alignItems: 'center',\n paddingHorizontal: 8,\n },\n containerThisHL: {\n ...getShadowStyle(),\n },\n containerOtherHL: {\n opacity: 0.5,\n },\n image: {\n width: 20,\n height: 20,\n resizeMode: 'contain',\n },\n count: {\n fontFamily: 'sf-medium',\n color: TEXT_DARK,\n flex: 1,\n textAlign: 'center',\n fontSize: 16,\n },\n};\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n user: state.user,\n };\n};\n\nconst reaction = connect(mapStateToProps, {})(Reaction);\nexport { reaction as Reaction };\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { getReactions, getUserPreview } from '../helper';
|
|
6
|
+
import { Reaction } from './Reaction';
|
|
7
|
+
|
|
8
|
+
class Reactions extends Component {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
|
|
12
|
+
_defineProperty(this, "state", {
|
|
13
|
+
reactions: getReactions()
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getReaction(key) {
|
|
18
|
+
if (!this.props.entity) {
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!this.props.entity.Reactions) {
|
|
23
|
+
this.props.entity.Reactions = {};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return this.props.entity.Reactions[key] || {};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
onLike(key) {
|
|
30
|
+
if (!this.props.entity.Reactions) {
|
|
31
|
+
this.props.entity.Reactions = {};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!this.props.entity.Reactions[key]) {
|
|
35
|
+
this.props.entity.Reactions[key] = {};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
this.props.entity.Reactions[key][this.props.user.uid] = getUserPreview(this.props.user);
|
|
39
|
+
this.props.onUpdateReactions();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
onUnlike(key) {
|
|
43
|
+
if (!this.props.entity.Reactions) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!this.props.entity.Reactions[key]) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
delete this.props.entity.Reactions[key][this.props.user.uid];
|
|
52
|
+
this.props.onUpdateReactions();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
render() {
|
|
56
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
57
|
+
style: [styles.container, this.props.style]
|
|
58
|
+
}, this.state.reactions.map((r, i) => {
|
|
59
|
+
return /*#__PURE__*/React.createElement(Reaction, {
|
|
60
|
+
key: i,
|
|
61
|
+
reaction: r,
|
|
62
|
+
entityType: this.props.entityType,
|
|
63
|
+
entityId: this.props.entityId,
|
|
64
|
+
reactions: this.getReaction(r.key),
|
|
65
|
+
anyHighlighted: this.props.anyHighlighted,
|
|
66
|
+
userId: this.props.user.uid,
|
|
67
|
+
onLike: this.onLike.bind(this, r.key),
|
|
68
|
+
onUnlike: this.onUnlike.bind(this, r.key),
|
|
69
|
+
site: this.props.site
|
|
70
|
+
});
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const styles = {
|
|
77
|
+
container: {
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
justifyContent: 'center',
|
|
80
|
+
width: '100%'
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
export { Reactions };
|
|
84
|
+
//# sourceMappingURL=Reactions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Reactions.js"],"names":["React","Component","View","getReactions","getUserPreview","Reaction","Reactions","reactions","getReaction","key","props","entity","onLike","user","uid","onUpdateReactions","onUnlike","render","styles","container","style","state","map","r","i","entityType","entityId","anyHighlighted","b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,CADF;AAoBD;;AA1D+B;;AA6DlC,MAAMX,MAAM,GAAG;AACbC,EAAAA,SAAS,EAAE;AACTW,IAAAA,aAAa,EAAE,KADN;AAETC,IAAAA,cAAc,EAAE,QAFP;AAGTC,IAAAA,KAAK,EAAE;AAHE;AADE,CAAf;AAQA,SAAS1B,SAAT","sourcesContent":["import React, { Component } from 'react';\nimport { View } from 'react-native';\nimport { getReactions, getUserPreview } from '../helper';\nimport { Reaction } from './Reaction';\n\nclass Reactions extends Component {\n state = {\n reactions: getReactions(),\n };\n\n getReaction(key) {\n if (!this.props.entity) {\n return {};\n }\n if (!this.props.entity.Reactions) {\n this.props.entity.Reactions = {};\n }\n return this.props.entity.Reactions[key] || {};\n }\n\n onLike(key) {\n if (!this.props.entity.Reactions) {\n this.props.entity.Reactions = {};\n }\n if (!this.props.entity.Reactions[key]) {\n this.props.entity.Reactions[key] = {};\n }\n this.props.entity.Reactions[key][this.props.user.uid] = getUserPreview(this.props.user);\n this.props.onUpdateReactions();\n }\n\n onUnlike(key) {\n if (!this.props.entity.Reactions) {\n return;\n }\n if (!this.props.entity.Reactions[key]) {\n return;\n }\n delete this.props.entity.Reactions[key][this.props.user.uid];\n this.props.onUpdateReactions();\n }\n\n render() {\n return (\n <View style={[styles.container, this.props.style]}>\n {this.state.reactions.map((r, i) => {\n return (\n <Reaction\n key={i}\n reaction={r}\n entityType={this.props.entityType}\n entityId={this.props.entityId}\n reactions={this.getReaction(r.key)}\n anyHighlighted={this.props.anyHighlighted}\n userId={this.props.user.uid}\n onLike={this.onLike.bind(this, r.key)}\n onUnlike={this.onUnlike.bind(this, r.key)}\n site={this.props.site}\n />\n );\n })}\n </View>\n );\n }\n}\n\nconst styles = {\n container: {\n flexDirection: 'row',\n justifyContent: 'center',\n width: '100%',\n },\n};\n\nexport { Reactions };\n"]}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import _ from 'lodash';
|
|
5
|
+
import { TouchableOpacity, StyleSheet, View, Text } from 'react-native';
|
|
6
|
+
import { Icon } from 'react-native-elements';
|
|
7
|
+
import * as FileSystem from 'expo-file-system';
|
|
8
|
+
import * as Sharing from 'expo-sharing';
|
|
9
|
+
import * as MediaLibrary from 'expo-media-library';
|
|
10
|
+
import { StatusBarHeight, isVideo, getMimeType } from '../helper';
|
|
11
|
+
import { MiddlePopup } from './MiddlePopup';
|
|
12
|
+
import Config from '../config';
|
|
13
|
+
|
|
14
|
+
class SharingTools extends Component {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
|
|
18
|
+
_defineProperty(this, "downloadMedia", async () => {
|
|
19
|
+
const remoteUrl = this.props.uri;
|
|
20
|
+
const parts = remoteUrl.split('/').splice(-2);
|
|
21
|
+
const mediaId = parts[0];
|
|
22
|
+
const extension = parts[1].split('.').splice(-1)[0];
|
|
23
|
+
const downloadPath = `${FileSystem.cacheDirectory}${mediaId}.${extension}`;
|
|
24
|
+
const {
|
|
25
|
+
uri: localUrl
|
|
26
|
+
} = await FileSystem.downloadAsync(remoteUrl, downloadPath);
|
|
27
|
+
return {
|
|
28
|
+
localUrl,
|
|
29
|
+
extension
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
_defineProperty(this, "onSave", () => {
|
|
34
|
+
this.setState({
|
|
35
|
+
message: 'Saving...'
|
|
36
|
+
}, async () => {
|
|
37
|
+
const {
|
|
38
|
+
localUrl
|
|
39
|
+
} = await this.downloadMedia();
|
|
40
|
+
await MediaLibrary.saveToLibraryAsync(localUrl);
|
|
41
|
+
this.setState({
|
|
42
|
+
message: 'Saved'
|
|
43
|
+
}, () => {
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
this.setState({
|
|
46
|
+
message: ''
|
|
47
|
+
});
|
|
48
|
+
}, 2000);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
_defineProperty(this, "onShare", async () => {
|
|
54
|
+
if (!(await Sharing.isAvailableAsync())) return;
|
|
55
|
+
this.setState({
|
|
56
|
+
message: 'Preparing...'
|
|
57
|
+
}, async () => {
|
|
58
|
+
const {
|
|
59
|
+
localUrl,
|
|
60
|
+
extension
|
|
61
|
+
} = await this.downloadMedia(); // console.log('sharing...', localUrl);
|
|
62
|
+
|
|
63
|
+
const video = isVideo(localUrl);
|
|
64
|
+
const mimeType = getMimeType(localUrl);
|
|
65
|
+
const fileDetails = {
|
|
66
|
+
extension: `.${extension}`,
|
|
67
|
+
shareOptions: {
|
|
68
|
+
mimeType,
|
|
69
|
+
dialogTitle: video ? 'Share video' : 'Share photo',
|
|
70
|
+
UTI: mimeType
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
await Sharing.shareAsync(localUrl, fileDetails.shareOptions);
|
|
74
|
+
this.setState({
|
|
75
|
+
message: ''
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
this.state = {
|
|
81
|
+
message: ''
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
renderTools() {
|
|
86
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
87
|
+
style: styles.toolsContainer
|
|
88
|
+
}, Config.env.allowMediaDownload && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
89
|
+
onPress: this.onSave,
|
|
90
|
+
activeOpacity: 0.6
|
|
91
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
92
|
+
name: "download",
|
|
93
|
+
type: "font-awesome",
|
|
94
|
+
iconStyle: styles.toolIcon,
|
|
95
|
+
style: styles.toolIconContainer
|
|
96
|
+
})), Config.env.allowMediaSharing && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
97
|
+
onPress: this.onShare,
|
|
98
|
+
activeOpacity: 0.6
|
|
99
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
100
|
+
name: "share-square-o",
|
|
101
|
+
type: "font-awesome",
|
|
102
|
+
iconStyle: styles.toolIcon,
|
|
103
|
+
style: styles.toolIconContainer
|
|
104
|
+
})));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
renderMessage() {
|
|
108
|
+
return /*#__PURE__*/React.createElement(MiddlePopup, {
|
|
109
|
+
visible: !_.isEmpty(this.state.message)
|
|
110
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
111
|
+
style: styles.messageContainer
|
|
112
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
113
|
+
style: styles.messageText
|
|
114
|
+
}, this.state.message)));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
render() {
|
|
118
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
119
|
+
style: styles.container
|
|
120
|
+
}, this.renderTools(), this.renderMessage());
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const styles = StyleSheet.create({
|
|
126
|
+
container: {
|
|
127
|
+
position: 'absolute'
|
|
128
|
+
},
|
|
129
|
+
toolsContainer: {
|
|
130
|
+
position: 'absolute',
|
|
131
|
+
flexDirection: 'row',
|
|
132
|
+
justifyContent: 'space-between',
|
|
133
|
+
left: 0,
|
|
134
|
+
zIndex: 3,
|
|
135
|
+
top: StatusBarHeight(0)
|
|
136
|
+
},
|
|
137
|
+
toolIconContainer: {
|
|
138
|
+
width: 55,
|
|
139
|
+
height: 55
|
|
140
|
+
},
|
|
141
|
+
toolIcon: {
|
|
142
|
+
fontSize: 25,
|
|
143
|
+
padding: 15,
|
|
144
|
+
width: 55,
|
|
145
|
+
textAlign: 'center',
|
|
146
|
+
color: '#fff',
|
|
147
|
+
zIndex: 3
|
|
148
|
+
},
|
|
149
|
+
messageContainer: {
|
|
150
|
+
backgroundColor: '#000',
|
|
151
|
+
borderRadius: 10,
|
|
152
|
+
paddingVertical: 10,
|
|
153
|
+
paddingHorizontal: 30
|
|
154
|
+
},
|
|
155
|
+
messageText: {
|
|
156
|
+
fontFamily: 'sf-bold',
|
|
157
|
+
fontSize: 24,
|
|
158
|
+
color: '#fff'
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
export { SharingTools };
|
|
162
|
+
//# sourceMappingURL=SharingTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["SharingTools.js"],"names":["React","Component","_","TouchableOpacity","StyleSheet","View","Text","Icon","FileSystem","Sharing","MediaLibrary","StatusBarHeight","isVideo","getMimeType","MiddlePopup","Config","SharingTools","constructor","props","remoteUrl","uri","parts","split","splice","mediaId","extension","downloadPath","cacheDirectory","localUrl","downloadAsync","setState","message","downloadMedia","saveToLibraryAsync","setTimeout","isAvailableAsync","video","mimeType","fileDetails","shareOptions","dialogTitle","UTI","shareAsync","state","renderTools","styles","toolsContainer","env","allowMediaDownload","onSave","toolIcon","toolIconContainer","allowMediaSharing","onShare","renderMessage","isEmpty","messageContainer","messageText","render","container","create","position","flexDirection","justifyContent","left","zIndex","top","width","height","fontSize","padding","textAlign","color","backgroundColor","borderRadius","paddingVertical","paddingHorizontal","fontFamily"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,CAAP,MAAc,QAAd;AACA,SAASC,gBAAT,EAA2BC,UAA3B,EAAuCC,IAAvC,EAA6CC,IAA7C,QAAyD,cAAzD;AACA,SAASC,IAAT,QAAqB,uBAArB;AACA,OAAO,KAAKC,UAAZ,MAA4B,kBAA5B;AACA,OAAO,KAAKC,OAAZ,MAAyB,cAAzB;AACA,OAAO,KAAKC,YAAZ,MAA8B,oBAA9B;AACA,SAASC,eAAT,EAA0BC,OAA1B,EAAmCC,WAAnC,QAAsD,WAAtD;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,OAAOC,MAAP,MAAmB,WAAnB;;AAEA,MAAMC,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IAAAA,MAAM,EAAE;AAFS,GAZY;AAgB/BlB,EAAAA,QAAQ,EAAE;AACRmB,IAAAA,QAAQ,EAAE,EADF;AAERC,IAAAA,OAAO,EAAE,EAFD;AAGRH,IAAAA,KAAK,EAAE,EAHC;AAIRI,IAAAA,SAAS,EAAE,QAJH;AAKRC,IAAAA,KAAK,EAAE,MALC;AAMRP,IAAAA,MAAM,EAAE;AANA,GAhBqB;AAwB/BT,EAAAA,gBAAgB,EAAE;AAChBiB,IAAAA,eAAe,EAAE,MADD;AAEhBC,IAAAA,YAAY,EAAE,EAFE;AAGhBC,IAAAA,eAAe,EAAE,EAHD;AAIhBC,IAAAA,iBAAiB,EAAE;AAJH,GAxBa;AA8B/BnB,EAAAA,WAAW,EAAE;AACXoB,IAAAA,UAAU,EAAE,SADD;AAEXR,IAAAA,QAAQ,EAAE,EAFC;AAGXG,IAAAA,KAAK,EAAE;AAHI;AA9BkB,CAAlB,CAAf;AAqCA,SAASxD,YAAT","sourcesContent":["import React, { Component } from 'react';\nimport _ from 'lodash';\nimport { TouchableOpacity, StyleSheet, View, Text } from 'react-native';\nimport { Icon } from 'react-native-elements';\nimport * as FileSystem from 'expo-file-system';\nimport * as Sharing from 'expo-sharing';\nimport * as MediaLibrary from 'expo-media-library';\nimport { StatusBarHeight, isVideo, getMimeType } from '../helper';\nimport { MiddlePopup } from './MiddlePopup';\nimport Config from '../config';\n\nclass SharingTools extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n message: '',\n };\n }\n\n downloadMedia = async () => {\n const remoteUrl = this.props.uri;\n const parts = remoteUrl.split('/').splice(-2);\n const mediaId = parts[0];\n const extension = parts[1].split('.').splice(-1)[0];\n\n const downloadPath = `${FileSystem.cacheDirectory}${mediaId}.${extension}`;\n const { uri: localUrl } = await FileSystem.downloadAsync(remoteUrl, downloadPath);\n return { localUrl, extension };\n };\n\n onSave = () => {\n this.setState({ message: 'Saving...' }, async () => {\n const { localUrl } = await this.downloadMedia();\n await MediaLibrary.saveToLibraryAsync(localUrl);\n\n this.setState({ message: 'Saved' }, () => {\n setTimeout(() => {\n this.setState({ message: '' });\n }, 2000);\n });\n });\n };\n\n onShare = async () => {\n if (!(await Sharing.isAvailableAsync())) return;\n\n this.setState({ message: 'Preparing...' }, async () => {\n const { localUrl, extension } = await this.downloadMedia();\n // console.log('sharing...', localUrl);\n\n const video = isVideo(localUrl);\n const mimeType = getMimeType(localUrl);\n const fileDetails = {\n extension: `.${extension}`,\n shareOptions: {\n mimeType,\n dialogTitle: video ? 'Share video' : 'Share photo',\n UTI: mimeType,\n },\n };\n\n await Sharing.shareAsync(localUrl, fileDetails.shareOptions);\n this.setState({ message: '' });\n });\n };\n\n renderTools() {\n return (\n <View style={styles.toolsContainer}>\n {Config.env.allowMediaDownload && (\n <TouchableOpacity onPress={this.onSave} activeOpacity={0.6}>\n <Icon name=\"download\" type=\"font-awesome\" iconStyle={styles.toolIcon} style={styles.toolIconContainer} />\n </TouchableOpacity>\n )}\n {Config.env.allowMediaSharing && (\n <TouchableOpacity onPress={this.onShare} activeOpacity={0.6}>\n <Icon name=\"share-square-o\" type=\"font-awesome\" iconStyle={styles.toolIcon} style={styles.toolIconContainer} />\n </TouchableOpacity>\n )}\n </View>\n );\n }\n\n renderMessage() {\n return (\n <MiddlePopup visible={!_.isEmpty(this.state.message)}>\n <View style={styles.messageContainer}>\n <Text style={styles.messageText}>{this.state.message}</Text>\n </View>\n </MiddlePopup>\n );\n }\n\n render() {\n return (\n <View style={styles.container}>\n {this.renderTools()}\n {this.renderMessage()}\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n position: 'absolute',\n },\n toolsContainer: {\n position: 'absolute',\n flexDirection: 'row',\n justifyContent: 'space-between',\n left: 0,\n zIndex: 3,\n top: StatusBarHeight(0),\n },\n toolIconContainer: {\n width: 55,\n height: 55,\n },\n toolIcon: {\n fontSize: 25,\n padding: 15,\n width: 55,\n textAlign: 'center',\n color: '#fff',\n zIndex: 3,\n },\n messageContainer: {\n backgroundColor: '#000',\n borderRadius: 10,\n paddingVertical: 10,\n paddingHorizontal: 30,\n },\n messageText: {\n fontFamily: 'sf-bold',\n fontSize: 24,\n color: '#fff',\n },\n});\n\nexport { SharingTools };\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { LoadingCircles } from './LoadingCircles';
|
|
4
|
+
|
|
5
|
+
const Spinner = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
color,
|
|
8
|
+
style
|
|
9
|
+
} = _ref;
|
|
10
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
11
|
+
style: [styles.spinnerStyle, style]
|
|
12
|
+
}, /*#__PURE__*/React.createElement(LoadingCircles, {
|
|
13
|
+
color: color
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const styles = {
|
|
18
|
+
spinnerStyle: {
|
|
19
|
+
flex: 1,
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
alignItems: 'center'
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export { Spinner };
|
|
25
|
+
//# sourceMappingURL=Spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Spinner.js"],"names":["React","View","LoadingCircles","Spinner","color","style","styles","spinnerStyle","flex","justifyContent","alignItems"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AACA,SAASC,cAAT,QAA+B,kBAA/B;;AAEA,MAAMC,OAAO,GAAG,QAAsB;AAAA,MAArB;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAqB;AACpC,sBACE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAE,CAACC,MAAM,CAACC,YAAR,EAAsBF,KAAtB;AAAb,kBACE,oBAAC,cAAD;AAAgB,IAAA,KAAK,EAAED;AAAvB,IADF,CADF;AAKD,CAND;;AAQA,MAAME,MAAM,GAAG;AACbC,EAAAA,YAAY,EAAE;AACZC,IAAAA,IAAI,EAAE,CADM;AAEZC,IAAAA,cAAc,EAAE,QAFJ;AAGZC,IAAAA,UAAU,EAAE;AAHA;AADD,CAAf;AAQA,SAASP,OAAT","sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { LoadingCircles } from './LoadingCircles';\n\nconst Spinner = ({ color, style }) => {\n return (\n <View style={[styles.spinnerStyle, style]}>\n <LoadingCircles color={color} />\n </View>\n );\n};\n\nconst styles = {\n spinnerStyle: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n },\n};\n\nexport { Spinner };\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 /*#__PURE__*/React.createElement(View, {
|
|
9
|
+
style: [styles.section, this.props.lineSeparated && styles.lineSeparated, this.props.style]
|
|
10
|
+
}, this.props.children);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const styles = {
|
|
16
|
+
section: {
|
|
17
|
+
backgroundColor: '#fff',
|
|
18
|
+
height: FOOTER_HEIGHT,
|
|
19
|
+
borderTopWidth: 0,
|
|
20
|
+
shadowColor: '#000',
|
|
21
|
+
shadowOffset: {
|
|
22
|
+
width: 0,
|
|
23
|
+
height: -1
|
|
24
|
+
},
|
|
25
|
+
shadowOpacity: 0.1,
|
|
26
|
+
shadowRadius: 6,
|
|
27
|
+
elevation: 16
|
|
28
|
+
},
|
|
29
|
+
lineSeparated: {
|
|
30
|
+
borderTopWidth: 1,
|
|
31
|
+
borderColor: LINEGREY,
|
|
32
|
+
shadowOpacity: 0,
|
|
33
|
+
elevation: 0
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export { StickyFooter };
|
|
37
|
+
//# sourceMappingURL=StickyFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["StickyFooter.js"],"names":["React","PureComponent","View","LINEGREY","FOOTER_HEIGHT","StickyFooter","render","styles","section","props","lineSeparated","style","children","backgroundColor","height","borderTopWidth","shadowColor","shadowOffset","width","shadowOpacity","shadowRadius","elevation","borderColor"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,SAASC,IAAT,QAAqB,cAArB;AACA,SAASC,QAAT,QAAyB,YAAzB;AACA,SAASC,aAAT,QAA8B,cAA9B;;AAEA,MAAMC,YAAN,SAA2BJ,aAA3B,CAAyC;AACvCK,EAAAA,MAAM,GAAG;AACP,wBAAO,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAE,CAACC,MAAM,CAACC,OAAR,EAAiB,KAAKC,KAAL,CAAWC,aAAX,IAA4BH,MAAM,CAACG,aAApD,EAAmE,KAAKD,KAAL,CAAWE,KAA9E;AAAb,OAAoG,KAAKF,KAAL,CAAWG,QAA/G,CAAP;AACD;;AAHsC;;AAMzC,MAAML,MAAM,GAAG;AACbC,EAAAA,OAAO,EAAE;AACPK,IAAAA,eAAe,EAAE,MADV;AAEPC,IAAAA,MAAM,EAAEV,aAFD;AAGPW,IAAAA,cAAc,EAAE,CAHT;AAIPC,IAAAA,WAAW,EAAE,MAJN;AAKPC,IAAAA,YAAY,EAAE;AACZC,MAAAA,KAAK,EAAE,CADK;AAEZJ,MAAAA,MAAM,EAAE,CAAC;AAFG,KALP;AASPK,IAAAA,aAAa,EAAE,GATR;AAUPC,IAAAA,YAAY,EAAE,CAVP;AAWPC,IAAAA,SAAS,EAAE;AAXJ,GADI;AAcbX,EAAAA,aAAa,EAAE;AACbK,IAAAA,cAAc,EAAE,CADH;AAEbO,IAAAA,WAAW,EAAEnB,QAFA;AAGbgB,IAAAA,aAAa,EAAE,CAHF;AAIbE,IAAAA,SAAS,EAAE;AAJE;AAdF,CAAf;AAsBA,SAAShB,YAAT","sourcesContent":["import React, { PureComponent } from 'react';\nimport { View } from 'react-native';\nimport { LINEGREY } from '../colours';\nimport { FOOTER_HEIGHT } from '../constants';\n\nclass StickyFooter extends PureComponent {\n render() {\n return <View style={[styles.section, this.props.lineSeparated && styles.lineSeparated, this.props.style]}>{this.props.children}</View>;\n }\n}\n\nconst styles = {\n section: {\n backgroundColor: '#fff',\n height: FOOTER_HEIGHT,\n borderTopWidth: 0,\n shadowColor: '#000',\n shadowOffset: {\n width: 0,\n height: -1,\n },\n shadowOpacity: 0.1,\n shadowRadius: 6,\n elevation: 16,\n },\n lineSeparated: {\n borderTopWidth: 1,\n borderColor: LINEGREY,\n shadowOpacity: 0,\n elevation: 0,\n },\n};\n\nexport { StickyFooter };\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React, { PureComponent } from 'react';
|
|
4
|
+
import { StyleSheet, Text } from 'react-native';
|
|
5
|
+
import { TEXT_DARKEST } from '../colours';
|
|
6
|
+
|
|
7
|
+
class TextStyle extends PureComponent {
|
|
8
|
+
render() {
|
|
9
|
+
return /*#__PURE__*/React.createElement(Text, _extends({}, this.props, {
|
|
10
|
+
style: [styles[this.props.type], this.props.style]
|
|
11
|
+
}), this.props.children);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const styles = StyleSheet.create({
|
|
17
|
+
pageHeading: {
|
|
18
|
+
fontFamily: 'sf-bold',
|
|
19
|
+
fontSize: 24,
|
|
20
|
+
color: TEXT_DARKEST
|
|
21
|
+
},
|
|
22
|
+
body: {
|
|
23
|
+
fontFamily: 'sf-regular',
|
|
24
|
+
fontSize: 14,
|
|
25
|
+
color: TEXT_DARKEST
|
|
26
|
+
},
|
|
27
|
+
detailLabel: {
|
|
28
|
+
fontFamily: 'sf-bold',
|
|
29
|
+
color: TEXT_DARKEST,
|
|
30
|
+
fontSize: 16
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
export { TextStyle };
|
|
34
|
+
//# sourceMappingURL=TextStyle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["TextStyle.js"],"names":["React","PureComponent","StyleSheet","Text","TEXT_DARKEST","TextStyle","render","props","styles","type","style","children","create","pageHeading","fontFamily","fontSize","color","body","detailLabel"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AACA,SAASC,YAAT,QAA6B,YAA7B;;AAEA,MAAMC,SAAN,SAAwBJ,aAAxB,CAAsC;AACpCK,EAAAA,MAAM,GAAG;AACP,wBACE,oBAAC,IAAD,eAAU,KAAKC,KAAf;AAAsB,MAAA,KAAK,EAAE,CAACC,MAAM,CAAC,KAAKD,KAAL,CAAWE,IAAZ,CAAP,EAA0B,KAAKF,KAAL,CAAWG,KAArC;AAA7B,QACG,KAAKH,KAAL,CAAWI,QADd,CADF;AAKD;;AAPmC;;AAUtC,MAAMH,MAAM,GAAGN,UAAU,CAACU,MAAX,CAAkB;AAC/BC,EAAAA,WAAW,EAAE;AACXC,IAAAA,UAAU,EAAE,SADD;AAEXC,IAAAA,QAAQ,EAAE,EAFC;AAGXC,IAAAA,KAAK,EAAEZ;AAHI,GADkB;AAM/Ba,EAAAA,IAAI,EAAE;AACJH,IAAAA,UAAU,EAAE,YADR;AAEJC,IAAAA,QAAQ,EAAE,EAFN;AAGJC,IAAAA,KAAK,EAAEZ;AAHH,GANyB;AAW/Bc,EAAAA,WAAW,EAAE;AACXJ,IAAAA,UAAU,EAAE,SADD;AAEXE,IAAAA,KAAK,EAAEZ,YAFI;AAGXW,IAAAA,QAAQ,EAAE;AAHC;AAXkB,CAAlB,CAAf;AAkBA,SAASV,SAAT","sourcesContent":["import React, { PureComponent } from 'react';\nimport { StyleSheet, Text } from 'react-native';\nimport { TEXT_DARKEST } from '../colours';\n\nclass TextStyle extends PureComponent {\n render() {\n return (\n <Text {...this.props} style={[styles[this.props.type], this.props.style]}>\n {this.props.children}\n </Text>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n pageHeading: {\n fontFamily: 'sf-bold',\n fontSize: 24,\n color: TEXT_DARKEST,\n },\n body: {\n fontFamily: 'sf-regular',\n fontSize: 14,\n color: TEXT_DARKEST,\n },\n detailLabel: {\n fontFamily: 'sf-bold',\n color: TEXT_DARKEST,\n fontSize: 16,\n },\n});\n\nexport { TextStyle };\n"]}
|