@plusscommunities/pluss-core-app 8.0.27 → 8.0.28-beta.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/package.json +1 -1
- package/src/components/react-native-expo-image-cropper/ExpoImageManipulator.js +29 -26
- package/dist/module/actions/FollowerActions.js +0 -34
- package/dist/module/actions/FollowerActions.js.map +0 -1
- package/dist/module/actions/MediaActions.js +0 -29
- package/dist/module/actions/MediaActions.js.map +0 -1
- package/dist/module/actions/ResidentActions.js +0 -26
- package/dist/module/actions/ResidentActions.js.map +0 -1
- package/dist/module/actions/UserActions.js +0 -223
- package/dist/module/actions/UserActions.js.map +0 -1
- package/dist/module/actions/UserSettingsActions.js +0 -14
- package/dist/module/actions/UserSettingsActions.js.map +0 -1
- package/dist/module/actions/index.js +0 -6
- package/dist/module/actions/index.js.map +0 -1
- package/dist/module/actions/types.js +0 -17
- package/dist/module/actions/types.js.map +0 -1
- package/dist/module/apis/analyticsActions.js +0 -20
- package/dist/module/apis/analyticsActions.js.map +0 -1
- package/dist/module/apis/contactActions.js +0 -27
- package/dist/module/apis/contactActions.js.map +0 -1
- package/dist/module/apis/eventActions.js +0 -161
- package/dist/module/apis/eventActions.js.map +0 -1
- package/dist/module/apis/fileActions.js +0 -93
- package/dist/module/apis/fileActions.js.map +0 -1
- package/dist/module/apis/followerActions.js +0 -38
- package/dist/module/apis/followerActions.js.map +0 -1
- package/dist/module/apis/index.js +0 -13
- package/dist/module/apis/index.js.map +0 -1
- package/dist/module/apis/notificationActions.js +0 -60
- package/dist/module/apis/notificationActions.js.map +0 -1
- package/dist/module/apis/profileActions.js +0 -14
- package/dist/module/apis/profileActions.js.map +0 -1
- package/dist/module/apis/reactionActions.js +0 -76
- package/dist/module/apis/reactionActions.js.map +0 -1
- package/dist/module/apis/settingActions.js +0 -22
- package/dist/module/apis/settingActions.js.map +0 -1
- package/dist/module/apis/stringActions.js +0 -30
- package/dist/module/apis/stringActions.js.map +0 -1
- package/dist/module/apis/typeActions.js +0 -15
- package/dist/module/apis/typeActions.js.map +0 -1
- package/dist/module/apis/userActions.js +0 -104
- package/dist/module/apis/userActions.js.map +0 -1
- package/dist/module/assets/icons/fontawesome/fa-brands-400.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-light-300.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-regular-400.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-solid-900.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-thin-100.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa7-glyphmap.json +0 -4205
- package/dist/module/assets/icons/reactions/heart.png +0 -0
- package/dist/module/assets/icons/reactions/party.png +0 -0
- package/dist/module/assets/icons/reactions/sad.png +0 -0
- package/dist/module/assets/icons/reactions/smile.png +0 -0
- package/dist/module/colours.js +0 -165
- package/dist/module/colours.js.map +0 -1
- package/dist/module/components/AddButton.js +0 -43
- package/dist/module/components/AddButton.js.map +0 -1
- package/dist/module/components/AddToCalendarButton.js +0 -225
- package/dist/module/components/AddToCalendarButton.js.map +0 -1
- package/dist/module/components/Attachment.js +0 -55
- package/dist/module/components/Attachment.js.map +0 -1
- package/dist/module/components/AudienceSelectorLauncher.js +0 -64
- package/dist/module/components/AudienceSelectorLauncher.js.map +0 -1
- package/dist/module/components/AudienceSelectorPage.js +0 -351
- package/dist/module/components/AudienceSelectorPage.js.map +0 -1
- package/dist/module/components/AutoOffsetImage.js +0 -184
- package/dist/module/components/AutoOffsetImage.js.map +0 -1
- package/dist/module/components/BackButton.js +0 -58
- package/dist/module/components/BackButton.js.map +0 -1
- package/dist/module/components/CalendarPopup.js +0 -126
- package/dist/module/components/CalendarPopup.js.map +0 -1
- package/dist/module/components/CategoryTabs.js +0 -155
- package/dist/module/components/CategoryTabs.js.map +0 -1
- package/dist/module/components/CommentReply.js +0 -334
- package/dist/module/components/CommentReply.js.map +0 -1
- package/dist/module/components/CommentSection.js +0 -823
- package/dist/module/components/CommentSection.js.map +0 -1
- package/dist/module/components/ConfirmPopup.js +0 -109
- package/dist/module/components/ConfirmPopup.js.map +0 -1
- package/dist/module/components/ConfirmationPopup.js +0 -72
- package/dist/module/components/ConfirmationPopup.js.map +0 -1
- package/dist/module/components/DocumentUploader.js +0 -253
- package/dist/module/components/DocumentUploader.js.map +0 -1
- package/dist/module/components/DropDownItem.js +0 -75
- package/dist/module/components/DropDownItem.js.map +0 -1
- package/dist/module/components/DropDownMenu.js +0 -41
- package/dist/module/components/DropDownMenu.js.map +0 -1
- package/dist/module/components/EmptyStateMain.js +0 -51
- package/dist/module/components/EmptyStateMain.js.map +0 -1
- package/dist/module/components/EmptyStateWidget.js +0 -48
- package/dist/module/components/EmptyStateWidget.js.map +0 -1
- package/dist/module/components/FontScaleButton.js +0 -37
- package/dist/module/components/FontScaleButton.js.map +0 -1
- package/dist/module/components/FontScalePopup.js +0 -76
- package/dist/module/components/FontScalePopup.js.map +0 -1
- package/dist/module/components/Forbidden.js +0 -58
- package/dist/module/components/Forbidden.js.map +0 -1
- package/dist/module/components/FormCard.js +0 -25
- package/dist/module/components/FormCard.js.map +0 -1
- package/dist/module/components/FormCardSection.js +0 -214
- package/dist/module/components/FormCardSection.js.map +0 -1
- package/dist/module/components/FormCardSectionOptionLauncher.js +0 -73
- package/dist/module/components/FormCardSectionOptionLauncher.js.map +0 -1
- package/dist/module/components/FormattedText.js +0 -133
- package/dist/module/components/FormattedText.js.map +0 -1
- package/dist/module/components/GenericInput.js +0 -151
- package/dist/module/components/GenericInput.js.map +0 -1
- package/dist/module/components/GenericInputSection.js +0 -173
- package/dist/module/components/GenericInputSection.js.map +0 -1
- package/dist/module/components/Header.js +0 -459
- package/dist/module/components/Header.js.map +0 -1
- package/dist/module/components/Icon.js +0 -109
- package/dist/module/components/Icon.js.map +0 -1
- package/dist/module/components/ImagePopup.js +0 -400
- package/dist/module/components/ImagePopup.js.map +0 -1
- package/dist/module/components/ImageUploadProgress.js +0 -69
- package/dist/module/components/ImageUploadProgress.js.map +0 -1
- package/dist/module/components/ImageUploader.js +0 -831
- package/dist/module/components/ImageUploader.js.map +0 -1
- package/dist/module/components/InlineButton.js +0 -66
- package/dist/module/components/InlineButton.js.map +0 -1
- package/dist/module/components/Input.js +0 -156
- package/dist/module/components/Input.js.map +0 -1
- package/dist/module/components/LoadingCircles.js +0 -219
- package/dist/module/components/LoadingCircles.js.map +0 -1
- package/dist/module/components/LoadingIndicator.js +0 -86
- package/dist/module/components/LoadingIndicator.js.map +0 -1
- package/dist/module/components/LoadingStateWidget.js +0 -46
- package/dist/module/components/LoadingStateWidget.js.map +0 -1
- package/dist/module/components/MediaPlayer.js +0 -407
- package/dist/module/components/MediaPlayer.js.map +0 -1
- package/dist/module/components/MiddlePopup.js +0 -49
- package/dist/module/components/MiddlePopup.js.map +0 -1
- package/dist/module/components/PDFPopup.js +0 -203
- package/dist/module/components/PDFPopup.js.map +0 -1
- package/dist/module/components/PlussChat.js +0 -1078
- package/dist/module/components/PlussChat.js.map +0 -1
- package/dist/module/components/PlussChatMessage.js +0 -299
- package/dist/module/components/PlussChatMessage.js.map +0 -1
- package/dist/module/components/PlussChatTime.js +0 -59
- package/dist/module/components/PlussChatTime.js.map +0 -1
- package/dist/module/components/Popup.js +0 -126
- package/dist/module/components/Popup.js.map +0 -1
- package/dist/module/components/PopupMenu.js +0 -120
- package/dist/module/components/PopupMenu.js.map +0 -1
- package/dist/module/components/PositionedImage.js +0 -313
- package/dist/module/components/PositionedImage.js.map +0 -1
- package/dist/module/components/ProfilePic.js +0 -105
- package/dist/module/components/ProfilePic.js.map +0 -1
- package/dist/module/components/RadioButton.js +0 -78
- package/dist/module/components/RadioButton.js.map +0 -1
- package/dist/module/components/Reaction.js +0 -117
- package/dist/module/components/Reaction.js.map +0 -1
- package/dist/module/components/Reactions.js +0 -71
- package/dist/module/components/Reactions.js.map +0 -1
- package/dist/module/components/SharingTools.js +0 -189
- package/dist/module/components/SharingTools.js.map +0 -1
- package/dist/module/components/Spinner.js +0 -22
- package/dist/module/components/Spinner.js.map +0 -1
- package/dist/module/components/StickyFooter.js +0 -34
- package/dist/module/components/StickyFooter.js.map +0 -1
- package/dist/module/components/Text.js +0 -57
- package/dist/module/components/Text.js.map +0 -1
- package/dist/module/components/TickIcon.js +0 -24
- package/dist/module/components/TickIcon.js.map +0 -1
- package/dist/module/components/Toggle.js +0 -66
- package/dist/module/components/Toggle.js.map +0 -1
- package/dist/module/components/TouchableSearchBar.js +0 -68
- package/dist/module/components/TouchableSearchBar.js.map +0 -1
- package/dist/module/components/UserListPopup.js +0 -136
- package/dist/module/components/UserListPopup.js.map +0 -1
- package/dist/module/components/UserListing.js +0 -268
- package/dist/module/components/UserListing.js.map +0 -1
- package/dist/module/components/VideoPopup.js +0 -113
- package/dist/module/components/VideoPopup.js.map +0 -1
- package/dist/module/components/WarningPopup.js +0 -85
- package/dist/module/components/WarningPopup.js.map +0 -1
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +0 -289
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +0 -1
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js +0 -117
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +0 -1
- package/dist/module/components/index.js +0 -60
- package/dist/module/components/index.js.map +0 -1
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +0 -415
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +0 -1
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +0 -387
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +0 -1
- package/dist/module/config.js +0 -27
- package/dist/module/config.js.map +0 -1
- package/dist/module/constants.js +0 -18
- package/dist/module/constants.js.map +0 -1
- package/dist/module/helper.js +0 -424
- package/dist/module/helper.js.map +0 -1
- package/dist/module/index.js +0 -13
- package/dist/module/index.js.map +0 -1
- package/dist/module/js/images/detectFaces.js +0 -31
- package/dist/module/js/images/detectFaces.js.map +0 -1
- package/dist/module/js/images/findLandmarkRange.js +0 -93
- package/dist/module/js/images/findLandmarkRange.js.map +0 -1
- package/dist/module/js/images/getScaledOffset.js +0 -81
- package/dist/module/js/images/getScaledOffset.js.map +0 -1
- package/dist/module/js/site/getSiteLevelFromState.js +0 -29
- package/dist/module/js/site/getSiteLevelFromState.js.map +0 -1
- package/dist/module/js/site/isTVEnabled.js +0 -10
- package/dist/module/js/site/isTVEnabled.js.map +0 -1
- package/dist/module/session.js +0 -58
- package/dist/module/session.js.map +0 -1
- package/dist/module/styles.js +0 -67
- package/dist/module/styles.js.map +0 -1
- package/dist/module/withNavigationFocus.js +0 -30
- package/dist/module/withNavigationFocus.js.map +0 -1
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
-
import React, { Component } from "react";
|
|
5
|
-
import { Text } from "@plusscommunities/pluss-core-app/components";
|
|
6
|
-
import { connect } from "react-redux";
|
|
7
|
-
import _ from "lodash";
|
|
8
|
-
import { TouchableOpacity, View, ScrollView, StyleSheet } from "react-native";
|
|
9
|
-
import { Icon } from "@rneui/themed";
|
|
10
|
-
import { Services } from "../config";
|
|
11
|
-
import { FormCard } from "./FormCard";
|
|
12
|
-
import { FormCardSection } from "./FormCardSection";
|
|
13
|
-
import { InlineButton } from "./InlineButton";
|
|
14
|
-
import Header from "./Header";
|
|
15
|
-
import { Spinner } from "./Spinner";
|
|
16
|
-
import { TEXT_DARK, COLOUR_GREEN, BG_GREY, INACTIVE_BUTTON, TEXT_LIGHT, getMainBrandingColourFromState } from "../colours";
|
|
17
|
-
import { typeActions, profileActions } from "../apis";
|
|
18
|
-
class AudienceSelectorPage extends Component {
|
|
19
|
-
constructor(props) {
|
|
20
|
-
super(props);
|
|
21
|
-
_defineProperty(this, "componentDidMount", async () => {
|
|
22
|
-
try {
|
|
23
|
-
this.setState({
|
|
24
|
-
loading: true
|
|
25
|
-
});
|
|
26
|
-
await this.getUserTypes();
|
|
27
|
-
await this.getUserTags();
|
|
28
|
-
this.setState({
|
|
29
|
-
loading: false,
|
|
30
|
-
combinedList: this.getAvailableAudienceTags()
|
|
31
|
-
});
|
|
32
|
-
} catch (error) {
|
|
33
|
-
console.error("loading types error", error);
|
|
34
|
-
this.setState({
|
|
35
|
-
loading: false
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
_defineProperty(this, "getUserTypes", async () => {
|
|
40
|
-
const {
|
|
41
|
-
data
|
|
42
|
-
} = await typeActions.getUserTypes(this.props.site);
|
|
43
|
-
data.forEach(e => {
|
|
44
|
-
e.name = e.category ? `(${e.category[0].toUpperCase() + e.category.substring(1)}) ${e.displayName}` : e.displayName;
|
|
45
|
-
e.key = e.typeName;
|
|
46
|
-
});
|
|
47
|
-
// console.log('getUserTypes', data);
|
|
48
|
-
this.setState({
|
|
49
|
-
types: data
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
_defineProperty(this, "getUserTags", async () => {
|
|
53
|
-
const {
|
|
54
|
-
data
|
|
55
|
-
} = await profileActions.getUserTagsBySite(this.props.site);
|
|
56
|
-
data.forEach(e => {
|
|
57
|
-
e.name = e.Title;
|
|
58
|
-
e.key = e.Id;
|
|
59
|
-
});
|
|
60
|
-
// console.log('getUserTags', data);
|
|
61
|
-
this.setState({
|
|
62
|
-
tags: data
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
_defineProperty(this, "getAvailableAudienceTags", () => {
|
|
66
|
-
const {
|
|
67
|
-
categories,
|
|
68
|
-
types,
|
|
69
|
-
tags
|
|
70
|
-
} = this.state;
|
|
71
|
-
const {
|
|
72
|
-
audienceTypeSelection
|
|
73
|
-
} = this.props;
|
|
74
|
-
const categoryTags = categories.map(c => {
|
|
75
|
-
const Id = `category_${c.key}`;
|
|
76
|
-
return {
|
|
77
|
-
AudienceType: "Category",
|
|
78
|
-
AudienceTypeSelection: c.key,
|
|
79
|
-
Id,
|
|
80
|
-
Title: c.name,
|
|
81
|
-
Selected: audienceTypeSelection.some(i => i.Id === Id)
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
const userTypeTags = types.map(t => {
|
|
85
|
-
const Id = `userType_${t.typeName}`;
|
|
86
|
-
return {
|
|
87
|
-
AudienceType: "UserType",
|
|
88
|
-
AudienceTypeSelection: t.typeName,
|
|
89
|
-
Id,
|
|
90
|
-
Title: `User Type: ${t.displayName}`,
|
|
91
|
-
Selected: audienceTypeSelection.some(i => i.Id === Id)
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
const userTagTags = tags.map(t => {
|
|
95
|
-
const Id = `userTag_${t.Id}`;
|
|
96
|
-
return {
|
|
97
|
-
AudienceType: "UserTags",
|
|
98
|
-
AudienceTypeSelection: t.Id,
|
|
99
|
-
Id,
|
|
100
|
-
Title: `User Tag: ${t.Title}`,
|
|
101
|
-
Selected: audienceTypeSelection.some(i => i.Id === Id)
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
return [...categoryTags, ...userTypeTags, ...userTagTags];
|
|
105
|
-
});
|
|
106
|
-
_defineProperty(this, "onPressBack", () => {
|
|
107
|
-
Services.navigation.goBack();
|
|
108
|
-
});
|
|
109
|
-
_defineProperty(this, "onSelectAll", () => {
|
|
110
|
-
const newList = [...this.state.combinedList];
|
|
111
|
-
newList.forEach(i => i.Selected = false);
|
|
112
|
-
this.setState({
|
|
113
|
-
combinedList: newList
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
_defineProperty(this, "onSeeAll", () => {
|
|
117
|
-
this.setState({
|
|
118
|
-
seeAll: !this.state.seeAll
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
_defineProperty(this, "onToggleAudienceOption", option => {
|
|
122
|
-
const newList = [...this.state.combinedList];
|
|
123
|
-
const selected = newList.find(i => i.Id === option.Id);
|
|
124
|
-
if (selected) {
|
|
125
|
-
selected.Selected = !selected.Selected;
|
|
126
|
-
this.setState({
|
|
127
|
-
combinedList: newList
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
_defineProperty(this, "onDone", () => {
|
|
132
|
-
if (this.props.onChange) {
|
|
133
|
-
const {
|
|
134
|
-
combinedList
|
|
135
|
-
} = this.state;
|
|
136
|
-
const selected = combinedList.filter(i => i.Selected);
|
|
137
|
-
if (selected && selected.length > 0) {
|
|
138
|
-
this.props.onChange("Custom", selected);
|
|
139
|
-
} else {
|
|
140
|
-
this.props.onChange(null, null);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
Services.navigation.goBack();
|
|
144
|
-
});
|
|
145
|
-
this.state = {
|
|
146
|
-
loading: false,
|
|
147
|
-
categories: [{
|
|
148
|
-
name: "All Primary Users",
|
|
149
|
-
key: "resident"
|
|
150
|
-
}, {
|
|
151
|
-
name: "All Staff Users",
|
|
152
|
-
key: "staff"
|
|
153
|
-
}, {
|
|
154
|
-
name: "All Linked Users",
|
|
155
|
-
key: "family"
|
|
156
|
-
}],
|
|
157
|
-
types: [],
|
|
158
|
-
tags: [],
|
|
159
|
-
combinedList: [],
|
|
160
|
-
seeAll: false
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
renderOption(label, selected, onSelect, key = null, hasUnderline = true) {
|
|
164
|
-
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
165
|
-
key: key,
|
|
166
|
-
onPress: onSelect
|
|
167
|
-
}, /*#__PURE__*/React.createElement(FormCardSection, {
|
|
168
|
-
hasUnderline: hasUnderline,
|
|
169
|
-
hasContent: true
|
|
170
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
171
|
-
style: styles.labelContainer
|
|
172
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
173
|
-
style: styles.labelText
|
|
174
|
-
}, label), /*#__PURE__*/React.createElement(Icon, {
|
|
175
|
-
name: "check-circle",
|
|
176
|
-
type: "font-awesome",
|
|
177
|
-
iconStyle: [{
|
|
178
|
-
color: INACTIVE_BUTTON,
|
|
179
|
-
fontSize: 20
|
|
180
|
-
}, selected && {
|
|
181
|
-
color: COLOUR_GREEN
|
|
182
|
-
}]
|
|
183
|
-
}))));
|
|
184
|
-
}
|
|
185
|
-
renderSelectAll() {
|
|
186
|
-
const {
|
|
187
|
-
combinedList,
|
|
188
|
-
loading
|
|
189
|
-
} = this.state;
|
|
190
|
-
const allSelected = !combinedList.find(i => i.Selected);
|
|
191
|
-
if (loading) return null;
|
|
192
|
-
return /*#__PURE__*/React.createElement(FormCard, {
|
|
193
|
-
style: styles.selectAllContainer
|
|
194
|
-
}, this.renderOption("All Users", allSelected, this.onSelectAll, null, false));
|
|
195
|
-
}
|
|
196
|
-
renderSelection() {
|
|
197
|
-
const {
|
|
198
|
-
loading,
|
|
199
|
-
combinedList,
|
|
200
|
-
seeAll
|
|
201
|
-
} = this.state;
|
|
202
|
-
if (loading) return null;
|
|
203
|
-
const selectedText = combinedList.filter(i => i.Selected).map(i => i.Title).join(", ");
|
|
204
|
-
const hasSelected = !_.isEmpty(selectedText);
|
|
205
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
206
|
-
style: styles.selectionContainer
|
|
207
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
208
|
-
style: styles.selectionContainerInner
|
|
209
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
210
|
-
style: styles.selectionTitle
|
|
211
|
-
}, "or select from below"), hasSelected ? /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
212
|
-
onPress: this.onSeeAll
|
|
213
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
214
|
-
style: styles.seeAllButton
|
|
215
|
-
}, seeAll ? "See less" : "See all")) : null), hasSelected ? /*#__PURE__*/React.createElement(Text, {
|
|
216
|
-
style: styles.selectionText,
|
|
217
|
-
numberOfLines: seeAll ? null : 1
|
|
218
|
-
}, `Current selection: ${selectedText}`) : null);
|
|
219
|
-
}
|
|
220
|
-
renderTips() {
|
|
221
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
222
|
-
style: styles.tipContainer
|
|
223
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
224
|
-
style: styles.tipText
|
|
225
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
226
|
-
style: {
|
|
227
|
-
fontFamily: "sf-semibold"
|
|
228
|
-
}
|
|
229
|
-
}, "Tip: "), "Group your users using User Tags from your website Community Manager"));
|
|
230
|
-
}
|
|
231
|
-
renderAvailableAudiences() {
|
|
232
|
-
const {
|
|
233
|
-
loading,
|
|
234
|
-
combinedList
|
|
235
|
-
} = this.state;
|
|
236
|
-
return /*#__PURE__*/React.createElement(ScrollView, {
|
|
237
|
-
style: styles.availableScrollContainer,
|
|
238
|
-
contentContainerStyle: styles.availabelScrollContent
|
|
239
|
-
}, /*#__PURE__*/React.createElement(FormCard, null, combinedList.map((option, index) => {
|
|
240
|
-
const notLast = index < combinedList.length - 1;
|
|
241
|
-
return this.renderOption(option.Title, option.Selected, () => this.onToggleAudienceOption(option), index, notLast);
|
|
242
|
-
})), loading ? /*#__PURE__*/React.createElement(Spinner, null) : null, this.renderTips());
|
|
243
|
-
}
|
|
244
|
-
renderButtons() {
|
|
245
|
-
const {
|
|
246
|
-
loading
|
|
247
|
-
} = this.state;
|
|
248
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
249
|
-
style: styles.doneButtonContainer
|
|
250
|
-
}, /*#__PURE__*/React.createElement(InlineButton, {
|
|
251
|
-
color: loading ? INACTIVE_BUTTON : this.props.colourBrandingMain,
|
|
252
|
-
onPress: this.onDone,
|
|
253
|
-
touchableStyle: styles.doneButton,
|
|
254
|
-
fillTouchable: true,
|
|
255
|
-
large: true,
|
|
256
|
-
disabled: loading
|
|
257
|
-
}, "Done"));
|
|
258
|
-
}
|
|
259
|
-
render() {
|
|
260
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
261
|
-
style: styles.container
|
|
262
|
-
}, /*#__PURE__*/React.createElement(Header, {
|
|
263
|
-
leftIcon: "angle-left",
|
|
264
|
-
onPressLeft: this.onPressBack,
|
|
265
|
-
text: "Select Audience"
|
|
266
|
-
}), this.renderSelectAll(), this.renderSelection(), this.renderAvailableAudiences(), this.renderButtons());
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
const styles = StyleSheet.create({
|
|
270
|
-
container: {
|
|
271
|
-
flex: 1,
|
|
272
|
-
position: "relative",
|
|
273
|
-
backgroundColor: BG_GREY
|
|
274
|
-
},
|
|
275
|
-
selectAllContainer: {
|
|
276
|
-
marginTop: 20
|
|
277
|
-
},
|
|
278
|
-
selectionContainer: {
|
|
279
|
-
padding: 20
|
|
280
|
-
},
|
|
281
|
-
selectionContainerInner: {
|
|
282
|
-
flexDirection: "row",
|
|
283
|
-
justifyContent: "space-between"
|
|
284
|
-
},
|
|
285
|
-
selectionTitle: {
|
|
286
|
-
fontFamily: "sf-bold",
|
|
287
|
-
fontSize: 14,
|
|
288
|
-
color: TEXT_DARK
|
|
289
|
-
},
|
|
290
|
-
selectionText: {
|
|
291
|
-
fontFamily: "sf-bold",
|
|
292
|
-
fontSize: 14,
|
|
293
|
-
color: TEXT_DARK,
|
|
294
|
-
marginTop: 10
|
|
295
|
-
},
|
|
296
|
-
seeAllButton: {
|
|
297
|
-
marginLeft: 10,
|
|
298
|
-
fontFamily: "sf-bold",
|
|
299
|
-
fontSize: 14,
|
|
300
|
-
color: TEXT_LIGHT
|
|
301
|
-
},
|
|
302
|
-
availableScrollContainer: {
|
|
303
|
-
flex: 1
|
|
304
|
-
},
|
|
305
|
-
availabelScrollContent: {
|
|
306
|
-
flexGrow: 1,
|
|
307
|
-
justifyContent: "space-between",
|
|
308
|
-
flexDirection: "column"
|
|
309
|
-
},
|
|
310
|
-
tipContainer: {
|
|
311
|
-
padding: 10
|
|
312
|
-
},
|
|
313
|
-
tipText: {
|
|
314
|
-
fontSize: 14,
|
|
315
|
-
fontFamily: "sf-regular",
|
|
316
|
-
color: TEXT_DARK
|
|
317
|
-
},
|
|
318
|
-
labelContainer: {
|
|
319
|
-
flexDirection: "row",
|
|
320
|
-
justifyContent: "space-between"
|
|
321
|
-
},
|
|
322
|
-
labelText: {
|
|
323
|
-
fontFamily: "sf-medium",
|
|
324
|
-
fontSize: 16,
|
|
325
|
-
color: TEXT_DARK
|
|
326
|
-
},
|
|
327
|
-
description: {
|
|
328
|
-
marginTop: 5,
|
|
329
|
-
fontSize: 14,
|
|
330
|
-
fontFamily: "sf-regular",
|
|
331
|
-
color: TEXT_DARK
|
|
332
|
-
},
|
|
333
|
-
doneButtonContainer: {
|
|
334
|
-
backgroundColor: "#fff",
|
|
335
|
-
marginTop: 1,
|
|
336
|
-
flexDirection: "row",
|
|
337
|
-
paddingTop: 10,
|
|
338
|
-
paddingBottom: 20
|
|
339
|
-
},
|
|
340
|
-
doneButton: {
|
|
341
|
-
flex: 1,
|
|
342
|
-
marginHorizontal: 6
|
|
343
|
-
}
|
|
344
|
-
});
|
|
345
|
-
const mapStateToProps = state => {
|
|
346
|
-
return {
|
|
347
|
-
colourBrandingMain: getMainBrandingColourFromState(state)
|
|
348
|
-
};
|
|
349
|
-
};
|
|
350
|
-
export default connect(mapStateToProps, {})(AudienceSelectorPage);
|
|
351
|
-
//# sourceMappingURL=AudienceSelectorPage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","Component","Text","connect","_","TouchableOpacity","View","ScrollView","StyleSheet","Icon","Services","FormCard","FormCardSection","InlineButton","Header","Spinner","TEXT_DARK","COLOUR_GREEN","BG_GREY","INACTIVE_BUTTON","TEXT_LIGHT","getMainBrandingColourFromState","typeActions","profileActions","AudienceSelectorPage","constructor","props","_defineProperty","setState","loading","getUserTypes","getUserTags","combinedList","getAvailableAudienceTags","error","console","data","site","forEach","e","name","category","toUpperCase","substring","displayName","key","typeName","types","getUserTagsBySite","Title","Id","tags","categories","state","audienceTypeSelection","categoryTags","map","c","AudienceType","AudienceTypeSelection","Selected","some","i","userTypeTags","t","userTagTags","navigation","goBack","newList","seeAll","option","selected","find","onChange","filter","length","renderOption","label","onSelect","hasUnderline","createElement","onPress","hasContent","style","styles","labelContainer","labelText","type","iconStyle","color","fontSize","renderSelectAll","allSelected","selectAllContainer","onSelectAll","renderSelection","selectedText","join","hasSelected","isEmpty","selectionContainer","selectionContainerInner","selectionTitle","onSeeAll","seeAllButton","selectionText","numberOfLines","renderTips","tipContainer","tipText","fontFamily","renderAvailableAudiences","availableScrollContainer","contentContainerStyle","availabelScrollContent","index","notLast","onToggleAudienceOption","renderButtons","doneButtonContainer","colourBrandingMain","onDone","touchableStyle","doneButton","fillTouchable","large","disabled","render","container","leftIcon","onPressLeft","onPressBack","text","create","flex","position","backgroundColor","marginTop","padding","flexDirection","justifyContent","marginLeft","flexGrow","description","paddingTop","paddingBottom","marginHorizontal","mapStateToProps"],"sources":["AudienceSelectorPage.js"],"sourcesContent":["import React, { Component } from \"react\";\nimport { Text } from \"@plusscommunities/pluss-core-app/components\";\nimport { connect } from \"react-redux\";\nimport _ from \"lodash\";\nimport { TouchableOpacity, View, ScrollView, StyleSheet } from \"react-native\";\nimport { Icon } from \"@rneui/themed\";\nimport { Services } from \"../config\";\nimport { FormCard } from \"./FormCard\";\nimport { FormCardSection } from \"./FormCardSection\";\nimport { InlineButton } from \"./InlineButton\";\nimport Header from \"./Header\";\nimport { Spinner } from \"./Spinner\";\nimport {\n\tTEXT_DARK,\n\tCOLOUR_GREEN,\n\tBG_GREY,\n\tINACTIVE_BUTTON,\n\tTEXT_LIGHT,\n\tgetMainBrandingColourFromState,\n} from \"../colours\";\nimport { typeActions, profileActions } from \"../apis\";\n\nclass AudienceSelectorPage extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\n\t\tthis.state = {\n\t\t\tloading: false,\n\t\t\tcategories: [\n\t\t\t\t{\n\t\t\t\t\tname: \"All Primary Users\",\n\t\t\t\t\tkey: \"resident\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"All Staff Users\",\n\t\t\t\t\tkey: \"staff\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"All Linked Users\",\n\t\t\t\t\tkey: \"family\",\n\t\t\t\t},\n\t\t\t],\n\t\t\ttypes: [],\n\t\t\ttags: [],\n\t\t\tcombinedList: [],\n\t\t\tseeAll: false,\n\t\t};\n\t}\n\n\tcomponentDidMount = async () => {\n\t\ttry {\n\t\t\tthis.setState({ loading: true });\n\t\t\tawait this.getUserTypes();\n\t\t\tawait this.getUserTags();\n\t\t\tthis.setState({\n\t\t\t\tloading: false,\n\t\t\t\tcombinedList: this.getAvailableAudienceTags(),\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconsole.error(\"loading types error\", error);\n\t\t\tthis.setState({ loading: false });\n\t\t}\n\t};\n\n\tgetUserTypes = async () => {\n\t\tconst { data } = await typeActions.getUserTypes(this.props.site);\n\t\tdata.forEach((e) => {\n\t\t\te.name = e.category\n\t\t\t\t? `(${e.category[0].toUpperCase() + e.category.substring(1)}) ${e.displayName}`\n\t\t\t\t: e.displayName;\n\t\t\te.key = e.typeName;\n\t\t});\n\t\t// console.log('getUserTypes', data);\n\t\tthis.setState({ types: data });\n\t};\n\n\tgetUserTags = async () => {\n\t\tconst { data } = await profileActions.getUserTagsBySite(this.props.site);\n\t\tdata.forEach((e) => {\n\t\t\te.name = e.Title;\n\t\t\te.key = e.Id;\n\t\t});\n\t\t// console.log('getUserTags', data);\n\t\tthis.setState({ tags: data });\n\t};\n\n\tgetAvailableAudienceTags = () => {\n\t\tconst { categories, types, tags } = this.state;\n\t\tconst { audienceTypeSelection } = this.props;\n\n\t\tconst categoryTags = categories.map((c) => {\n\t\t\tconst Id = `category_${c.key}`;\n\t\t\treturn {\n\t\t\t\tAudienceType: \"Category\",\n\t\t\t\tAudienceTypeSelection: c.key,\n\t\t\t\tId,\n\t\t\t\tTitle: c.name,\n\t\t\t\tSelected: audienceTypeSelection.some((i) => i.Id === Id),\n\t\t\t};\n\t\t});\n\t\tconst userTypeTags = types.map((t) => {\n\t\t\tconst Id = `userType_${t.typeName}`;\n\t\t\treturn {\n\t\t\t\tAudienceType: \"UserType\",\n\t\t\t\tAudienceTypeSelection: t.typeName,\n\t\t\t\tId,\n\t\t\t\tTitle: `User Type: ${t.displayName}`,\n\t\t\t\tSelected: audienceTypeSelection.some((i) => i.Id === Id),\n\t\t\t};\n\t\t});\n\t\tconst userTagTags = tags.map((t) => {\n\t\t\tconst Id = `userTag_${t.Id}`;\n\t\t\treturn {\n\t\t\t\tAudienceType: \"UserTags\",\n\t\t\t\tAudienceTypeSelection: t.Id,\n\t\t\t\tId,\n\t\t\t\tTitle: `User Tag: ${t.Title}`,\n\t\t\t\tSelected: audienceTypeSelection.some((i) => i.Id === Id),\n\t\t\t};\n\t\t});\n\t\treturn [...categoryTags, ...userTypeTags, ...userTagTags];\n\t};\n\n\tonPressBack = () => {\n\t\tServices.navigation.goBack();\n\t};\n\n\tonSelectAll = () => {\n\t\tconst newList = [...this.state.combinedList];\n\t\tnewList.forEach((i) => (i.Selected = false));\n\t\tthis.setState({ combinedList: newList });\n\t};\n\n\tonSeeAll = () => {\n\t\tthis.setState({ seeAll: !this.state.seeAll });\n\t};\n\n\tonToggleAudienceOption = (option) => {\n\t\tconst newList = [...this.state.combinedList];\n\t\tconst selected = newList.find((i) => i.Id === option.Id);\n\t\tif (selected) {\n\t\t\tselected.Selected = !selected.Selected;\n\t\t\tthis.setState({ combinedList: newList });\n\t\t}\n\t};\n\n\tonDone = () => {\n\t\tif (this.props.onChange) {\n\t\t\tconst { combinedList } = this.state;\n\t\t\tconst selected = combinedList.filter((i) => i.Selected);\n\t\t\tif (selected && selected.length > 0) {\n\t\t\t\tthis.props.onChange(\"Custom\", selected);\n\t\t\t} else {\n\t\t\t\tthis.props.onChange(null, null);\n\t\t\t}\n\t\t}\n\t\tServices.navigation.goBack();\n\t};\n\n\trenderOption(label, selected, onSelect, key = null, hasUnderline = true) {\n\t\treturn (\n\t\t\t<TouchableOpacity key={key} onPress={onSelect}>\n\t\t\t\t<FormCardSection hasUnderline={hasUnderline} hasContent>\n\t\t\t\t\t<View style={styles.labelContainer}>\n\t\t\t\t\t\t<Text style={styles.labelText}>{label}</Text>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tname=\"check-circle\"\n\t\t\t\t\t\t\ttype=\"font-awesome\"\n\t\t\t\t\t\t\ticonStyle={[\n\t\t\t\t\t\t\t\t{ color: INACTIVE_BUTTON, fontSize: 20 },\n\t\t\t\t\t\t\t\tselected && { color: COLOUR_GREEN },\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</FormCardSection>\n\t\t\t</TouchableOpacity>\n\t\t);\n\t}\n\n\trenderSelectAll() {\n\t\tconst { combinedList, loading } = this.state;\n\t\tconst allSelected = !combinedList.find((i) => i.Selected);\n\t\tif (loading) return null;\n\n\t\treturn (\n\t\t\t<FormCard style={styles.selectAllContainer}>\n\t\t\t\t{this.renderOption(\n\t\t\t\t\t\"All Users\",\n\t\t\t\t\tallSelected,\n\t\t\t\t\tthis.onSelectAll,\n\t\t\t\t\tnull,\n\t\t\t\t\tfalse,\n\t\t\t\t)}\n\t\t\t</FormCard>\n\t\t);\n\t}\n\n\trenderSelection() {\n\t\tconst { loading, combinedList, seeAll } = this.state;\n\t\tif (loading) return null;\n\n\t\tconst selectedText = combinedList\n\t\t\t.filter((i) => i.Selected)\n\t\t\t.map((i) => i.Title)\n\t\t\t.join(\", \");\n\t\tconst hasSelected = !_.isEmpty(selectedText);\n\n\t\treturn (\n\t\t\t<View style={styles.selectionContainer}>\n\t\t\t\t<View style={styles.selectionContainerInner}>\n\t\t\t\t\t<Text style={styles.selectionTitle}>or select from below</Text>\n\t\t\t\t\t{hasSelected ? (\n\t\t\t\t\t\t<TouchableOpacity onPress={this.onSeeAll}>\n\t\t\t\t\t\t\t<Text style={styles.seeAllButton}>\n\t\t\t\t\t\t\t\t{seeAll ? \"See less\" : \"See all\"}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</TouchableOpacity>\n\t\t\t\t\t) : null}\n\t\t\t\t</View>\n\t\t\t\t{hasSelected ? (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tstyle={styles.selectionText}\n\t\t\t\t\t\tnumberOfLines={seeAll ? null : 1}\n\t\t\t\t\t>{`Current selection: ${selectedText}`}</Text>\n\t\t\t\t) : null}\n\t\t\t</View>\n\t\t);\n\t}\n\n\trenderTips() {\n\t\treturn (\n\t\t\t<View style={styles.tipContainer}>\n\t\t\t\t<Text style={styles.tipText}>\n\t\t\t\t\t<Text style={{ fontFamily: \"sf-semibold\" }}>Tip: </Text>\n\t\t\t\t\tGroup your users using User Tags from your website Community Manager\n\t\t\t\t</Text>\n\t\t\t</View>\n\t\t);\n\t}\n\n\trenderAvailableAudiences() {\n\t\tconst { loading, combinedList } = this.state;\n\n\t\treturn (\n\t\t\t<ScrollView\n\t\t\t\tstyle={styles.availableScrollContainer}\n\t\t\t\tcontentContainerStyle={styles.availabelScrollContent}\n\t\t\t>\n\t\t\t\t<FormCard>\n\t\t\t\t\t{combinedList.map((option, index) => {\n\t\t\t\t\t\tconst notLast = index < combinedList.length - 1;\n\t\t\t\t\t\treturn this.renderOption(\n\t\t\t\t\t\t\toption.Title,\n\t\t\t\t\t\t\toption.Selected,\n\t\t\t\t\t\t\t() => this.onToggleAudienceOption(option),\n\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\tnotLast,\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\t\t\t\t</FormCard>\n\t\t\t\t{loading ? <Spinner /> : null}\n\t\t\t\t{this.renderTips()}\n\t\t\t</ScrollView>\n\t\t);\n\t}\n\n\trenderButtons() {\n\t\tconst { loading } = this.state;\n\n\t\treturn (\n\t\t\t<View style={styles.doneButtonContainer}>\n\t\t\t\t<InlineButton\n\t\t\t\t\tcolor={loading ? INACTIVE_BUTTON : this.props.colourBrandingMain}\n\t\t\t\t\tonPress={this.onDone}\n\t\t\t\t\ttouchableStyle={styles.doneButton}\n\t\t\t\t\tfillTouchable\n\t\t\t\t\tlarge\n\t\t\t\t\tdisabled={loading}\n\t\t\t\t>\n\t\t\t\t\tDone\n\t\t\t\t</InlineButton>\n\t\t\t</View>\n\t\t);\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<View style={styles.container}>\n\t\t\t\t<Header\n\t\t\t\t\tleftIcon=\"angle-left\"\n\t\t\t\t\tonPressLeft={this.onPressBack}\n\t\t\t\t\ttext={\"Select Audience\"}\n\t\t\t\t/>\n\t\t\t\t{this.renderSelectAll()}\n\t\t\t\t{this.renderSelection()}\n\t\t\t\t{this.renderAvailableAudiences()}\n\t\t\t\t{this.renderButtons()}\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tflex: 1,\n\t\tposition: \"relative\",\n\t\tbackgroundColor: BG_GREY,\n\t},\n\tselectAllContainer: {\n\t\tmarginTop: 20,\n\t},\n\tselectionContainer: {\n\t\tpadding: 20,\n\t},\n\tselectionContainerInner: {\n\t\tflexDirection: \"row\",\n\t\tjustifyContent: \"space-between\",\n\t},\n\tselectionTitle: {\n\t\tfontFamily: \"sf-bold\",\n\t\tfontSize: 14,\n\t\tcolor: TEXT_DARK,\n\t},\n\tselectionText: {\n\t\tfontFamily: \"sf-bold\",\n\t\tfontSize: 14,\n\t\tcolor: TEXT_DARK,\n\t\tmarginTop: 10,\n\t},\n\tseeAllButton: {\n\t\tmarginLeft: 10,\n\t\tfontFamily: \"sf-bold\",\n\t\tfontSize: 14,\n\t\tcolor: TEXT_LIGHT,\n\t},\n\tavailableScrollContainer: {\n\t\tflex: 1,\n\t},\n\tavailabelScrollContent: {\n\t\tflexGrow: 1,\n\t\tjustifyContent: \"space-between\",\n\t\tflexDirection: \"column\",\n\t},\n\ttipContainer: {\n\t\tpadding: 10,\n\t},\n\ttipText: {\n\t\tfontSize: 14,\n\t\tfontFamily: \"sf-regular\",\n\t\tcolor: TEXT_DARK,\n\t},\n\tlabelContainer: {\n\t\tflexDirection: \"row\",\n\t\tjustifyContent: \"space-between\",\n\t},\n\tlabelText: {\n\t\tfontFamily: \"sf-medium\",\n\t\tfontSize: 16,\n\t\tcolor: TEXT_DARK,\n\t},\n\tdescription: {\n\t\tmarginTop: 5,\n\t\tfontSize: 14,\n\t\tfontFamily: \"sf-regular\",\n\t\tcolor: TEXT_DARK,\n\t},\n\tdoneButtonContainer: {\n\t\tbackgroundColor: \"#fff\",\n\t\tmarginTop: 1,\n\t\tflexDirection: \"row\",\n\t\tpaddingTop: 10,\n\t\tpaddingBottom: 20,\n\t},\n\tdoneButton: {\n\t\tflex: 1,\n\t\tmarginHorizontal: 6,\n\t},\n});\n\nconst mapStateToProps = (state) => {\n\treturn {\n\t\tcolourBrandingMain: getMainBrandingColourFromState(state),\n\t};\n};\n\nexport default connect(mapStateToProps, {})(AudienceSelectorPage);\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,IAAI,QAAQ,6CAA6C;AAClE,SAASC,OAAO,QAAQ,aAAa;AACrC,OAAOC,CAAC,MAAM,QAAQ;AACtB,SAASC,gBAAgB,EAAEC,IAAI,EAAEC,UAAU,EAAEC,UAAU,QAAQ,cAAc;AAC7E,SAASC,IAAI,QAAQ,eAAe;AACpC,SAASC,QAAQ,QAAQ,WAAW;AACpC,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,YAA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ACgJ,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC3H,oBAAoB,CAAC","ignoreList":[]}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
-
import React, { Component } from "react";
|
|
5
|
-
import { View, Image, Animated, StyleSheet } from "react-native";
|
|
6
|
-
import { connect } from "react-redux";
|
|
7
|
-
import moment from "moment";
|
|
8
|
-
import { findLandmarkRange, getScaledOffset, get300, detectFaces } from "../helper";
|
|
9
|
-
import { saveImagePosition } from "../actions";
|
|
10
|
-
class AutoOffsetImage extends Component {
|
|
11
|
-
constructor(props) {
|
|
12
|
-
super(props);
|
|
13
|
-
_defineProperty(this, "onLoad", event => {
|
|
14
|
-
if (event.nativeEvent.source.uri !== this.props.uri) {
|
|
15
|
-
this.setState({
|
|
16
|
-
imageSource: this.props.uri
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
// if (event.nativeEvent.source.uri === this.props.uri && !this.state.imageLoaded) {
|
|
20
|
-
// //unblur
|
|
21
|
-
// this.setState({
|
|
22
|
-
// imageLoaded: true,
|
|
23
|
-
// });
|
|
24
|
-
// Animated.sequence([
|
|
25
|
-
// Animated.delay(200),
|
|
26
|
-
// Animated.timing(this.state.blurRadius, {
|
|
27
|
-
// toValue: 0,
|
|
28
|
-
// duration: 500,
|
|
29
|
-
// useNativeDriver: false,
|
|
30
|
-
// }),
|
|
31
|
-
// ]).start();
|
|
32
|
-
// }
|
|
33
|
-
});
|
|
34
|
-
_defineProperty(this, "positionImage", async () => {
|
|
35
|
-
if (this.state.disabled) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
const startTime = moment().valueOf();
|
|
40
|
-
let cachedValues;
|
|
41
|
-
// check local cache
|
|
42
|
-
if (this.props.imagePositions && this.props.imagePositions[this.props.uri]) {
|
|
43
|
-
cachedValues = this.props.imagePositions[this.props.uri];
|
|
44
|
-
}
|
|
45
|
-
// check remote cache
|
|
46
|
-
if (!cachedValues) {
|
|
47
|
-
try {
|
|
48
|
-
const response = await stringActions.getString("plussSpace", `imagefaces_${encodeURIComponent(this.props.uri)}`);
|
|
49
|
-
cachedValues = response.data;
|
|
50
|
-
} catch (e) {
|
|
51
|
-
console.log("errored from cache");
|
|
52
|
-
}
|
|
53
|
-
// run face detection locally
|
|
54
|
-
if (!cachedValues || !cachedValues.faces || !cachedValues.image || _.isEmpty(cachedValues.faces) && moment().add(-1, "w").valueOf() > moment(cachedValues.timestamp).valueOf()) {
|
|
55
|
-
cachedValues = await detectFaces(this.props.uri);
|
|
56
|
-
}
|
|
57
|
-
this.props.saveImagePosition(this.props.uri, cachedValues);
|
|
58
|
-
}
|
|
59
|
-
const image = await findLandmarkRange(this.props.uri, {
|
|
60
|
-
targetWidth: this.props.width,
|
|
61
|
-
targetHeight: this.props.height,
|
|
62
|
-
cachedValues
|
|
63
|
-
});
|
|
64
|
-
const scaledOffset = getScaledOffset(image.width, image.height, this.props.width, this.props.height);
|
|
65
|
-
const {
|
|
66
|
-
start: landmarkStart,
|
|
67
|
-
end: landmarkEnd
|
|
68
|
-
} = image;
|
|
69
|
-
const {
|
|
70
|
-
bounds: imageBounds,
|
|
71
|
-
offset,
|
|
72
|
-
width,
|
|
73
|
-
height
|
|
74
|
-
} = scaledOffset;
|
|
75
|
-
if (landmarkStart.y < imageBounds.start.y) {
|
|
76
|
-
// move up
|
|
77
|
-
offset.y = -Math.max(landmarkStart.y - this.props.height * this.paddingFactor, 0); // move top to 5% above start of landmark
|
|
78
|
-
} else if (landmarkEnd.y > imageBounds.end.y) {
|
|
79
|
-
// move down
|
|
80
|
-
offset.y = -Math.max(landmarkEnd.y + this.props.height * this.paddingFactor - this.props.height, 0); // move bottom to 5% below end of landmark
|
|
81
|
-
}
|
|
82
|
-
if (landmarkStart.x < imageBounds.start.x) {
|
|
83
|
-
// move right
|
|
84
|
-
offset.x = -Math.max(landmarkStart.x - this.props.width * this.paddingFactor, 0); // move left edge to 5% left of start of landmark
|
|
85
|
-
} else if (landmarkEnd.x > imageBounds.end.x) {
|
|
86
|
-
// move left
|
|
87
|
-
offset.x = -Math.max(landmarkEnd.x + this.props.width * this.paddingFactor - this.props.width, 0); // move right edge to 5% left of end of landmark
|
|
88
|
-
}
|
|
89
|
-
this.setState({
|
|
90
|
-
imageStyle: {
|
|
91
|
-
width,
|
|
92
|
-
height,
|
|
93
|
-
top: offset.y,
|
|
94
|
-
left: offset.x
|
|
95
|
-
},
|
|
96
|
-
imageSource: this.props.uri
|
|
97
|
-
});
|
|
98
|
-
const endTime = moment().valueOf();
|
|
99
|
-
if (endTime - startTime < 500) {
|
|
100
|
-
Animated.timing(this.state.blurRadius, {
|
|
101
|
-
toValue: 0,
|
|
102
|
-
duration: 0,
|
|
103
|
-
useNativeDriver: false
|
|
104
|
-
}).start();
|
|
105
|
-
}
|
|
106
|
-
} catch (e) {
|
|
107
|
-
this.setState({
|
|
108
|
-
imageSource: this.props.uri
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
this.paddingFactor = this.props.paddingFactor || 0.1;
|
|
113
|
-
this.state = {
|
|
114
|
-
imageStyle: {
|
|
115
|
-
width: this.props.width,
|
|
116
|
-
height: this.props.height
|
|
117
|
-
},
|
|
118
|
-
blurRadius: new Animated.Value(100),
|
|
119
|
-
imageSource: get300(this.props.uri),
|
|
120
|
-
disabled: true
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
componentDidMount() {
|
|
124
|
-
this.positionImage();
|
|
125
|
-
}
|
|
126
|
-
componentDidUpdate(prevProps) {
|
|
127
|
-
if (prevProps.uri !== this.props.uri || prevProps.height !== this.props.height || prevProps.width !== this.props.width) {
|
|
128
|
-
this.positionImage();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
render() {
|
|
132
|
-
if (this.state.disabled) {
|
|
133
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
134
|
-
style: [styles.container, {
|
|
135
|
-
width: this.props.width,
|
|
136
|
-
height: this.props.height
|
|
137
|
-
}, this.props.style]
|
|
138
|
-
}, /*#__PURE__*/React.createElement(Image, {
|
|
139
|
-
source: {
|
|
140
|
-
uri: this.state.imageSource
|
|
141
|
-
},
|
|
142
|
-
style: [styles.image, this.state.imageStyle],
|
|
143
|
-
onLoad: this.onLoad
|
|
144
|
-
}), this.props.children);
|
|
145
|
-
}
|
|
146
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
147
|
-
style: [styles.container, {
|
|
148
|
-
width: this.props.width,
|
|
149
|
-
height: this.props.height
|
|
150
|
-
}, this.props.style]
|
|
151
|
-
}, /*#__PURE__*/React.createElement(Animated.Image, {
|
|
152
|
-
blurRadius: this.state.blurRadius,
|
|
153
|
-
source: {
|
|
154
|
-
uri: this.state.imageSource
|
|
155
|
-
},
|
|
156
|
-
style: [styles.image, this.state.imageStyle],
|
|
157
|
-
onLoad: this.onLoad
|
|
158
|
-
}), this.props.children);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
const styles = StyleSheet.create({
|
|
162
|
-
container: {
|
|
163
|
-
overflow: "hidden"
|
|
164
|
-
},
|
|
165
|
-
image: {
|
|
166
|
-
position: "absolute",
|
|
167
|
-
top: 0,
|
|
168
|
-
left: 0,
|
|
169
|
-
resizeMode: "cover"
|
|
170
|
-
},
|
|
171
|
-
staticImage: {
|
|
172
|
-
resizeMode: "cover"
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
const mapStateToProps = state => {
|
|
176
|
-
return {
|
|
177
|
-
imagePositions: state.media.positions
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
const autoOffsetImage = connect(mapStateToProps, {
|
|
181
|
-
saveImagePosition
|
|
182
|
-
})(AutoOffsetImage);
|
|
183
|
-
export { autoOffsetImage as AutoOffsetImage };
|
|
184
|
-
//# sourceMappingURL=AutoOffsetImage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","Component","View","Image","Animated","StyleSheet","connect","moment","findLandmarkRange","getScaledOffset","get300","detectFaces","saveImagePosition","AutoOffsetImage","constructor","props","_defineProperty","event","nativeEvent","source","uri","setState","imageSource","state","disabled","startTime","valueOf","cachedValues","imagePositions","response","stringActions","getString","encodeURIComponent","data","e","console","log","faces","image","_","isEmpty","add","timestamp","targetWidth","width","targetHeight","height","scaledOffset","start","landmarkStart","end","landmarkEnd","bounds","imageBounds","offset","y","Math","max","paddingFactor","x","imageStyle","top","left","endTime","timing","blurRadius","toValue","duration","useNativeDriver","Value","componentDidMount","positionImage","componentDidUpdate","prevProps","render","createElement","style","styles","container","onLoad","children","create","overflow","position","resizeMode","staticImage","mapStateToProps","media","positions","autoOffsetImage"],"sources":["AutoOffsetImage.js"],"sourcesContent":["import React, { Component } from \"react\";\nimport { View, Image, Animated, StyleSheet } from \"react-native\";\nimport { connect } from \"react-redux\";\nimport moment from \"moment\";\nimport {\n\tfindLandmarkRange,\n\tgetScaledOffset,\n\tget300,\n\tdetectFaces,\n} from \"../helper\";\nimport { saveImagePosition } from \"../actions\";\n\nclass AutoOffsetImage extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\n\t\tthis.paddingFactor = this.props.paddingFactor || 0.1;\n\n\t\tthis.state = {\n\t\t\timageStyle: {\n\t\t\t\twidth: this.props.width,\n\t\t\t\theight: this.props.height,\n\t\t\t},\n\t\t\tblurRadius: new Animated.Value(100),\n\t\t\timageSource: get300(this.props.uri),\n\t\t\tdisabled: true,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.positionImage();\n\t}\n\n\tcomponentDidUpdate(prevProps) {\n\t\tif (\n\t\t\tprevProps.uri !== this.props.uri ||\n\t\t\tprevProps.height !== this.props.height ||\n\t\t\tprevProps.width !== this.props.width\n\t\t) {\n\t\t\tthis.positionImage();\n\t\t}\n\t}\n\n\tonLoad = (event) => {\n\t\tif (event.nativeEvent.source.uri !== this.props.uri) {\n\t\t\tthis.setState({\n\t\t\t\timageSource: this.props.uri,\n\t\t\t});\n\t\t}\n\t\t// if (event.nativeEvent.source.uri === this.props.uri && !this.state.imageLoaded) {\n\t\t// //unblur\n\t\t// this.setState({\n\t\t// imageLoaded: true,\n\t\t// });\n\t\t// Animated.sequence([\n\t\t// Animated.delay(200),\n\t\t// Animated.timing(this.state.blurRadius, {\n\t\t// toValue: 0,\n\t\t// duration: 500,\n\t\t// useNativeDriver: false,\n\t\t// }),\n\t\t// ]).start();\n\t\t// }\n\t};\n\n\tpositionImage = async () => {\n\t\tif (this.state.disabled) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst startTime = moment().valueOf();\n\n\t\t\tlet cachedValues;\n\t\t\t// check local cache\n\t\t\tif (\n\t\t\t\tthis.props.imagePositions &&\n\t\t\t\tthis.props.imagePositions[this.props.uri]\n\t\t\t) {\n\t\t\t\tcachedValues = this.props.imagePositions[this.props.uri];\n\t\t\t}\n\t\t\t// check remote cache\n\t\t\tif (!cachedValues) {\n\t\t\t\ttry {\n\t\t\t\t\tconst response = await stringActions.getString(\n\t\t\t\t\t\t\"plussSpace\",\n\t\t\t\t\t\t`imagefaces_${encodeURIComponent(this.props.uri)}`,\n\t\t\t\t\t);\n\t\t\t\t\tcachedValues = response.data;\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.log(\"errored from cache\");\n\t\t\t\t}\n\t\t\t\t// run face detection locally\n\t\t\t\tif (\n\t\t\t\t\t!cachedValues ||\n\t\t\t\t\t!cachedValues.faces ||\n\t\t\t\t\t!cachedValues.image ||\n\t\t\t\t\t(_.isEmpty(cachedValues.faces) &&\n\t\t\t\t\t\tmoment().add(-1, \"w\").valueOf() >\n\t\t\t\t\t\t\tmoment(cachedValues.timestamp).valueOf())\n\t\t\t\t) {\n\t\t\t\t\tcachedValues = await detectFaces(this.props.uri);\n\t\t\t\t}\n\t\t\t\tthis.props.saveImagePosition(this.props.uri, cachedValues);\n\t\t\t}\n\n\t\t\tconst image = await findLandmarkRange(this.props.uri, {\n\t\t\t\ttargetWidth: this.props.width,\n\t\t\t\ttargetHeight: this.props.height,\n\t\t\t\tcachedValues,\n\t\t\t});\n\t\t\tconst scaledOffset = getScaledOffset(\n\t\t\t\timage.width,\n\t\t\t\timage.height,\n\t\t\t\tthis.props.width,\n\t\t\t\tthis.props.height,\n\t\t\t);\n\n\t\t\tconst { start: landmarkStart, end: landmarkEnd } = image;\n\t\t\tconst { bounds: imageBounds, offset, width, height } = scaledOffset;\n\n\t\t\tif (landmarkStart.y < imageBounds.start.y) {\n\t\t\t\t// move up\n\t\t\t\toffset.y = -Math.max(\n\t\t\t\t\tlandmarkStart.y - this.props.height * this.paddingFactor,\n\t\t\t\t\t0,\n\t\t\t\t); // move top to 5% above start of landmark\n\t\t\t} else if (landmarkEnd.y > imageBounds.end.y) {\n\t\t\t\t// move down\n\t\t\t\toffset.y = -Math.max(\n\t\t\t\t\tlandmarkEnd.y +\n\t\t\t\t\t\tthis.props.height * this.paddingFactor -\n\t\t\t\t\t\tthis.props.height,\n\t\t\t\t\t0,\n\t\t\t\t); // move bottom to 5% below end of landmark\n\t\t\t}\n\n\t\t\tif (landmarkStart.x < imageBounds.start.x) {\n\t\t\t\t// move right\n\t\t\t\toffset.x = -Math.max(\n\t\t\t\t\tlandmarkStart.x - this.props.width * this.paddingFactor,\n\t\t\t\t\t0,\n\t\t\t\t); // move left edge to 5% left of start of landmark\n\t\t\t} else if (landmarkEnd.x > imageBounds.end.x) {\n\t\t\t\t// move left\n\t\t\t\toffset.x = -Math.max(\n\t\t\t\t\tlandmarkEnd.x +\n\t\t\t\t\t\tthis.props.width * this.paddingFactor -\n\t\t\t\t\t\tthis.props.width,\n\t\t\t\t\t0,\n\t\t\t\t); // move right edge to 5% left of end of landmark\n\t\t\t}\n\n\t\t\tthis.setState({\n\t\t\t\timageStyle: {\n\t\t\t\t\twidth,\n\t\t\t\t\theight,\n\t\t\t\t\ttop: offset.y,\n\t\t\t\t\tleft: offset.x,\n\t\t\t\t},\n\t\t\t\timageSource: this.props.uri,\n\t\t\t});\n\n\t\t\tconst endTime = moment().valueOf();\n\t\t\tif (endTime - startTime < 500) {\n\t\t\t\tAnimated.timing(this.state.blurRadius, {\n\t\t\t\t\ttoValue: 0,\n\t\t\t\t\tduration: 0,\n\t\t\t\t\tuseNativeDriver: false,\n\t\t\t\t}).start();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis.setState({\n\t\t\t\timageSource: this.props.uri,\n\t\t\t});\n\t\t}\n\t};\n\n\trender() {\n\t\tif (this.state.disabled) {\n\t\t\treturn (\n\t\t\t\t<View\n\t\t\t\t\tstyle={[\n\t\t\t\t\t\tstyles.container,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twidth: this.props.width,\n\t\t\t\t\t\t\theight: this.props.height,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.props.style,\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t<Image\n\t\t\t\t\t\tsource={{ uri: this.state.imageSource }}\n\t\t\t\t\t\tstyle={[styles.image, this.state.imageStyle]}\n\t\t\t\t\t\tonLoad={this.onLoad}\n\t\t\t\t\t/>\n\t\t\t\t\t{this.props.children}\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\t\treturn (\n\t\t\t<View\n\t\t\t\tstyle={[\n\t\t\t\t\tstyles.container,\n\t\t\t\t\t{\n\t\t\t\t\t\twidth: this.props.width,\n\t\t\t\t\t\theight: this.props.height,\n\t\t\t\t\t},\n\t\t\t\t\tthis.props.style,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t<Animated.Image\n\t\t\t\t\tblurRadius={this.state.blurRadius}\n\t\t\t\t\tsource={{ uri: this.state.imageSource }}\n\t\t\t\t\tstyle={[styles.image, this.state.imageStyle]}\n\t\t\t\t\tonLoad={this.onLoad}\n\t\t\t\t/>\n\t\t\t\t{this.props.children}\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\toverflow: \"hidden\",\n\t},\n\timage: {\n\t\tposition: \"absolute\",\n\t\ttop: 0,\n\t\tleft: 0,\n\t\tresizeMode: \"cover\",\n\t},\n\tstaticImage: {\n\t\tresizeMode: \"cover\",\n\t},\n});\n\nconst mapStateToProps = (state) => {\n\treturn {\n\t\timagePositions: state.media.positions,\n\t};\n};\n\nconst autoOffsetImage = connect(mapStateToProps, { saveImagePosition })(\n\tAutoOffsetImage,\n);\nexport { autoOffsetImage as AutoOffsetImage };\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,IAAI,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAChE,SAASC,OAAO,QAAQ,aAAa;AACrC,OAAOC,MAAM,MAAM,QAAQ;AAC3B,SACCC,iBAAiB,EACjBC,eAAe,EACfC,MAAM,EACNC,WAAW,QACL,WAAW;AAClB,SAASC,iBAAiB,QAAQ,YAAY;AAE9C,MAAMC,eAAe,SAASZ,SAAS,CAAC;EACvCa,WAAWA,CAACC,KAAK,EAAE;IAClB,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,iBA6BJC,KAAK,IAAK;MACnB,IAAIA,KAAK,CAACC,WAAW,CAACC,MAAM,CAACC,GAAG,KAAK,IAAI,CAACL,KAAK,CAACK,GAAG,EAAE;QACpD,IAAI,CAACC,QAAQ,CAAC;UACbC,WAAW,EAAE,IAAI,CAACP,KAAK,CAACK;QACzB,CAAC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C7B,CAAC;AACF,CAAC;AAED,MAAMC,eAAe,GAAGnF,OAAO,CAACgF,eAAe,EAAE;EAAE1E;AAAkB,CAAC,CAAC,CACtEC,eACD,CAAC;AACD,SAAS4E,eAAe,IAAI5E,eAAe","ignoreList":[]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React, { PureComponent } from "react";
|
|
2
|
-
import { View, TouchableOpacity } from "react-native";
|
|
3
|
-
import { connect } from "react-redux";
|
|
4
|
-
import stylez from "../styles";
|
|
5
|
-
import { FontAwesome } from "./Icon";
|
|
6
|
-
import { getMainBrandingColourFromState } from "../colours";
|
|
7
|
-
|
|
8
|
-
/*
|
|
9
|
-
Props-
|
|
10
|
-
onPress - onPress action
|
|
11
|
-
diameter - size of button
|
|
12
|
-
color - default will be aveoMain
|
|
13
|
-
style - custom style for container
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
class BackButton extends PureComponent {
|
|
17
|
-
render() {
|
|
18
|
-
const size = this.props.diameter || 32;
|
|
19
|
-
const radius = size / 2;
|
|
20
|
-
if (this.props.noClick) {
|
|
21
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
22
|
-
style: [stylez.backButton, {
|
|
23
|
-
backgroundColor: this.props.colourBrandingMain,
|
|
24
|
-
height: size,
|
|
25
|
-
width: size,
|
|
26
|
-
borderRadius: radius
|
|
27
|
-
}, this.props.color && {
|
|
28
|
-
backgroundColor: this.props.color
|
|
29
|
-
}, this.props.style]
|
|
30
|
-
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
31
|
-
name: this.props.flipped ? "chevron-right" : "chevron-left",
|
|
32
|
-
style: [stylez.backButtonIcon, this.props.iconStyle]
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
36
|
-
style: [stylez.backButton, {
|
|
37
|
-
backgroundColor: this.props.colourBrandingMain,
|
|
38
|
-
height: size,
|
|
39
|
-
width: size,
|
|
40
|
-
borderRadius: radius
|
|
41
|
-
}, this.props.color && {
|
|
42
|
-
backgroundColor: this.props.color
|
|
43
|
-
}, this.props.style],
|
|
44
|
-
onPress: this.props.onPress
|
|
45
|
-
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
46
|
-
name: this.props.flipped ? "chevron-right" : "chevron-left",
|
|
47
|
-
style: [stylez.backButtonIcon, this.props.iconStyle]
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const mapStateToProps = state => {
|
|
52
|
-
return {
|
|
53
|
-
colourBrandingMain: getMainBrandingColourFromState(state)
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
const backButton = connect(mapStateToProps, {})(BackButton);
|
|
57
|
-
export { backButton as BackButton };
|
|
58
|
-
//# sourceMappingURL=BackButton.js.map
|