@plusscommunities/pluss-feature-builder-app-d 1.0.3-beta.2 → 8.0.1-auth.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/featureBuilderActions.js +8 -4
- package/dist/module/actions/featureBuilderActions.js.map +1 -1
- package/dist/module/actions/featureBuilderStringsActions.js +4 -6
- package/dist/module/actions/featureBuilderStringsActions.js.map +1 -1
- package/dist/module/actions/index.js +0 -2
- package/dist/module/actions/index.js.map +1 -1
- package/dist/module/actions/types.js +0 -2
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/components/FeatureDetailScreen.js +324 -355
- package/dist/module/components/FeatureDetailScreen.js.map +1 -1
- package/dist/module/components/FeatureListItem.js +38 -47
- package/dist/module/components/FeatureListItem.js.map +1 -1
- package/dist/module/components/FeatureListScreen.js +123 -94
- package/dist/module/components/FeatureListScreen.js.map +1 -1
- package/dist/module/components/FieldRenderer.js +76 -91
- package/dist/module/components/FieldRenderer.js.map +1 -1
- package/dist/module/components/FileDownload.js +23 -30
- package/dist/module/components/FileDownload.js.map +1 -1
- package/dist/module/components/WidgetGrid.js +51 -56
- package/dist/module/components/WidgetGrid.js.map +1 -1
- package/dist/module/components/WidgetLarge.js +109 -111
- package/dist/module/components/WidgetLarge.js.map +1 -1
- package/dist/module/components/WidgetSmall.js +107 -109
- package/dist/module/components/WidgetSmall.js.map +1 -1
- package/dist/module/components/common/index.js +1 -2
- package/dist/module/components/common/index.js.map +1 -1
- package/dist/module/components/layouts/CondensedList.js +64 -75
- package/dist/module/components/layouts/CondensedList.js.map +1 -1
- package/dist/module/components/layouts/FeatureImageList.js +50 -60
- package/dist/module/components/layouts/FeatureImageList.js.map +1 -1
- package/dist/module/components/layouts/RoundImageList.js +53 -62
- package/dist/module/components/layouts/RoundImageList.js.map +1 -1
- package/dist/module/components/layouts/SquareImageList.js +53 -62
- package/dist/module/components/layouts/SquareImageList.js.map +1 -1
- package/dist/module/config/index.js +0 -2
- package/dist/module/config/index.js.map +1 -1
- package/dist/module/core.config.js +1 -4
- package/dist/module/core.config.js.map +1 -1
- package/dist/module/feature.config.js +9 -8
- package/dist/module/feature.config.js.map +1 -1
- package/dist/module/index.js +0 -2
- package/dist/module/index.js.map +1 -1
- package/dist/module/js/Colors.js +0 -2
- package/dist/module/js/Colors.js.map +1 -1
- package/dist/module/js/FieldTypes.js +0 -2
- package/dist/module/js/FieldTypes.js.map +1 -1
- package/dist/module/js/NavigationService.js +0 -2
- package/dist/module/js/NavigationService.js.map +1 -1
- package/dist/module/js/Styles.js +0 -2
- package/dist/module/js/Styles.js.map +1 -1
- package/dist/module/js/helpers.js +7 -6
- package/dist/module/js/helpers.js.map +1 -1
- package/dist/module/js/index.js +0 -2
- package/dist/module/js/index.js.map +1 -1
- package/dist/module/js/spacing.js +0 -2
- package/dist/module/js/spacing.js.map +1 -1
- package/dist/module/js/types.js +0 -2
- package/dist/module/js/types.js.map +1 -1
- package/dist/module/reducers/featureBuilderReducer.js +0 -2
- package/dist/module/reducers/featureBuilderReducer.js.map +1 -1
- package/dist/module/utils/featureSelectors.js +0 -2
- package/dist/module/utils/featureSelectors.js.map +1 -1
- package/dist/module/utils/selectors.js +13 -9
- package/dist/module/utils/selectors.js.map +1 -1
- package/dist/module/values.config.a.js +0 -2
- package/dist/module/values.config.a.js.map +1 -1
- package/dist/module/values.config.b.js +0 -2
- package/dist/module/values.config.b.js.map +1 -1
- package/dist/module/values.config.c.js +0 -2
- package/dist/module/values.config.c.js.map +1 -1
- package/dist/module/values.config.d.js +0 -2
- package/dist/module/values.config.d.js.map +1 -1
- package/dist/module/values.config.default.js +2 -4
- package/dist/module/values.config.default.js.map +1 -1
- package/dist/module/values.config.js +0 -2
- package/dist/module/values.config.js.map +1 -1
- package/dist/module/webapi/featureBuilderAPI.js +0 -2
- package/dist/module/webapi/featureBuilderAPI.js.map +1 -1
- package/dist/module/webapi/helper.js +0 -2
- package/dist/module/webapi/helper.js.map +1 -1
- package/dist/module/webapi/index.js +0 -2
- package/dist/module/webapi/index.js.map +1 -1
- package/package.json +19 -14
- package/src/actions/featureBuilderActions.js +10 -2
- package/src/components/FeatureDetailScreen.js +2 -2
- package/src/components/FeatureListItem.js +2 -2
- package/src/components/FeatureListScreen.js +87 -61
- package/src/components/FieldRenderer.js +3 -8
- package/src/components/FileDownload.js +2 -2
- package/src/components/WidgetGrid.js +2 -1
- package/src/components/WidgetLarge.js +36 -28
- package/src/components/WidgetSmall.js +34 -26
- package/src/components/common/index.js +1 -0
- package/src/components/layouts/CondensedList.js +4 -3
- package/src/components/layouts/FeatureImageList.js +4 -3
- package/src/components/layouts/RoundImageList.js +4 -3
- package/src/components/layouts/SquareImageList.js +4 -3
- package/src/core.config.js +0 -2
- package/src/values.config.default.js +2 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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); }
|
|
3
4
|
import React, { Component } from "react";
|
|
5
|
+
import { Text } from "@plusscommunities/pluss-core-app/components";
|
|
4
6
|
import { SPACING } from "../js/spacing";
|
|
5
|
-
import { Platform, View, ScrollView, Animated, Dimensions, StatusBar,
|
|
6
|
-
import { FontAwesome } from "
|
|
7
|
+
import { Platform, View, ScrollView, Animated, Dimensions, StatusBar, TouchableOpacity, Linking, StyleSheet, KeyboardAvoidingView, Image } from "react-native";
|
|
8
|
+
import { FontAwesome } from "./common";
|
|
7
9
|
import { connect } from "react-redux";
|
|
8
10
|
import _ from "lodash";
|
|
9
11
|
import { LinearGradient } from "expo-linear-gradient";
|
|
@@ -16,7 +18,6 @@ import { selectFeatureDefinition } from "../utils/selectors";
|
|
|
16
18
|
import Constants from "expo-constants";
|
|
17
19
|
import { InlineButton } from "./common";
|
|
18
20
|
import { FIELD_TYPES } from "../js/FieldTypes";
|
|
19
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
21
|
const SCREEN_HEIGHT = Dimensions.get("window").height;
|
|
21
22
|
const CARD_IMAGE_HEIGHT = SCREEN_HEIGHT * 0.3;
|
|
22
23
|
const SCREEN_WIDTH = Dimensions.get("window").width;
|
|
@@ -31,6 +32,140 @@ const getStatusBarHeight = () => {
|
|
|
31
32
|
class FeatureDetailScreen extends Component {
|
|
32
33
|
constructor(props) {
|
|
33
34
|
super(props);
|
|
35
|
+
_defineProperty(this, "onPressBack", () => {
|
|
36
|
+
Services.navigation.goBack();
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Collect all images from listing fields
|
|
40
|
+
*/
|
|
41
|
+
_defineProperty(this, "collectAllImages", () => {
|
|
42
|
+
const {
|
|
43
|
+
listing,
|
|
44
|
+
featureDefinition
|
|
45
|
+
} = this.props;
|
|
46
|
+
if (!listing || !listing.fields || !featureDefinition) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
const allImages = [];
|
|
50
|
+
const fieldDefinitions = featureDefinition.fields || [];
|
|
51
|
+
|
|
52
|
+
// Add primary feature image first
|
|
53
|
+
const primaryImage = listing.fields[values.mandatoryFields.featureImage];
|
|
54
|
+
if (primaryImage) {
|
|
55
|
+
const imageObj = this.normalizeImageField(primaryImage);
|
|
56
|
+
if (imageObj) {
|
|
57
|
+
allImages.push({
|
|
58
|
+
...imageObj,
|
|
59
|
+
fieldId: values.mandatoryFields.featureImage,
|
|
60
|
+
fieldLabel: values.labels.featureImage
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Add additional image fields
|
|
66
|
+
fieldDefinitions.forEach(fieldDef => {
|
|
67
|
+
if ((fieldDef.type === FIELD_TYPES.IMAGE || fieldDef.type === FIELD_TYPES.GALLERY) && fieldDef.id !== values.mandatoryFields.featureImage) {
|
|
68
|
+
const fieldValue = listing.fields[fieldDef.id];
|
|
69
|
+
if (fieldValue) {
|
|
70
|
+
if (fieldDef.type === FIELD_TYPES.GALLERY) {
|
|
71
|
+
// Handle Gallery (Array of images)
|
|
72
|
+
if (Array.isArray(fieldValue)) {
|
|
73
|
+
fieldValue.forEach(item => {
|
|
74
|
+
const imageObj = this.normalizeImageField(item);
|
|
75
|
+
if (imageObj) {
|
|
76
|
+
allImages.push({
|
|
77
|
+
...imageObj,
|
|
78
|
+
fieldId: fieldDef.id,
|
|
79
|
+
fieldLabel: fieldDef.label || fieldDef.id
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
// Handle Single Image
|
|
86
|
+
const imageObj = this.normalizeImageField(fieldValue);
|
|
87
|
+
if (imageObj) {
|
|
88
|
+
allImages.push({
|
|
89
|
+
...imageObj,
|
|
90
|
+
fieldId: fieldDef.id,
|
|
91
|
+
fieldLabel: fieldDef.label || fieldDef.id
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return allImages;
|
|
99
|
+
});
|
|
100
|
+
/**
|
|
101
|
+
* Normalize image field to object format
|
|
102
|
+
*/
|
|
103
|
+
_defineProperty(this, "normalizeImageField", imageField => {
|
|
104
|
+
if (!imageField) return null;
|
|
105
|
+
if (typeof imageField === "string") {
|
|
106
|
+
return {
|
|
107
|
+
uri: imageField,
|
|
108
|
+
url: imageField
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (typeof imageField === "object") {
|
|
112
|
+
if (imageField.uri) {
|
|
113
|
+
return {
|
|
114
|
+
uri: imageField.uri,
|
|
115
|
+
url: imageField.uri,
|
|
116
|
+
...imageField
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (imageField.url) {
|
|
120
|
+
return {
|
|
121
|
+
uri: imageField.url,
|
|
122
|
+
url: imageField.url,
|
|
123
|
+
...imageField
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* Open image popup with all images
|
|
131
|
+
*/
|
|
132
|
+
_defineProperty(this, "openImagePopup", (imageIndex = 0) => {
|
|
133
|
+
const {
|
|
134
|
+
allImages
|
|
135
|
+
} = this.state;
|
|
136
|
+
if (allImages.length > 0) {
|
|
137
|
+
this.setState({
|
|
138
|
+
showImagePopup: true,
|
|
139
|
+
selectedImageIndex: imageIndex
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* Close image popup
|
|
145
|
+
*/
|
|
146
|
+
_defineProperty(this, "closeImagePopup", () => {
|
|
147
|
+
this.setState({
|
|
148
|
+
showImagePopup: false,
|
|
149
|
+
selectedImageIndex: 0
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
/**
|
|
153
|
+
* Handle link opening for various field types
|
|
154
|
+
*/
|
|
155
|
+
_defineProperty(this, "handleLinkPress", url => {
|
|
156
|
+
if (url) {
|
|
157
|
+
Linking.openURL(url).catch(err => {
|
|
158
|
+
// Silently handle URL open errors
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
_defineProperty(this, "handleFilePress", file => {
|
|
163
|
+
if (file !== null && file !== void 0 && file.url) {
|
|
164
|
+
Linking.openURL(file.url).catch(err => {
|
|
165
|
+
// Silently handle URL open errors
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
34
169
|
this.state = {
|
|
35
170
|
isHomeTab: false,
|
|
36
171
|
showImagePopup: false,
|
|
@@ -55,128 +190,6 @@ class FeatureDetailScreen extends Component {
|
|
|
55
190
|
componentWillUnmount() {
|
|
56
191
|
if (Platform.OS === "ios") StatusBar.setBarStyle("dark-content");
|
|
57
192
|
}
|
|
58
|
-
onPressBack = () => {
|
|
59
|
-
Services.navigation.goBack();
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Collect all images from listing fields
|
|
64
|
-
*/
|
|
65
|
-
collectAllImages = () => {
|
|
66
|
-
const {
|
|
67
|
-
listing,
|
|
68
|
-
featureDefinition
|
|
69
|
-
} = this.props;
|
|
70
|
-
if (!listing || !listing.fields || !featureDefinition) {
|
|
71
|
-
return [];
|
|
72
|
-
}
|
|
73
|
-
const allImages = [];
|
|
74
|
-
const fieldDefinitions = featureDefinition.fields || [];
|
|
75
|
-
|
|
76
|
-
// Add primary feature image first
|
|
77
|
-
const primaryImage = listing.fields[values.mandatoryFields.featureImage];
|
|
78
|
-
if (primaryImage) {
|
|
79
|
-
const imageObj = this.normalizeImageField(primaryImage);
|
|
80
|
-
if (imageObj) {
|
|
81
|
-
allImages.push({
|
|
82
|
-
...imageObj,
|
|
83
|
-
fieldId: values.mandatoryFields.featureImage,
|
|
84
|
-
fieldLabel: values.labels.featureImage
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Add additional image fields
|
|
90
|
-
fieldDefinitions.forEach(fieldDef => {
|
|
91
|
-
if ((fieldDef.type === FIELD_TYPES.IMAGE || fieldDef.type === FIELD_TYPES.GALLERY) && fieldDef.id !== values.mandatoryFields.featureImage) {
|
|
92
|
-
const fieldValue = listing.fields[fieldDef.id];
|
|
93
|
-
if (fieldValue) {
|
|
94
|
-
if (fieldDef.type === FIELD_TYPES.GALLERY) {
|
|
95
|
-
// Handle Gallery (Array of images)
|
|
96
|
-
if (Array.isArray(fieldValue)) {
|
|
97
|
-
fieldValue.forEach(item => {
|
|
98
|
-
const imageObj = this.normalizeImageField(item);
|
|
99
|
-
if (imageObj) {
|
|
100
|
-
allImages.push({
|
|
101
|
-
...imageObj,
|
|
102
|
-
fieldId: fieldDef.id,
|
|
103
|
-
fieldLabel: fieldDef.label || fieldDef.id
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
} else {
|
|
109
|
-
// Handle Single Image
|
|
110
|
-
const imageObj = this.normalizeImageField(fieldValue);
|
|
111
|
-
if (imageObj) {
|
|
112
|
-
allImages.push({
|
|
113
|
-
...imageObj,
|
|
114
|
-
fieldId: fieldDef.id,
|
|
115
|
-
fieldLabel: fieldDef.label || fieldDef.id
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
return allImages;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Normalize image field to object format
|
|
127
|
-
*/
|
|
128
|
-
normalizeImageField = imageField => {
|
|
129
|
-
if (!imageField) return null;
|
|
130
|
-
if (typeof imageField === "string") {
|
|
131
|
-
return {
|
|
132
|
-
uri: imageField,
|
|
133
|
-
url: imageField
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
if (typeof imageField === "object") {
|
|
137
|
-
if (imageField.uri) {
|
|
138
|
-
return {
|
|
139
|
-
uri: imageField.uri,
|
|
140
|
-
url: imageField.uri,
|
|
141
|
-
...imageField
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
if (imageField.url) {
|
|
145
|
-
return {
|
|
146
|
-
uri: imageField.url,
|
|
147
|
-
url: imageField.url,
|
|
148
|
-
...imageField
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return null;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Open image popup with all images
|
|
157
|
-
*/
|
|
158
|
-
openImagePopup = (imageIndex = 0) => {
|
|
159
|
-
const {
|
|
160
|
-
allImages
|
|
161
|
-
} = this.state;
|
|
162
|
-
if (allImages.length > 0) {
|
|
163
|
-
this.setState({
|
|
164
|
-
showImagePopup: true,
|
|
165
|
-
selectedImageIndex: imageIndex
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Close image popup
|
|
172
|
-
*/
|
|
173
|
-
closeImagePopup = () => {
|
|
174
|
-
this.setState({
|
|
175
|
-
showImagePopup: false,
|
|
176
|
-
selectedImageIndex: 0
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
|
|
180
193
|
/**
|
|
181
194
|
* Process fields: filter out mandatory fields and sort by order
|
|
182
195
|
*/
|
|
@@ -208,32 +221,16 @@ class FeatureDetailScreen extends Component {
|
|
|
208
221
|
fieldId,
|
|
209
222
|
fieldValue: listing.fields[fieldId],
|
|
210
223
|
fieldDefinition,
|
|
211
|
-
fieldType: fieldDefinition
|
|
224
|
+
fieldType: (fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.type) || FIELD_TYPES.TEXT
|
|
212
225
|
};
|
|
213
226
|
});
|
|
214
227
|
|
|
215
228
|
// Sort by order property if available
|
|
216
|
-
return _.sortBy(filteredFields, field =>
|
|
229
|
+
return _.sortBy(filteredFields, field => {
|
|
230
|
+
var _field$fieldDefinitio;
|
|
231
|
+
return ((_field$fieldDefinitio = field.fieldDefinition) === null || _field$fieldDefinitio === void 0 ? void 0 : _field$fieldDefinitio.order) || 999;
|
|
232
|
+
});
|
|
217
233
|
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Handle link opening for various field types
|
|
221
|
-
*/
|
|
222
|
-
handleLinkPress = url => {
|
|
223
|
-
if (url) {
|
|
224
|
-
Linking.openURL(url).catch(err => {
|
|
225
|
-
// Silently handle URL open errors
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
handleFilePress = file => {
|
|
230
|
-
if (file?.url) {
|
|
231
|
-
Linking.openURL(file.url).catch(err => {
|
|
232
|
-
// Silently handle URL open errors
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
|
|
237
234
|
/**
|
|
238
235
|
* Render individual field based on its type
|
|
239
236
|
*/
|
|
@@ -249,76 +246,68 @@ class FeatureDetailScreen extends Component {
|
|
|
249
246
|
switch (type) {
|
|
250
247
|
case FIELD_TYPES.CTA:
|
|
251
248
|
{
|
|
252
|
-
const btnLabel = fieldValue
|
|
253
|
-
const btnUrl = fieldValue
|
|
254
|
-
return /*#__PURE__*/
|
|
255
|
-
style: styles.ctaContainer
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
})
|
|
262
|
-
});
|
|
249
|
+
const btnLabel = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) || label;
|
|
250
|
+
const btnUrl = fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.url;
|
|
251
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
252
|
+
style: styles.ctaContainer
|
|
253
|
+
}, /*#__PURE__*/React.createElement(InlineButton, {
|
|
254
|
+
large: true,
|
|
255
|
+
color: colourBrandingMain,
|
|
256
|
+
onPress: () => this.handleLinkPress(btnUrl)
|
|
257
|
+
}, btnLabel));
|
|
263
258
|
}
|
|
264
259
|
case FIELD_TYPES.EMAIL:
|
|
265
|
-
return /*#__PURE__*/
|
|
260
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
266
261
|
style: styles.linkContainer,
|
|
267
|
-
onPress: () => this.handleLinkPress(`mailto:${fieldValue}`)
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
})]
|
|
279
|
-
});
|
|
262
|
+
onPress: () => this.handleLinkPress(`mailto:${fieldValue}`)
|
|
263
|
+
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
264
|
+
name: "envelope",
|
|
265
|
+
size: 16,
|
|
266
|
+
color: colourBrandingMain,
|
|
267
|
+
style: styles.fieldIcon
|
|
268
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
269
|
+
style: [styles.linkText, {
|
|
270
|
+
color: colourBrandingMain
|
|
271
|
+
}]
|
|
272
|
+
}, fieldValue));
|
|
280
273
|
case FIELD_TYPES.DATE:
|
|
281
|
-
return /*#__PURE__*/
|
|
282
|
-
style: styles.dateContainer
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
})]
|
|
292
|
-
});
|
|
274
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
275
|
+
style: styles.dateContainer
|
|
276
|
+
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
277
|
+
name: "calendar",
|
|
278
|
+
size: 16,
|
|
279
|
+
color: TEXT_DARK,
|
|
280
|
+
style: styles.fieldIcon
|
|
281
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
282
|
+
style: styles.bodyText
|
|
283
|
+
}, fieldValue));
|
|
293
284
|
case FIELD_TYPES.FILE:
|
|
294
285
|
{
|
|
295
286
|
// Handle both single file and multiple files (array)
|
|
296
287
|
const files = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
|
|
297
|
-
return /*#__PURE__*/
|
|
298
|
-
style: styles.filesContainer
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
});
|
|
288
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
289
|
+
style: styles.filesContainer
|
|
290
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
291
|
+
style: styles.sectionTitle
|
|
292
|
+
}, values.labels.attachments), files.map((file, index) => {
|
|
293
|
+
// Skip null/undefined files
|
|
294
|
+
if (!file) return null;
|
|
295
|
+
return /*#__PURE__*/React.createElement(FileDownload, {
|
|
296
|
+
key: index,
|
|
297
|
+
file: file,
|
|
298
|
+
onPress: this.handleFilePress,
|
|
299
|
+
color: this.props.colourBrandingMain
|
|
300
|
+
});
|
|
301
|
+
}));
|
|
312
302
|
}
|
|
313
303
|
case FIELD_TYPES.DESCRIPTION:
|
|
314
|
-
return /*#__PURE__*/
|
|
315
|
-
style: styles.descriptionText
|
|
316
|
-
|
|
317
|
-
});
|
|
304
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
305
|
+
style: styles.descriptionText
|
|
306
|
+
}, fieldValue);
|
|
318
307
|
case FIELD_TYPES.IMAGE:
|
|
319
308
|
{
|
|
320
309
|
// Render secondary images inline with click handler
|
|
321
|
-
const imgUri = fieldValue
|
|
310
|
+
const imgUri = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.url) || (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.uri) || (typeof fieldValue === "string" ? fieldValue : null);
|
|
322
311
|
if (!imgUri) return null;
|
|
323
312
|
|
|
324
313
|
// Find this image's index for popup
|
|
@@ -326,84 +315,76 @@ class FeatureDetailScreen extends Component {
|
|
|
326
315
|
allImages
|
|
327
316
|
} = this.state;
|
|
328
317
|
const imageIndex = allImages.findIndex(img => img.uri === imgUri || img.url === imgUri);
|
|
329
|
-
const caption = fieldValue
|
|
330
|
-
return /*#__PURE__*/
|
|
318
|
+
const caption = fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.caption;
|
|
319
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
331
320
|
onPress: () => this.openImagePopup(imageIndex),
|
|
332
|
-
activeOpacity: 0.8
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
})]
|
|
343
|
-
});
|
|
321
|
+
activeOpacity: 0.8
|
|
322
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
323
|
+
source: {
|
|
324
|
+
uri: imgUri
|
|
325
|
+
},
|
|
326
|
+
style: styles.inlineImage,
|
|
327
|
+
resizeMode: "cover"
|
|
328
|
+
}), caption && /*#__PURE__*/React.createElement(Text, {
|
|
329
|
+
style: styles.imageCaption
|
|
330
|
+
}, caption));
|
|
344
331
|
}
|
|
345
332
|
case FIELD_TYPES.GALLERY:
|
|
346
333
|
{
|
|
347
334
|
// Handle Gallery Fields (arrays of images)
|
|
348
335
|
if (!Array.isArray(fieldValue)) return null;
|
|
349
|
-
return /*#__PURE__*/
|
|
336
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
350
337
|
style: {
|
|
351
338
|
marginVertical: 16
|
|
352
|
-
}
|
|
353
|
-
|
|
339
|
+
}
|
|
340
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
341
|
+
style: {
|
|
342
|
+
flexDirection: "row",
|
|
343
|
+
flexWrap: "wrap",
|
|
344
|
+
marginHorizontal: -4
|
|
345
|
+
}
|
|
346
|
+
}, fieldValue.map((imgItem, index) => {
|
|
347
|
+
const imgUri = (imgItem === null || imgItem === void 0 ? void 0 : imgItem.url) || (imgItem === null || imgItem === void 0 ? void 0 : imgItem.uri) || (typeof imgItem === "string" ? imgItem : null);
|
|
348
|
+
if (!imgUri) return null;
|
|
349
|
+
|
|
350
|
+
// Find global index for the popup
|
|
351
|
+
const {
|
|
352
|
+
allImages
|
|
353
|
+
} = this.state;
|
|
354
|
+
const globalIndex = allImages.findIndex(img => img.uri === imgUri || img.url === imgUri);
|
|
355
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
356
|
+
key: index,
|
|
357
|
+
onPress: () => this.openImagePopup(globalIndex !== -1 ? globalIndex : 0),
|
|
358
|
+
activeOpacity: 0.8,
|
|
354
359
|
style: {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
360
|
+
width: "50%",
|
|
361
|
+
padding: 4
|
|
362
|
+
} // 2 column grid
|
|
363
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
364
|
+
source: {
|
|
365
|
+
uri: imgUri
|
|
358
366
|
},
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
} = this.state;
|
|
367
|
-
const globalIndex = allImages.findIndex(img => img.uri === imgUri || img.url === imgUri);
|
|
368
|
-
return /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
369
|
-
onPress: () => this.openImagePopup(globalIndex !== -1 ? globalIndex : 0),
|
|
370
|
-
activeOpacity: 0.8,
|
|
371
|
-
style: {
|
|
372
|
-
width: "50%",
|
|
373
|
-
padding: 4
|
|
374
|
-
} // 2 column grid
|
|
375
|
-
,
|
|
376
|
-
children: /*#__PURE__*/_jsx(Image, {
|
|
377
|
-
source: {
|
|
378
|
-
uri: imgUri
|
|
379
|
-
},
|
|
380
|
-
style: [styles.inlineImage, {
|
|
381
|
-
height: 150,
|
|
382
|
-
marginVertical: 0
|
|
383
|
-
}],
|
|
384
|
-
resizeMode: "cover"
|
|
385
|
-
})
|
|
386
|
-
}, index);
|
|
387
|
-
})
|
|
388
|
-
})
|
|
389
|
-
});
|
|
367
|
+
style: [styles.inlineImage, {
|
|
368
|
+
height: 150,
|
|
369
|
+
marginVertical: 0
|
|
370
|
+
}],
|
|
371
|
+
resizeMode: "cover"
|
|
372
|
+
}));
|
|
373
|
+
})));
|
|
390
374
|
}
|
|
391
375
|
case FIELD_TYPES.TITLE:
|
|
392
|
-
return /*#__PURE__*/
|
|
393
|
-
style: styles.titleText
|
|
394
|
-
|
|
395
|
-
});
|
|
376
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
377
|
+
style: styles.titleText
|
|
378
|
+
}, fieldValue);
|
|
396
379
|
case FIELD_TYPES.NUMBER:
|
|
397
|
-
return /*#__PURE__*/
|
|
398
|
-
style: styles.numberText
|
|
399
|
-
|
|
400
|
-
});
|
|
380
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
381
|
+
style: styles.numberText
|
|
382
|
+
}, fieldValue);
|
|
401
383
|
default:
|
|
402
384
|
// Default text fallback
|
|
403
|
-
return /*#__PURE__*/
|
|
404
|
-
style: styles.bodyText
|
|
405
|
-
|
|
406
|
-
});
|
|
385
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
386
|
+
style: styles.bodyText
|
|
387
|
+
}, typeof fieldValue === "object" ? JSON.stringify(fieldValue) : fieldValue);
|
|
407
388
|
}
|
|
408
389
|
}
|
|
409
390
|
|
|
@@ -413,13 +394,13 @@ class FeatureDetailScreen extends Component {
|
|
|
413
394
|
renderFields() {
|
|
414
395
|
const processedFields = this.processFields();
|
|
415
396
|
return processedFields.map((field, _index) => {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
}, field.
|
|
397
|
+
var _field$fieldDefinitio2, _field$fieldDefinitio3;
|
|
398
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
399
|
+
key: field.fieldId,
|
|
400
|
+
style: styles.fieldContainer
|
|
401
|
+
}, field.fieldType !== FIELD_TYPES.CTA && field.fieldType !== FIELD_TYPES.IMAGE && ((_field$fieldDefinitio2 = field.fieldDefinition) === null || _field$fieldDefinitio2 === void 0 ? void 0 : _field$fieldDefinitio2.label) && /*#__PURE__*/React.createElement(Text, {
|
|
402
|
+
style: styles.fieldLabel
|
|
403
|
+
}, (_field$fieldDefinitio3 = field.fieldDefinition) === null || _field$fieldDefinitio3 === void 0 ? void 0 : _field$fieldDefinitio3.label), this.renderField(field.fieldDefinition, field.fieldValue));
|
|
423
404
|
});
|
|
424
405
|
}
|
|
425
406
|
getImageSource() {
|
|
@@ -438,7 +419,7 @@ class FeatureDetailScreen extends Component {
|
|
|
438
419
|
if (typeof imageField === "string") {
|
|
439
420
|
return imageField;
|
|
440
421
|
}
|
|
441
|
-
return imageField
|
|
422
|
+
return (imageField === null || imageField === void 0 ? void 0 : imageField.uri) || (imageField === null || imageField === void 0 ? void 0 : imageField.url) || null;
|
|
442
423
|
}
|
|
443
424
|
getTitle() {
|
|
444
425
|
const {
|
|
@@ -456,92 +437,80 @@ class FeatureDetailScreen extends Component {
|
|
|
456
437
|
const imageSource = this.getImageSource();
|
|
457
438
|
const title = this.getTitle();
|
|
458
439
|
if (!listing || !listing.fields) {
|
|
459
|
-
return /*#__PURE__*/
|
|
460
|
-
style: styles.centerContainer
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
})
|
|
465
|
-
});
|
|
440
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
441
|
+
style: styles.centerContainer
|
|
442
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
443
|
+
style: styles.errorText
|
|
444
|
+
}, "Item not found"));
|
|
466
445
|
}
|
|
467
|
-
return /*#__PURE__*/
|
|
446
|
+
return /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
|
468
447
|
behavior: Platform.OS === "ios" && "padding",
|
|
469
448
|
style: {
|
|
470
449
|
position: "relative",
|
|
471
450
|
flex: 1,
|
|
472
451
|
backgroundColor: Colours.BACKGROUND_WHITE || "#fff"
|
|
452
|
+
}
|
|
453
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
454
|
+
style: styles.backButton
|
|
455
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
456
|
+
style: styles.headerContent
|
|
457
|
+
}, /*#__PURE__*/React.createElement(Components.BackButton, {
|
|
458
|
+
onPress: this.onPressBack,
|
|
459
|
+
style: {
|
|
460
|
+
marginLeft: 16
|
|
461
|
+
}
|
|
462
|
+
}))), /*#__PURE__*/React.createElement(ScrollView, {
|
|
463
|
+
style: {
|
|
464
|
+
backgroundColor: Colours.BACKGROUND_WHITE || "#fff"
|
|
473
465
|
},
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
style: {
|
|
523
|
-
paddingHorizontal: 16
|
|
524
|
-
},
|
|
525
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
526
|
-
style: styles.titleContainer,
|
|
527
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
528
|
-
style: styles.eventTitle,
|
|
529
|
-
children: title
|
|
530
|
-
})
|
|
531
|
-
})
|
|
532
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
533
|
-
style: {
|
|
534
|
-
minHeight: SCREEN_HEIGHT - CARD_IMAGE_HEIGHT - 56
|
|
535
|
-
},
|
|
536
|
-
children: this.renderFields()
|
|
537
|
-
})]
|
|
538
|
-
}), this.state.showImagePopup && /*#__PURE__*/_jsx(Components.ImagePopup, {
|
|
539
|
-
visible: this.state.showImagePopup,
|
|
540
|
-
images: this.state.allImages,
|
|
541
|
-
index: this.state.selectedImageIndex,
|
|
542
|
-
onClose: this.closeImagePopup
|
|
543
|
-
})]
|
|
544
|
-
});
|
|
466
|
+
keyboardShouldPersistTaps: "always",
|
|
467
|
+
ref: ref => {
|
|
468
|
+
this.scrollView = ref;
|
|
469
|
+
}
|
|
470
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
471
|
+
style: [styles.mainHeader]
|
|
472
|
+
}, imageSource ? /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
473
|
+
onPress: () => this.openImagePopup(0),
|
|
474
|
+
activeOpacity: 0.9
|
|
475
|
+
}, /*#__PURE__*/React.createElement(Components.AutoOffsetImage, {
|
|
476
|
+
uri: imageSource,
|
|
477
|
+
height: CARD_IMAGE_HEIGHT,
|
|
478
|
+
width: SCREEN_WIDTH
|
|
479
|
+
})) : /*#__PURE__*/React.createElement(View, {
|
|
480
|
+
style: [styles.grayPlaceholder, {
|
|
481
|
+
height: CARD_IMAGE_HEIGHT,
|
|
482
|
+
width: SCREEN_WIDTH
|
|
483
|
+
}]
|
|
484
|
+
}), /*#__PURE__*/React.createElement(LinearGradient, {
|
|
485
|
+
style: styles.gradientOverlay,
|
|
486
|
+
colors: ["rgba(0,0,0,0.7)", COLOUR_TRANSPARENT],
|
|
487
|
+
start: {
|
|
488
|
+
x: 0,
|
|
489
|
+
y: 0
|
|
490
|
+
},
|
|
491
|
+
end: {
|
|
492
|
+
x: 0,
|
|
493
|
+
y: 1
|
|
494
|
+
},
|
|
495
|
+
locations: [0, 0.5]
|
|
496
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
497
|
+
style: {
|
|
498
|
+
paddingHorizontal: 16
|
|
499
|
+
}
|
|
500
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
501
|
+
style: styles.titleContainer
|
|
502
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
503
|
+
style: styles.eventTitle
|
|
504
|
+
}, title))), /*#__PURE__*/React.createElement(View, {
|
|
505
|
+
style: {
|
|
506
|
+
minHeight: SCREEN_HEIGHT - CARD_IMAGE_HEIGHT - 56
|
|
507
|
+
}
|
|
508
|
+
}, this.renderFields())), this.state.showImagePopup && /*#__PURE__*/React.createElement(Components.ImagePopup, {
|
|
509
|
+
visible: this.state.showImagePopup,
|
|
510
|
+
images: this.state.allImages,
|
|
511
|
+
index: this.state.selectedImageIndex,
|
|
512
|
+
onClose: this.closeImagePopup
|
|
513
|
+
}));
|
|
545
514
|
}
|
|
546
515
|
}
|
|
547
516
|
const styles = StyleSheet.create({
|