@plusscommunities/pluss-core-app 1.5.6-beta.0 → 1.5.8-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,8 +3,9 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  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; }
4
4
 
5
5
  import React, { Component } from 'react';
6
- import { Platform, Linking, StyleSheet, Text, View, TouchableOpacity } from 'react-native';
6
+ import { Platform, Linking, StyleSheet, Text, View, TouchableOpacity, ScrollView } from 'react-native';
7
7
  import { connect } from 'react-redux';
8
+ import _ from 'lodash';
8
9
  import * as Calendar from 'expo-calendar';
9
10
  import { TEXT_DARK, getMainBrandingColourFromState } from '../colours';
10
11
  import { InlineButton } from './InlineButton';
@@ -56,7 +57,16 @@ class AddToCalendarButton extends Component {
56
57
  let calendars = await Calendar.getCalendarsAsync(Calendar.EntityTypes.EVENT); // console.log('all calendars', calendars);
57
58
 
58
59
  if (calendars && calendars.length > 0) {
59
- calendars = calendars.filter(c => c.allowsModifications);
60
+ calendars = calendars.filter(c => c.allowsModifications).map(c => {
61
+ return {
62
+ id: c.id,
63
+ title: c.title,
64
+ source: c.source.name,
65
+ color: c.color,
66
+ type: c.type
67
+ };
68
+ });
69
+ calendars = _.orderBy(calendars, ['source', 'title']); // console.log('sorted calendars', calendars);
60
70
  }
61
71
 
62
72
  this.setState({
@@ -122,13 +132,18 @@ class AddToCalendarButton extends Component {
122
132
  renderCalendars(calendars) {
123
133
  return /*#__PURE__*/React.createElement(MiddlePopup, {
124
134
  style: [styles.calendarsPopup, {
125
- height: calendars.length * 50 + 100
135
+ height: calendars.length * 60 + 120
126
136
  }],
127
137
  onClose: this.onCloseCalendars
128
138
  }, /*#__PURE__*/React.createElement(Text, {
129
139
  style: styles.calendarPopupTitle
130
140
  }, "Select Calendar"), /*#__PURE__*/React.createElement(View, {
131
141
  style: styles.calendarPopupContainer
142
+ }, /*#__PURE__*/React.createElement(ScrollView, {
143
+ style: {
144
+ flex: 1
145
+ },
146
+ showsVerticalScrollIndicator: false
132
147
  }, calendars.map(cal => {
133
148
  return /*#__PURE__*/React.createElement(TouchableOpacity, {
134
149
  key: cal.id,
@@ -139,8 +154,8 @@ class AddToCalendarButton extends Component {
139
154
  }]
140
155
  }, /*#__PURE__*/React.createElement(Text, {
141
156
  style: styles.calendarText
142
- }, cal.title)));
143
- }), /*#__PURE__*/React.createElement(TouchableOpacity, {
157
+ }, `${cal.source}${cal.source === cal.title ? '' : `\n${cal.title}`}`)));
158
+ })), /*#__PURE__*/React.createElement(TouchableOpacity, {
144
159
  key: 'cancel',
145
160
  onPress: this.onCloseCalendars
146
161
  }, /*#__PURE__*/React.createElement(View, {
@@ -183,6 +198,7 @@ class AddToCalendarButton extends Component {
183
198
  const styles = StyleSheet.create({
184
199
  calendarsPopup: {
185
200
  width: 250,
201
+ maxHeight: 400,
186
202
  padding: 16,
187
203
  borderRadius: 12
188
204
  },
@@ -199,11 +215,11 @@ const styles = StyleSheet.create({
199
215
  calendarContainer: {
200
216
  flexDirection: 'row',
201
217
  alignItems: 'center',
202
- justifyContent: 'space-between',
203
218
  width: 200,
204
- height: 30,
219
+ height: 40,
205
220
  paddingHorizontal: 8,
206
- borderRadius: 4
221
+ borderRadius: 4,
222
+ marginBottom: 10
207
223
  },
208
224
  calendarText: {
209
225
  color: '#fff',
@@ -1 +1 @@
1
- {"version":3,"sources":["AddToCalendarButton.js"],"names":["React","Component","Platform","Linking","StyleSheet","Text","View","TouchableOpacity","connect","Calendar","TEXT_DARK","getMainBrandingColourFromState","InlineButton","Popup","MiddlePopup","DEFAULT_TITLE","ERROR_EVENT_ADD","AddToCalendarButton","constructor","props","OS","setState","showPermissionWarning","openURL","eventToAdd","message","status","requestCalendarPermissionsAsync","showWarningPopup","calendars","getCalendarsAsync","EntityTypes","EVENT","length","filter","c","allowsModifications","calendar","eventId","createEventAsync","id","title","error","console","log","state","renderPermission","text","action","goToPermissionSettings","bold","closeWarningPopup","renderCalendars","styles","calendarsPopup","height","onCloseCalendars","calendarPopupTitle","calendarPopupContainer","map","cal","onSelectCalendar","calendarContainer","backgroundColor","color","calendarText","marginTop","colourBrandingMain","renderMessage","onCloseMessage","render","onAdd","children","create","width","padding","borderRadius","fontFamily","fontSize","marginBottom","flex","justifyContent","flexDirection","alignItems","paddingHorizontal","textAlign","mapStateToProps","button"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,QAAT,EAAmBC,OAAnB,EAA4BC,UAA5B,EAAwCC,IAAxC,EAA8CC,IAA9C,EAAoDC,gBAApD,QAA4E,cAA5E;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,OAAO,KAAKC,QAAZ,MAA0B,eAA1B;AACA,SAASC,SAAT,EAAoBC,8BAApB,QAA0D,YAA1D;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,WAAT,QAA4B,eAA5B;AAEA,MAAMC,aAAa,GAAG,iBAAtB;AACA,MAAMC,eAAe,GAAG,8CAAxB,C,CAEA;AACA;;AACA,MAAMC,mBAAN,SAAkChB,SAAlC,CAA4C;AAC1CiB,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,UAAMA,KAAN;;AADiB,8CAUA,MAAM;AACvB,UAAIjB,QAAQ,CAACkB,EAAT,KAAgB,KAApB,EAA2B;AAC3B,WAAKC,QAAL,CAAc;AAAEC,QAAAA,qBAAqB,EAAE;AAAzB,OAAd;AACD,KAbkB;;AAAA,+CAeC,MAAM;AACxB,WAAKD,QAAL,CAAc;AAAEC,QAAAA,qBAAqB,EAAE;AAAzB,OAAd;AACD,KAjBkB;;AAAA,oDAmBM,MAAM;AAC7BnB,MAAAA,OAAO,CAACoB,OAAR,CAAgB,eAAhB;AACA,WAAKF,QAAL,CAA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EAJE;AAKZE,IAAAA,IAAI,EAAE;AALM;AAzBiB,CAAlB,CAAf;;AAkCA,MAAMM,eAAe,GAAGzC,KAAK,IAAI;AAC/B,SAAO;AACLsB,IAAAA,kBAAkB,EAAExD,8BAA8B,CAACkC,KAAD;AAD7C,GAAP;AAGD,CAJD;;AAMA,MAAM0C,MAAM,GAAG/E,OAAO,CAAC8E,eAAD,EAAkB,EAAlB,CAAP,CAA6BrE,mBAA7B,CAAf;AACA,SAASsE,MAAM,IAAItE,mBAAnB","sourcesContent":["import React, { Component } from 'react';\nimport { Platform, Linking, StyleSheet, Text, View, TouchableOpacity } from 'react-native';\nimport { connect } from 'react-redux';\nimport * as Calendar from 'expo-calendar';\nimport { TEXT_DARK, getMainBrandingColourFromState } from '../colours';\nimport { InlineButton } from './InlineButton';\nimport { Popup } from './Popup';\nimport { MiddlePopup } from './MiddlePopup';\n\nconst DEFAULT_TITLE = 'Add to Calendar';\nconst ERROR_EVENT_ADD = 'There was a problem adding a calendar event.';\n\n// Required: eventToAdd\n// Documentation: https://docs.expo.dev/versions/latest/sdk/calendar/#event\nclass AddToCalendarButton extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n showPermissionWarning: false,\n calendars: null,\n message: null,\n };\n }\n\n showWarningPopup = () => {\n if (Platform.OS !== 'ios') return;\n this.setState({ showPermissionWarning: true });\n };\n\n closeWarningPopup = () => {\n this.setState({ showPermissionWarning: false });\n };\n\n goToPermissionSettings = () => {\n Linking.openURL('app-settings:');\n this.setState({ showPermissionWarning: false });\n };\n\n onAdd = async () => {\n if (!this.props.eventToAdd) {\n this.setState({ message: 'There is no event to add' });\n return;\n }\n\n const { status } = await Calendar.requestCalendarPermissionsAsync();\n if (status !== 'granted') {\n this.showWarningPopup();\n } else {\n let calendars = await Calendar.getCalendarsAsync(Calendar.EntityTypes.EVENT);\n // console.log('all calendars', calendars);\n if (calendars && calendars.length > 0) {\n calendars = calendars.filter(c => c.allowsModifications);\n }\n this.setState({ calendars });\n }\n };\n\n onCloseCalendars = () => {\n this.setState({ calendars: null });\n };\n\n onSelectCalendar = async calendar => {\n try {\n const { eventToAdd } = this.props;\n if (!eventToAdd) return;\n\n const eventId = await Calendar.createEventAsync(calendar.id, eventToAdd);\n\n this.setState({\n calendars: null,\n message: eventId ? `${eventToAdd.title} was added to ${calendar.title} successfully.` : ERROR_EVENT_ADD,\n });\n } catch (error) {\n console.log('onSelectCalendar', error);\n this.setState({ calendars: null, message: ERROR_EVENT_ADD });\n }\n };\n\n onCloseMessage = () => {\n this.setState({ message: null });\n };\n\n renderPermission() {\n return (\n <Popup\n title=\"Permissions missing\"\n text=\"You must grant access to the Calendars. Tap Go to settings to change your permission settings.\"\n options={[\n {\n text: 'Go to settings',\n action: this.goToPermissionSettings,\n bold: true,\n },\n {\n text: 'Ignore',\n action: this.closeWarningPopup,\n },\n ]}\n />\n );\n }\n\n renderCalendars(calendars) {\n return (\n <MiddlePopup style={[styles.calendarsPopup, { height: calendars.length * 50 + 100 }]} onClose={this.onCloseCalendars}>\n <Text style={styles.calendarPopupTitle}>Select Calendar</Text>\n <View style={styles.calendarPopupContainer}>\n {calendars.map(cal => {\n return (\n <TouchableOpacity key={cal.id} onPress={() => this.onSelectCalendar(cal)}>\n <View style={[styles.calendarContainer, { backgroundColor: cal.color }]}>\n <Text style={styles.calendarText}>{cal.title}</Text>\n </View>\n </TouchableOpacity>\n );\n })}\n <TouchableOpacity key={'cancel'} onPress={this.onCloseCalendars}>\n <View style={[styles.calendarContainer, { marginTop: 20, backgroundColor: this.props.colourBrandingMain }]}>\n <Text style={styles.calendarText}>Cancel</Text>\n </View>\n </TouchableOpacity>\n </View>\n </MiddlePopup>\n );\n }\n\n renderMessage(message) {\n return (\n <Popup\n title=\"Add to Calendar\"\n text={message}\n options={[\n {\n text: 'Ok',\n action: this.onCloseMessage,\n },\n ]}\n />\n );\n }\n\n render() {\n const { showPermissionWarning, calendars, message } = this.state;\n\n if (showPermissionWarning) return this.renderPermission();\n if (calendars && calendars.length > 0) return this.renderCalendars(calendars);\n if (message) return this.renderMessage(message);\n\n return (\n <InlineButton {...this.props} onPress={this.onAdd}>\n {this.props.children || DEFAULT_TITLE}\n </InlineButton>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n calendarsPopup: {\n width: 250,\n padding: 16,\n borderRadius: 12,\n },\n calendarPopupTitle: {\n fontFamily: 'sf-bold',\n color: TEXT_DARK,\n fontSize: 18,\n marginBottom: 16,\n },\n calendarPopupContainer: {\n flex: 1,\n justifyContent: 'space-between',\n },\n calendarContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n width: 200,\n height: 30,\n paddingHorizontal: 8,\n borderRadius: 4,\n },\n calendarText: {\n color: '#fff',\n textAlign: 'center',\n fontFamily: 'sf-semibold',\n fontSize: 13,\n flex: 1,\n },\n});\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst button = connect(mapStateToProps, {})(AddToCalendarButton);\nexport { button as AddToCalendarButton };\n"]}
1
+ {"version":3,"sources":["AddToCalendarButton.js"],"names":["React","Component","Platform","Linking","StyleSheet","Text","View","TouchableOpacity","ScrollView","connect","_","Calendar","TEXT_DARK","getMainBrandingColourFromState","InlineButton","Popup","MiddlePopup","DEFAULT_TITLE","ERROR_EVENT_ADD","AddToCalendarButton","constructor","props","OS","setState","showPermissionWarning","openURL","eventToAdd","message","status","requestCalendarPermissionsAsync","showWarningPopup","calendars","getCalendarsAsync","EntityTypes","EVENT","length","filter","c","allowsModifications","map","id","title","source","name","color","type","orderBy","calendar","eventId","createEventAsync","error","console","log","state","renderPermission","text","action","goToPermissionSettings","bold","closeWarningPopup","renderCalendars","styles","calendarsPopup","height","onCloseCalendars","calendarPopupTitle","calendarPopupContainer","flex","cal","onSelectCalendar","calendarContainer","backgroundColor","calendarText","marginTop","colourBrandingMain","renderMessage","onCloseMessage","render","onAdd","children","create","width","maxHeight","padding","borderRadius","fontFamily","fontSize","marginBottom","justif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,EAAE,CADgB;AAEtBqB,IAAAA,cAAc,EAAE;AAFM,GAbO;AAiB/BlB,EAAAA,iBAAiB,EAAE;AACjBmB,IAAAA,aAAa,EAAE,KADE;AAEjBC,IAAAA,UAAU,EAAE,QAFK;AAGjBT,IAAAA,KAAK,EAAE,GAHU;AAIjBlB,IAAAA,MAAM,EAAE,EAJS;AAKjB4B,IAAAA,iBAAiB,EAAE,CALF;AAMjBP,IAAAA,YAAY,EAAE,CANG;AAOjBG,IAAAA,YAAY,EAAE;AAPG,GAjBY;AA0B/Bf,EAAAA,YAAY,EAAE;AACZ5B,IAAAA,KAAK,EAAE,MADK;AAEZgD,IAAAA,SAAS,EAAE,QAFC;AAGZP,IAAAA,UAAU,EAAE,aAHA;AAIZC,IAAAA,QAAQ,EAAE,EAJE;AAKZnB,IAAAA,IAAI,EAAE;AALM;AA1BiB,CAAlB,CAAf;;AAmCA,MAAM0B,eAAe,GAAGxC,KAAK,IAAI;AAC/B,SAAO;AACLqB,IAAAA,kBAAkB,EAAE7D,8BAA8B,CAACwC,KAAD;AAD7C,GAAP;AAGD,CAJD;;AAMA,MAAMyC,MAAM,GAAGrF,OAAO,CAACoF,eAAD,EAAkB,EAAlB,CAAP,CAA6B1E,mBAA7B,CAAf;AACA,SAAS2E,MAAM,IAAI3E,mBAAnB","sourcesContent":["import React, { Component } from 'react';\nimport { Platform, Linking, StyleSheet, Text, View, TouchableOpacity, ScrollView } from 'react-native';\nimport { connect } from 'react-redux';\nimport _ from 'lodash';\nimport * as Calendar from 'expo-calendar';\nimport { TEXT_DARK, getMainBrandingColourFromState } from '../colours';\nimport { InlineButton } from './InlineButton';\nimport { Popup } from './Popup';\nimport { MiddlePopup } from './MiddlePopup';\n\nconst DEFAULT_TITLE = 'Add to Calendar';\nconst ERROR_EVENT_ADD = 'There was a problem adding a calendar event.';\n\n// Required: eventToAdd\n// Documentation: https://docs.expo.dev/versions/latest/sdk/calendar/#event\nclass AddToCalendarButton extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n showPermissionWarning: false,\n calendars: null,\n message: null,\n };\n }\n\n showWarningPopup = () => {\n if (Platform.OS !== 'ios') return;\n this.setState({ showPermissionWarning: true });\n };\n\n closeWarningPopup = () => {\n this.setState({ showPermissionWarning: false });\n };\n\n goToPermissionSettings = () => {\n Linking.openURL('app-settings:');\n this.setState({ showPermissionWarning: false });\n };\n\n onAdd = async () => {\n if (!this.props.eventToAdd) {\n this.setState({ message: 'There is no event to add' });\n return;\n }\n\n const { status } = await Calendar.requestCalendarPermissionsAsync();\n if (status !== 'granted') {\n this.showWarningPopup();\n } else {\n let calendars = await Calendar.getCalendarsAsync(Calendar.EntityTypes.EVENT);\n // console.log('all calendars', calendars);\n if (calendars && calendars.length > 0) {\n calendars = calendars\n .filter(c => c.allowsModifications)\n .map(c => {\n return {\n id: c.id,\n title: c.title,\n source: c.source.name,\n color: c.color,\n type: c.type,\n };\n });\n calendars = _.orderBy(calendars, ['source', 'title']);\n // console.log('sorted calendars', calendars);\n }\n this.setState({ calendars });\n }\n };\n\n onCloseCalendars = () => {\n this.setState({ calendars: null });\n };\n\n onSelectCalendar = async calendar => {\n try {\n const { eventToAdd } = this.props;\n if (!eventToAdd) return;\n\n const eventId = await Calendar.createEventAsync(calendar.id, eventToAdd);\n\n this.setState({\n calendars: null,\n message: eventId ? `${eventToAdd.title} was added to ${calendar.title} successfully.` : ERROR_EVENT_ADD,\n });\n } catch (error) {\n console.log('onSelectCalendar', error);\n this.setState({ calendars: null, message: ERROR_EVENT_ADD });\n }\n };\n\n onCloseMessage = () => {\n this.setState({ message: null });\n };\n\n renderPermission() {\n return (\n <Popup\n title=\"Permissions missing\"\n text=\"You must grant access to the Calendars. Tap Go to settings to change your permission settings.\"\n options={[\n {\n text: 'Go to settings',\n action: this.goToPermissionSettings,\n bold: true,\n },\n {\n text: 'Ignore',\n action: this.closeWarningPopup,\n },\n ]}\n />\n );\n }\n\n renderCalendars(calendars) {\n return (\n <MiddlePopup style={[styles.calendarsPopup, { height: calendars.length * 60 + 120 }]} onClose={this.onCloseCalendars}>\n <Text style={styles.calendarPopupTitle}>Select Calendar</Text>\n <View style={styles.calendarPopupContainer}>\n <ScrollView style={{ flex: 1 }} showsVerticalScrollIndicator={false}>\n {calendars.map(cal => {\n return (\n <TouchableOpacity key={cal.id} onPress={() => this.onSelectCalendar(cal)}>\n <View style={[styles.calendarContainer, { backgroundColor: cal.color }]}>\n <Text style={styles.calendarText}>{`${cal.source}${cal.source === cal.title ? '' : `\\n${cal.title}`}`}</Text>\n </View>\n </TouchableOpacity>\n );\n })}\n </ScrollView>\n <TouchableOpacity key={'cancel'} onPress={this.onCloseCalendars}>\n <View style={[styles.calendarContainer, { marginTop: 20, backgroundColor: this.props.colourBrandingMain }]}>\n <Text style={styles.calendarText}>Cancel</Text>\n </View>\n </TouchableOpacity>\n </View>\n </MiddlePopup>\n );\n }\n\n renderMessage(message) {\n return (\n <Popup\n title=\"Add to Calendar\"\n text={message}\n options={[\n {\n text: 'Ok',\n action: this.onCloseMessage,\n },\n ]}\n />\n );\n }\n\n render() {\n const { showPermissionWarning, calendars, message } = this.state;\n\n if (showPermissionWarning) return this.renderPermission();\n if (calendars && calendars.length > 0) return this.renderCalendars(calendars);\n if (message) return this.renderMessage(message);\n\n return (\n <InlineButton {...this.props} onPress={this.onAdd}>\n {this.props.children || DEFAULT_TITLE}\n </InlineButton>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n calendarsPopup: {\n width: 250,\n maxHeight: 400,\n padding: 16,\n borderRadius: 12,\n },\n calendarPopupTitle: {\n fontFamily: 'sf-bold',\n color: TEXT_DARK,\n fontSize: 18,\n marginBottom: 16,\n },\n calendarPopupContainer: {\n flex: 1,\n justifyContent: 'space-between',\n },\n calendarContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n width: 200,\n height: 40,\n paddingHorizontal: 8,\n borderRadius: 4,\n marginBottom: 10,\n },\n calendarText: {\n color: '#fff',\n textAlign: 'center',\n fontFamily: 'sf-semibold',\n fontSize: 13,\n flex: 1,\n },\n});\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst button = connect(mapStateToProps, {})(AddToCalendarButton);\nexport { button as AddToCalendarButton };\n"]}
@@ -1,5 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import { Text, View } from 'react-native';
3
+ import _ from 'lodash';
3
4
  import { connect } from 'react-redux';
4
5
  import { getMainBrandingColourFromState, TEXT_DARK } from '../colours';
5
6
  import { Spinner } from './Spinner';
@@ -19,29 +20,33 @@ class ConfirmPopup extends PureComponent {
19
20
  width: 350,
20
21
  marginBottom: 16
21
22
  }
22
- }, this.props.headerContent), /*#__PURE__*/React.createElement(Text, {
23
- style: styles.text
24
- }, this.props.text), this.props.extraContent && /*#__PURE__*/React.createElement(View, {
23
+ }, this.props.headerContent), !_.isEmpty(this.props.text) && /*#__PURE__*/React.createElement(Text, {
24
+ style: [styles.text, this.props.textAlignLeft && styles.textAlignLeft]
25
+ }, this.props.text), !_.isEmpty(this.props.subtext) && /*#__PURE__*/React.createElement(Text, {
26
+ style: [styles.subtext, this.props.textAlignLeft && styles.textAlignLeft]
27
+ }, this.props.subtext), this.props.extraContent && /*#__PURE__*/React.createElement(View, {
25
28
  style: {
26
29
  width: 350,
27
30
  marginTop: 16
28
31
  }
29
- }, this.props.extraContent), /*#__PURE__*/React.createElement(View, {
30
- style: styles.buttonsContainer
31
- }, this.props.buttonsLoading && /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Spinner, null)), !this.props.hideNo && !this.props.buttonsLoading && /*#__PURE__*/React.createElement(InlineButton, {
32
+ }, this.props.extraContent), this.props.children, /*#__PURE__*/React.createElement(View, {
33
+ style: [styles.buttonsContainer, this.props.verticalButtons && styles.verticalButtons]
34
+ }, this.props.buttonsLoading && /*#__PURE__*/React.createElement(View, {
35
+ style: styles.loadingContainer
36
+ }, /*#__PURE__*/React.createElement(Spinner, null)), !this.props.hideNo && !this.props.buttonsLoading && /*#__PURE__*/React.createElement(InlineButton, {
32
37
  onPress: this.props.onCancel,
33
38
  color: "#fff",
34
- style: [styles.button, styles.noButton, {
39
+ style: [styles.button, styles.noButton, this.props.verticalButtons && styles.buttonVertical, {
35
40
  borderColor: this.props.colourBrandingMain
36
41
  }],
37
42
  textStyle: {
38
43
  color: this.props.colourBrandingMain
39
44
  },
40
45
  large: true
41
- }, this.props.noText || 'No'), !this.props.buttonsLoading && /*#__PURE__*/React.createElement(InlineButton, {
46
+ }, this.props.noText || 'No'), !this.props.hideYes && !this.props.buttonsLoading && /*#__PURE__*/React.createElement(InlineButton, {
42
47
  onPress: this.props.onConfirm,
43
48
  color: this.props.colourBrandingMain,
44
- style: styles.button,
49
+ style: [styles.button, this.props.verticalButtons && styles.buttonVertical],
45
50
  large: true
46
51
  }, this.props.yesText || 'Yes')));
47
52
  }
@@ -50,7 +55,7 @@ class ConfirmPopup extends PureComponent {
50
55
 
51
56
  const styles = {
52
57
  popup: {
53
- padding: 32,
58
+ padding: 24,
54
59
  margin: 16,
55
60
  maxWidth: 350
56
61
  },
@@ -60,10 +65,24 @@ const styles = {
60
65
  color: TEXT_DARK,
61
66
  textAlign: 'center'
62
67
  },
68
+ subtext: {
69
+ fontFamily: 'sf-regular',
70
+ fontSize: 17,
71
+ color: TEXT_DARK,
72
+ textAlign: 'center'
73
+ },
74
+ textAlignLeft: {
75
+ textAlign: 'left'
76
+ },
63
77
  buttonsContainer: {
64
78
  flexDirection: 'row',
65
79
  marginTop: 24
66
80
  },
81
+ loadingContainer: {
82
+ height: 40,
83
+ justifyContent: 'center',
84
+ alignItems: 'center'
85
+ },
67
86
  button: {
68
87
  width: 120,
69
88
  paddingHorizontal: 2
@@ -71,6 +90,15 @@ const styles = {
71
90
  noButton: {
72
91
  borderWidth: 1,
73
92
  marginRight: 16
93
+ },
94
+ buttonVertical: {
95
+ width: '100%',
96
+ marginTop: 16,
97
+ marginRight: 0,
98
+ paddingHorizontal: 8
99
+ },
100
+ verticalButtons: {
101
+ flexDirection: 'column-reverse'
74
102
  }
75
103
  };
76
104
 
@@ -1 +1 @@
1
- {"version":3,"sources":["ConfirmPopup.js"],"names":["React","PureComponent","Text","View","connect","getMainBrandingColourFromState","TEXT_DARK","Spinner","InlineButton","MiddlePopup","ConfirmPopup","render","props","visible","onClose","styles","popup","headerContent","paddingTop","width","marginBottom","text","extraContent","marginTop","buttonsContainer","buttonsLoading","hideNo","onCancel","button","noButton","borderColor","colourBrandingMain","color","noText","onConfirm","yesText","padding","margin","maxWidth","fontFamily","fontSize","textAlign","flexDirection","paddingHorizontal","borderWidth","marginRight","mapStateToProps","state","confirmPopup"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,SAASC,IAAT,EAAeC,IAAf,QAA2B,cAA3B;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,SAASC,8BAAT,EAAyCC,SAAzC,QAA0D,YAA1D;AACA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,WAAT,QAA4B,eAA5B;;AAEA,MAAMC,YAAN,SAA2BT,aAA3B,CAAyC;AACvCU,EAAAA,MAAM,GAAG;AACP,wBACE,oBAAC,WAAD;AACE,MAAA,OAAO,EAAE,KAAKC,KAAL,CAAWC,OADtB;AAEE,MAAA,OAAO,EAAE,KAAKD,KAAL,CAAWE,OAFtB;AAGE,MAAA,KAAK,EAAE,CAACC,MAAM,CAACC,KAAR,EAAe,KAAKJ,KAAL,CAAWK,aAAX,IAA4B;AAAEC,QAAAA,UAAU,EAAE;AAAd,OAA3C;AAHT,OAKG,KAAKN,KAAL,CAAWK,aAAX,iBAA4B,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAE;AAAEE,QAAAA,KAAK,EAAE,GAAT;AAAcC,QAAAA,YAAY,EAAE;AAA5B;AAAb,OAAgD,KAAKR,KAAL,CAAWK,aAA3D,CAL/B,eAME,oBAAC,IAAD;AAAM,M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CsC;;AAuCzC,MAAMpB,MAAM,GAAG;AACbC,EAAAA,KAAK,EAAE;AACLoB,IAAAA,OAAO,EAAE,EADJ;AAELC,IAAAA,MAAM,EAAE,EAFH;AAGLC,IAAAA,QAAQ,EAAE;AAHL,GADM;AAMbjB,EAAAA,IAAI,EAAE;AACJkB,IAAAA,UAAU,EAAE,SADR;AAEJC,IAAAA,QAAQ,EAAE,EAFN;AAGJR,IAAAA,KAAK,EAAE1B,SAHH;AAIJmC,IAAAA,SAAS,EAAE;AAJP,GANO;AAYbjB,EAAAA,gBAAgB,EAAE;AAChBkB,IAAAA,aAAa,EAAE,KADC;AAEhBnB,IAAAA,SAAS,EAAE;AAFK,GAZL;AAgBbK,EAAAA,MAAM,EAAE;AACNT,IAAAA,KAAK,EAAE,GADD;AAENwB,IAAAA,iBAAiB,EAAE;AAFb,GAhBK;AAoBbd,EAAAA,QAAQ,EAAE;AACRe,IAAAA,WAAW,EAAE,CADL;AAERC,IAAAA,WAAW,EAAE;AAFL;AApBG,CAAf;;AA0BA,MAAMC,eAAe,GAAGC,KAAK,IAAI;AAC/B,SAAO;AACLhB,IAAAA,kBAAkB,EAAE1B,8BAA8B,CAAC0C,KAAD;AAD7C,GAAP;AAGD,CAJD;;AAMA,MAAMC,YAAY,GAAG5C,OAAO,CAAC0C,eAAD,EAAkB,EAAlB,CAAP,CAA6BpC,YAA7B,CAArB;AACA,SAASsC,YAAY,IAAItC,YAAzB","sourcesContent":["import React, { PureComponent } from 'react';\nimport { Text, View } from 'react-native';\nimport { connect } from 'react-redux';\nimport { getMainBrandingColourFromState, TEXT_DARK } from '../colours';\nimport { Spinner } from './Spinner';\nimport { InlineButton } from './InlineButton';\nimport { MiddlePopup } from './MiddlePopup';\n\nclass ConfirmPopup extends PureComponent {\n render() {\n return (\n <MiddlePopup\n visible={this.props.visible}\n onClose={this.props.onClose}\n style={[styles.popup, this.props.headerContent && { paddingTop: 16 }]}\n >\n {this.props.headerContent && <View style={{ width: 350, marginBottom: 16 }}>{this.props.headerContent}</View>}\n <Text style={styles.text}>{this.props.text}</Text>\n {this.props.extraContent && <View style={{ width: 350, marginTop: 16 }}>{this.props.extraContent}</View>}\n <View style={styles.buttonsContainer}>\n {this.props.buttonsLoading && (\n <View>\n <Spinner />\n </View>\n )}\n {!this.props.hideNo && !this.props.buttonsLoading && (\n <InlineButton\n onPress={this.props.onCancel}\n color=\"#fff\"\n style={[styles.button, styles.noButton, { borderColor: this.props.colourBrandingMain }]}\n textStyle={{ color: this.props.colourBrandingMain }}\n large\n >\n {this.props.noText || 'No'}\n </InlineButton>\n )}\n {!this.props.buttonsLoading && (\n <InlineButton onPress={this.props.onConfirm} color={this.props.colourBrandingMain} style={styles.button} large>\n {this.props.yesText || 'Yes'}\n </InlineButton>\n )}\n </View>\n </MiddlePopup>\n );\n }\n}\n\nconst styles = {\n popup: {\n padding: 32,\n margin: 16,\n maxWidth: 350,\n },\n text: {\n fontFamily: 'sf-bold',\n fontSize: 20,\n color: TEXT_DARK,\n textAlign: 'center',\n },\n buttonsContainer: {\n flexDirection: 'row',\n marginTop: 24,\n },\n button: {\n width: 120,\n paddingHorizontal: 2,\n },\n noButton: {\n borderWidth: 1,\n marginRight: 16,\n },\n};\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst confirmPopup = connect(mapStateToProps, {})(ConfirmPopup);\nexport { confirmPopup as ConfirmPopup };\n"]}
1
+ {"version":3,"sources":["ConfirmPopup.js"],"names":["React","PureComponent","Text","View","_","connect","getMainBrandingColourFromState","TEXT_DARK","Spinner","InlineButton","MiddlePopup","ConfirmPopup","render","props","visible","onClose","styles","popup","headerContent","paddingTop","width","marginBottom","isEmpty","text","textAlignLeft","subtext","extraContent","marginTop","children","buttonsContainer","verticalButtons","buttonsLoading","loadingContainer","hideNo","onCancel","button","noButton","buttonVertical","borderColor","colourBrandingMain","color","noText","hideYes","onConfirm","yesText","padding","margin","maxWidth","fontFamily","fontSize","textAlign","flexDirection","height","justifyContent","alignItems","paddingHorizontal","borderWidth","marginRight","mapStateToProps","state","confirmPopup"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,SAASC,IAAT,EAAeC,IAAf,QAA2B,cAA3B;AACA,OAAOC,CAAP,MAAc,QAAd;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,SAASC,8BAAT,EAAyCC,SAAzC,QAA0D,YAA1D;AACA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,WAAT,QAA4B,eAA5B;;AAEA,MAAMC,YAAN,SAA2BV,aAA3B,CAAyC;AACvCW,EAAAA,MAAM,GAAG;AACP,wBACE,oBAAC,WAAD;AACE,MAAA,OAAO,EAAE,KAAKC,KAAL,CAAWC,OADtB;AAEE,MAAA,OAAO,EAAE,KAAKD,KAAL,CAAWE,OAFtB;AAGE,MAAA,KAAK,EAAE,CAACC,MAAM,CAACC,KAAR,EAAe,KAAKJ,KAAL,CAAWK,aAAX,IAA4B;AAAEC,QAAAA,UAAU,EAAE;AAAd,OAA3C;AAHT,OAKG,KAAKN,KAAL,CAAWK,aAAX,iBAA4B,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAE;AAAEE,QAAAA,KAAK,EAAE,GAAT;AAAcC,QAAAA,YAAY,EAAE;AAA5B;AAAb,OAAgD,KAAKR,KAAL,CAAWK,aAA3D,CAL/B,EAMG,CAACd,CAAC,CAACkB,OAAF,CAAU,KAAKT,KAAL,CAAWU,IAArB,CAAD,iBACC,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAE,CAACP,MAAM,CAACO,IAAR,EAAc,KAAKV,KAAL,CAAWW,aAAX,IAA4BR,MAAM,CAACQ,aAAjD;AAAb,OAA+E,KAAKX,KAAL,CAAWU,IAA1F,CAPJ,EASG,CAACnB,CAAC,CAACkB,OAAF,CAAU,KAAKT,KAAL,CAAWY,OAArB,CAAD,iBACC,oBAAC,IAAD;A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;AA8BbnB,EAAAA,MAAM,EAAE;AACNf,IAAAA,KAAK,EAAE,GADD;AAENmC,IAAAA,iBAAiB,EAAE;AAFb,GA9BK;AAkCbnB,EAAAA,QAAQ,EAAE;AACRoB,IAAAA,WAAW,EAAE,CADL;AAERC,IAAAA,WAAW,EAAE;AAFL,GAlCG;AAsCbpB,EAAAA,cAAc,EAAE;AACdjB,IAAAA,KAAK,EAAE,MADO;AAEdO,IAAAA,SAAS,EAAE,EAFG;AAGd8B,IAAAA,WAAW,EAAE,CAHC;AAIdF,IAAAA,iBAAiB,EAAE;AAJL,GAtCH;AA4CbzB,EAAAA,eAAe,EAAE;AACfqB,IAAAA,aAAa,EAAE;AADA;AA5CJ,CAAf;;AAiDA,MAAMO,eAAe,GAAGC,KAAK,IAAI;AAC/B,SAAO;AACLpB,IAAAA,kBAAkB,EAAEjC,8BAA8B,CAACqD,KAAD;AAD7C,GAAP;AAGD,CAJD;;AAMA,MAAMC,YAAY,GAAGvD,OAAO,CAACqD,eAAD,EAAkB,EAAlB,CAAP,CAA6B/C,YAA7B,CAArB;AACA,SAASiD,YAAY,IAAIjD,YAAzB","sourcesContent":["import React, { PureComponent } from 'react';\nimport { Text, View } from 'react-native';\nimport _ from 'lodash';\nimport { connect } from 'react-redux';\nimport { getMainBrandingColourFromState, TEXT_DARK } from '../colours';\nimport { Spinner } from './Spinner';\nimport { InlineButton } from './InlineButton';\nimport { MiddlePopup } from './MiddlePopup';\n\nclass ConfirmPopup extends PureComponent {\n render() {\n return (\n <MiddlePopup\n visible={this.props.visible}\n onClose={this.props.onClose}\n style={[styles.popup, this.props.headerContent && { paddingTop: 16 }]}\n >\n {this.props.headerContent && <View style={{ width: 350, marginBottom: 16 }}>{this.props.headerContent}</View>}\n {!_.isEmpty(this.props.text) && (\n <Text style={[styles.text, this.props.textAlignLeft && styles.textAlignLeft]}>{this.props.text}</Text>\n )}\n {!_.isEmpty(this.props.subtext) && (\n <Text style={[styles.subtext, this.props.textAlignLeft && styles.textAlignLeft]}>{this.props.subtext}</Text>\n )}\n {this.props.extraContent && <View style={{ width: 350, marginTop: 16 }}>{this.props.extraContent}</View>}\n {this.props.children}\n <View style={[styles.buttonsContainer, this.props.verticalButtons && styles.verticalButtons]}>\n {this.props.buttonsLoading && (\n <View style={styles.loadingContainer}>\n <Spinner />\n </View>\n )}\n {!this.props.hideNo && !this.props.buttonsLoading && (\n <InlineButton\n onPress={this.props.onCancel}\n color=\"#fff\"\n style={[\n styles.button,\n styles.noButton,\n this.props.verticalButtons && styles.buttonVertical,\n { borderColor: this.props.colourBrandingMain },\n ]}\n textStyle={{ color: this.props.colourBrandingMain }}\n large\n >\n {this.props.noText || 'No'}\n </InlineButton>\n )}\n {!this.props.hideYes && !this.props.buttonsLoading && (\n <InlineButton\n onPress={this.props.onConfirm}\n color={this.props.colourBrandingMain}\n style={[styles.button, this.props.verticalButtons && styles.buttonVertical]}\n large\n >\n {this.props.yesText || 'Yes'}\n </InlineButton>\n )}\n </View>\n </MiddlePopup>\n );\n }\n}\n\nconst styles = {\n popup: {\n padding: 24,\n margin: 16,\n maxWidth: 350,\n },\n text: {\n fontFamily: 'sf-bold',\n fontSize: 20,\n color: TEXT_DARK,\n textAlign: 'center',\n },\n subtext: {\n fontFamily: 'sf-regular',\n fontSize: 17,\n color: TEXT_DARK,\n textAlign: 'center',\n },\n textAlignLeft: {\n textAlign: 'left',\n },\n buttonsContainer: {\n flexDirection: 'row',\n marginTop: 24,\n },\n loadingContainer: {\n height: 40,\n justifyContent: 'center',\n alignItems: 'center',\n },\n button: {\n width: 120,\n paddingHorizontal: 2,\n },\n noButton: {\n borderWidth: 1,\n marginRight: 16,\n },\n buttonVertical: {\n width: '100%',\n marginTop: 16,\n marginRight: 0,\n paddingHorizontal: 8,\n },\n verticalButtons: {\n flexDirection: 'column-reverse',\n },\n};\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst confirmPopup = connect(mapStateToProps, {})(ConfirmPopup);\nexport { confirmPopup as ConfirmPopup };\n"]}
@@ -1,10 +1,17 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import { Text, View, ScrollView, StyleSheet } from 'react-native';
3
+ import _ from 'lodash';
3
4
  import { TEXT_BLUEGREY } from '../colours';
4
5
 
5
6
  class EmptyStateMain extends PureComponent {
6
- renderPlaceHolder() {
7
- let opacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
7
+ renderPlaceHolder(index) {
8
+ let opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
9
+ const barCount = _.isUndefined(this.props.barCount) ? 3 : this.props.barCount;
10
+
11
+ if (barCount <= index) {
12
+ return null;
13
+ }
14
+
8
15
  return /*#__PURE__*/React.createElement(View, {
9
16
  style: [styles.item, {
10
17
  opacity
@@ -15,11 +22,11 @@ class EmptyStateMain extends PureComponent {
15
22
  render() {
16
23
  return /*#__PURE__*/React.createElement(View, {
17
24
  style: [styles.container, this.props.style]
18
- }, /*#__PURE__*/React.createElement(Text, {
25
+ }, !this.props.hideTitle && /*#__PURE__*/React.createElement(Text, {
19
26
  style: styles.titleText
20
- }, this.props.title || 'Nothing to see here'), /*#__PURE__*/React.createElement(ScrollView, {
27
+ }, this.props.title || 'Nothing to see here'), this.props.content, /*#__PURE__*/React.createElement(ScrollView, {
21
28
  style: styles.itemContainer
22
- }, this.renderPlaceHolder(0.8), this.renderPlaceHolder(0.6), this.renderPlaceHolder(0.4)));
29
+ }, this.renderPlaceHolder(0, 0.8), this.renderPlaceHolder(1, 0.6), this.renderPlaceHolder(2, 0.4)));
23
30
  }
24
31
 
25
32
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["EmptyStateMain.js"],"names":["React","PureComponent","Text","View","ScrollView","StyleSheet","TEXT_BLUEGREY","EmptyStateMain","renderPlaceHolder","opacity","styles","item","render","container","props","style","titleText","title","itemContainer","create","borderRadius","paddingVertical","fontFamily","fontSize","color","marginTop","flexDirection","width","height","backgroundColor","marginBottom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AVgB;AAc/Bf,EAAAA,IAAI,EAAE;AACJS,IAAAA,YAAY,EAAE,CADV;AAEJO,IAAAA,KAAK,EAAE,MAFH;AAGJC,IAAAA,MAAM,EAAE,EAHJ;AAIJC,IAAAA,eAAe,EAAE,SAJb;AAKJC,IAAAA,YAAY,EAAE;AALV;AAdyB,CAAlB,CAAf;AAuBA,eAAevB,cAAf","sourcesContent":["import React, { PureComponent } from 'react';\nimport { Text, View, ScrollView, StyleSheet } from 'react-native';\nimport { TEXT_BLUEGREY } from '../colours';\n\nclass EmptyStateMain extends PureComponent {\n renderPlaceHolder(opacity = 1) {\n return <View style={[styles.item, { opacity }]} />;\n }\n\n render() {\n return (\n <View style={[styles.container, this.props.style]}>\n <Text style={styles.titleText}>{this.props.title || 'Nothing to see here'}</Text>\n <ScrollView style={styles.itemContainer}>\n {this.renderPlaceHolder(0.8)}\n {this.renderPlaceHolder(0.6)}\n {this.renderPlaceHolder(0.4)}\n </ScrollView>\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n borderRadius: 5,\n paddingVertical: 5,\n },\n titleText: {\n fontFamily: 'qs-bold',\n fontSize: 16,\n color: TEXT_BLUEGREY,\n },\n itemContainer: {\n marginTop: 20,\n flexDirection: 'column',\n },\n item: {\n borderRadius: 4,\n width: '100%',\n height: 32,\n backgroundColor: '#e6ebef',\n marginBottom: 17,\n },\n});\n\nexport default EmptyStateMain;\n"]}
1
+ {"version":3,"sources":["EmptyStateMain.js"],"names":["React","PureComponent","Text","View","ScrollView","StyleSheet","_","TEXT_BLUEGREY","EmptyStateMain","renderPlaceHolder","index","opacity","barCount","isUndefined","props","styles","item","render","container","style","hideTitle","titleText","title","content","itemContainer","create","borderRadius","paddingVertical","fontFamily","fontSize","color","marginTop","flexDirection","width","height","backgroundColor","marginBottom"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,UAArB,EAAiCC,UAA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e,EAAE;AAFR,GADoB;AAK/BN,EAAAA,SAAS,EAAE;AACTO,IAAAA,UAAU,EAAE,SADH;AAETC,IAAAA,QAAQ,EAAE,EAFD;AAGTC,IAAAA,KAAK,EAAEvB;AAHE,GALoB;AAU/BiB,EAAAA,aAAa,EAAE;AACbO,IAAAA,SAAS,EAAE,EADE;AAEbC,IAAAA,aAAa,EAAE;AAFF,GAVgB;AAc/BhB,EAAAA,IAAI,EAAE;AACJU,IAAAA,YAAY,EAAE,CADV;AAEJO,IAAAA,KAAK,EAAE,MAFH;AAGJC,IAAAA,MAAM,EAAE,EAHJ;AAIJC,IAAAA,eAAe,EAAE,SAJb;AAKJC,IAAAA,YAAY,EAAE;AALV;AAdyB,CAAlB,CAAf;AAuBA,eAAe5B,cAAf","sourcesContent":["import React, { PureComponent } from 'react';\nimport { Text, View, ScrollView, StyleSheet } from 'react-native';\nimport _ from 'lodash';\nimport { TEXT_BLUEGREY } from '../colours';\n\nclass EmptyStateMain extends PureComponent {\n renderPlaceHolder(index, opacity = 1) {\n const barCount = _.isUndefined(this.props.barCount) ? 3 : this.props.barCount;\n if (barCount <= index) {\n return null;\n }\n return <View style={[styles.item, { opacity }]} />;\n }\n\n render() {\n return (\n <View style={[styles.container, this.props.style]}>\n {!this.props.hideTitle && <Text style={styles.titleText}>{this.props.title || 'Nothing to see here'}</Text>}\n {this.props.content}\n <ScrollView style={styles.itemContainer}>\n {this.renderPlaceHolder(0, 0.8)}\n {this.renderPlaceHolder(1, 0.6)}\n {this.renderPlaceHolder(2, 0.4)}\n </ScrollView>\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n borderRadius: 5,\n paddingVertical: 5,\n },\n titleText: {\n fontFamily: 'qs-bold',\n fontSize: 16,\n color: TEXT_BLUEGREY,\n },\n itemContainer: {\n marginTop: 20,\n flexDirection: 'column',\n },\n item: {\n borderRadius: 4,\n width: '100%',\n height: 32,\n backgroundColor: '#e6ebef',\n marginBottom: 17,\n },\n});\n\nexport default EmptyStateMain;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-core-app",
3
- "version": "1.5.6-beta.0",
3
+ "version": "1.5.8-beta.0",
4
4
  "description": "Core extension package for Pluss Communities platform",
5
5
  "main": "dist/module/index.js",
6
6
  "module": "dist/module/index.js",
@@ -1,6 +1,7 @@
1
1
  import React, { Component } from 'react';
2
- import { Platform, Linking, StyleSheet, Text, View, TouchableOpacity } from 'react-native';
2
+ import { Platform, Linking, StyleSheet, Text, View, TouchableOpacity, ScrollView } from 'react-native';
3
3
  import { connect } from 'react-redux';
4
+ import _ from 'lodash';
4
5
  import * as Calendar from 'expo-calendar';
5
6
  import { TEXT_DARK, getMainBrandingColourFromState } from '../colours';
6
7
  import { InlineButton } from './InlineButton';
@@ -50,7 +51,19 @@ class AddToCalendarButton extends Component {
50
51
  let calendars = await Calendar.getCalendarsAsync(Calendar.EntityTypes.EVENT);
51
52
  // console.log('all calendars', calendars);
52
53
  if (calendars && calendars.length > 0) {
53
- calendars = calendars.filter(c => c.allowsModifications);
54
+ calendars = calendars
55
+ .filter(c => c.allowsModifications)
56
+ .map(c => {
57
+ return {
58
+ id: c.id,
59
+ title: c.title,
60
+ source: c.source.name,
61
+ color: c.color,
62
+ type: c.type,
63
+ };
64
+ });
65
+ calendars = _.orderBy(calendars, ['source', 'title']);
66
+ // console.log('sorted calendars', calendars);
54
67
  }
55
68
  this.setState({ calendars });
56
69
  }
@@ -103,18 +116,20 @@ class AddToCalendarButton extends Component {
103
116
 
104
117
  renderCalendars(calendars) {
105
118
  return (
106
- <MiddlePopup style={[styles.calendarsPopup, { height: calendars.length * 50 + 100 }]} onClose={this.onCloseCalendars}>
119
+ <MiddlePopup style={[styles.calendarsPopup, { height: calendars.length * 60 + 120 }]} onClose={this.onCloseCalendars}>
107
120
  <Text style={styles.calendarPopupTitle}>Select Calendar</Text>
108
121
  <View style={styles.calendarPopupContainer}>
109
- {calendars.map(cal => {
110
- return (
111
- <TouchableOpacity key={cal.id} onPress={() => this.onSelectCalendar(cal)}>
112
- <View style={[styles.calendarContainer, { backgroundColor: cal.color }]}>
113
- <Text style={styles.calendarText}>{cal.title}</Text>
114
- </View>
115
- </TouchableOpacity>
116
- );
117
- })}
122
+ <ScrollView style={{ flex: 1 }} showsVerticalScrollIndicator={false}>
123
+ {calendars.map(cal => {
124
+ return (
125
+ <TouchableOpacity key={cal.id} onPress={() => this.onSelectCalendar(cal)}>
126
+ <View style={[styles.calendarContainer, { backgroundColor: cal.color }]}>
127
+ <Text style={styles.calendarText}>{`${cal.source}${cal.source === cal.title ? '' : `\n${cal.title}`}`}</Text>
128
+ </View>
129
+ </TouchableOpacity>
130
+ );
131
+ })}
132
+ </ScrollView>
118
133
  <TouchableOpacity key={'cancel'} onPress={this.onCloseCalendars}>
119
134
  <View style={[styles.calendarContainer, { marginTop: 20, backgroundColor: this.props.colourBrandingMain }]}>
120
135
  <Text style={styles.calendarText}>Cancel</Text>
@@ -158,6 +173,7 @@ class AddToCalendarButton extends Component {
158
173
  const styles = StyleSheet.create({
159
174
  calendarsPopup: {
160
175
  width: 250,
176
+ maxHeight: 400,
161
177
  padding: 16,
162
178
  borderRadius: 12,
163
179
  },
@@ -174,11 +190,11 @@ const styles = StyleSheet.create({
174
190
  calendarContainer: {
175
191
  flexDirection: 'row',
176
192
  alignItems: 'center',
177
- justifyContent: 'space-between',
178
193
  width: 200,
179
- height: 30,
194
+ height: 40,
180
195
  paddingHorizontal: 8,
181
196
  borderRadius: 4,
197
+ marginBottom: 10,
182
198
  },
183
199
  calendarText: {
184
200
  color: '#fff',
@@ -1,5 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import { Text, View } from 'react-native';
3
+ import _ from 'lodash';
3
4
  import { connect } from 'react-redux';
4
5
  import { getMainBrandingColourFromState, TEXT_DARK } from '../colours';
5
6
  import { Spinner } from './Spinner';
@@ -15,11 +16,17 @@ class ConfirmPopup extends PureComponent {
15
16
  style={[styles.popup, this.props.headerContent && { paddingTop: 16 }]}
16
17
  >
17
18
  {this.props.headerContent && <View style={{ width: 350, marginBottom: 16 }}>{this.props.headerContent}</View>}
18
- <Text style={styles.text}>{this.props.text}</Text>
19
+ {!_.isEmpty(this.props.text) && (
20
+ <Text style={[styles.text, this.props.textAlignLeft && styles.textAlignLeft]}>{this.props.text}</Text>
21
+ )}
22
+ {!_.isEmpty(this.props.subtext) && (
23
+ <Text style={[styles.subtext, this.props.textAlignLeft && styles.textAlignLeft]}>{this.props.subtext}</Text>
24
+ )}
19
25
  {this.props.extraContent && <View style={{ width: 350, marginTop: 16 }}>{this.props.extraContent}</View>}
20
- <View style={styles.buttonsContainer}>
26
+ {this.props.children}
27
+ <View style={[styles.buttonsContainer, this.props.verticalButtons && styles.verticalButtons]}>
21
28
  {this.props.buttonsLoading && (
22
- <View>
29
+ <View style={styles.loadingContainer}>
23
30
  <Spinner />
24
31
  </View>
25
32
  )}
@@ -27,15 +34,25 @@ class ConfirmPopup extends PureComponent {
27
34
  <InlineButton
28
35
  onPress={this.props.onCancel}
29
36
  color="#fff"
30
- style={[styles.button, styles.noButton, { borderColor: this.props.colourBrandingMain }]}
37
+ style={[
38
+ styles.button,
39
+ styles.noButton,
40
+ this.props.verticalButtons && styles.buttonVertical,
41
+ { borderColor: this.props.colourBrandingMain },
42
+ ]}
31
43
  textStyle={{ color: this.props.colourBrandingMain }}
32
44
  large
33
45
  >
34
46
  {this.props.noText || 'No'}
35
47
  </InlineButton>
36
48
  )}
37
- {!this.props.buttonsLoading && (
38
- <InlineButton onPress={this.props.onConfirm} color={this.props.colourBrandingMain} style={styles.button} large>
49
+ {!this.props.hideYes && !this.props.buttonsLoading && (
50
+ <InlineButton
51
+ onPress={this.props.onConfirm}
52
+ color={this.props.colourBrandingMain}
53
+ style={[styles.button, this.props.verticalButtons && styles.buttonVertical]}
54
+ large
55
+ >
39
56
  {this.props.yesText || 'Yes'}
40
57
  </InlineButton>
41
58
  )}
@@ -47,7 +64,7 @@ class ConfirmPopup extends PureComponent {
47
64
 
48
65
  const styles = {
49
66
  popup: {
50
- padding: 32,
67
+ padding: 24,
51
68
  margin: 16,
52
69
  maxWidth: 350,
53
70
  },
@@ -57,10 +74,24 @@ const styles = {
57
74
  color: TEXT_DARK,
58
75
  textAlign: 'center',
59
76
  },
77
+ subtext: {
78
+ fontFamily: 'sf-regular',
79
+ fontSize: 17,
80
+ color: TEXT_DARK,
81
+ textAlign: 'center',
82
+ },
83
+ textAlignLeft: {
84
+ textAlign: 'left',
85
+ },
60
86
  buttonsContainer: {
61
87
  flexDirection: 'row',
62
88
  marginTop: 24,
63
89
  },
90
+ loadingContainer: {
91
+ height: 40,
92
+ justifyContent: 'center',
93
+ alignItems: 'center',
94
+ },
64
95
  button: {
65
96
  width: 120,
66
97
  paddingHorizontal: 2,
@@ -69,6 +100,15 @@ const styles = {
69
100
  borderWidth: 1,
70
101
  marginRight: 16,
71
102
  },
103
+ buttonVertical: {
104
+ width: '100%',
105
+ marginTop: 16,
106
+ marginRight: 0,
107
+ paddingHorizontal: 8,
108
+ },
109
+ verticalButtons: {
110
+ flexDirection: 'column-reverse',
111
+ },
72
112
  };
73
113
 
74
114
  const mapStateToProps = state => {
@@ -1,20 +1,26 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import { Text, View, ScrollView, StyleSheet } from 'react-native';
3
+ import _ from 'lodash';
3
4
  import { TEXT_BLUEGREY } from '../colours';
4
5
 
5
6
  class EmptyStateMain extends PureComponent {
6
- renderPlaceHolder(opacity = 1) {
7
+ renderPlaceHolder(index, opacity = 1) {
8
+ const barCount = _.isUndefined(this.props.barCount) ? 3 : this.props.barCount;
9
+ if (barCount <= index) {
10
+ return null;
11
+ }
7
12
  return <View style={[styles.item, { opacity }]} />;
8
13
  }
9
14
 
10
15
  render() {
11
16
  return (
12
17
  <View style={[styles.container, this.props.style]}>
13
- <Text style={styles.titleText}>{this.props.title || 'Nothing to see here'}</Text>
18
+ {!this.props.hideTitle && <Text style={styles.titleText}>{this.props.title || 'Nothing to see here'}</Text>}
19
+ {this.props.content}
14
20
  <ScrollView style={styles.itemContainer}>
15
- {this.renderPlaceHolder(0.8)}
16
- {this.renderPlaceHolder(0.6)}
17
- {this.renderPlaceHolder(0.4)}
21
+ {this.renderPlaceHolder(0, 0.8)}
22
+ {this.renderPlaceHolder(1, 0.6)}
23
+ {this.renderPlaceHolder(2, 0.4)}
18
24
  </ScrollView>
19
25
  </View>
20
26
  );