@plusscommunities/pluss-core-web 1.7.3-beta.1 → 1.7.4-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.
Files changed (116) hide show
  1. package/dist/components.js +37233 -474
  2. package/dist/components.js.map +1 -1
  3. package/dist/index.js +37233 -474
  4. package/dist/index.js.map +1 -1
  5. package/package.json +22 -31
  6. package/.babelrc +0 -3
  7. package/dist/index.cjs.js +0 -10388
  8. package/dist/index.esm.js +0 -10349
  9. package/dist/index.umd.js +0 -10361
  10. package/rollup.config.js +0 -57
  11. package/src/actions/AuthActions.js +0 -83
  12. package/src/actions/LocalActions.js +0 -8
  13. package/src/actions/NavActions.js +0 -8
  14. package/src/actions/ScheduledActionsActions.js +0 -8
  15. package/src/actions/TemplateActions.js +0 -15
  16. package/src/actions/UsersActions.js +0 -95
  17. package/src/actions/index.js +0 -6
  18. package/src/actions/types.js +0 -23
  19. package/src/analytics.js +0 -183
  20. package/src/apis/analyticsActions.js +0 -53
  21. package/src/apis/authActions.js +0 -58
  22. package/src/apis/fileActions.js +0 -152
  23. package/src/apis/index.js +0 -10
  24. package/src/apis/profileActions.js +0 -133
  25. package/src/apis/scheduledActionsActions.js +0 -12
  26. package/src/apis/stringActions.js +0 -25
  27. package/src/apis/templateActions.js +0 -41
  28. package/src/apis/typeActions.js +0 -186
  29. package/src/apis/userActions.js +0 -169
  30. package/src/apis/utilityActions.js +0 -35
  31. package/src/colours.js +0 -134
  32. package/src/components/AddButton.js +0 -27
  33. package/src/components/AnalyticsFilter.js +0 -115
  34. package/src/components/Attachment.js +0 -27
  35. package/src/components/AudienceIncluder.js +0 -175
  36. package/src/components/AudienceSelector.js +0 -700
  37. package/src/components/Button.js +0 -66
  38. package/src/components/CheckBox.js +0 -77
  39. package/src/components/ColourOptions.js +0 -197
  40. package/src/components/ColourPicker.js +0 -267
  41. package/src/components/Comment.js +0 -46
  42. package/src/components/CommentSection.js +0 -116
  43. package/src/components/DatePicker.js +0 -290
  44. package/src/components/DropdownInput.js +0 -223
  45. package/src/components/DurationInput.js +0 -51
  46. package/src/components/ExportCsvPopup.js +0 -222
  47. package/src/components/FileInput.js +0 -389
  48. package/src/components/GenericInput.js +0 -169
  49. package/src/components/Header.js +0 -82
  50. package/src/components/HubSidebar.js +0 -134
  51. package/src/components/ImageInput.js +0 -987
  52. package/src/components/InputGroup.js +0 -18
  53. package/src/components/MakerPopup.js +0 -310
  54. package/src/components/MoreMenu.js +0 -22
  55. package/src/components/OptionsSection.js +0 -84
  56. package/src/components/OverlayPage.js +0 -74
  57. package/src/components/OverlayPageBottomButtons.js +0 -48
  58. package/src/components/OverlayPageContents.js +0 -48
  59. package/src/components/OverlayPageSection.js +0 -38
  60. package/src/components/P60Icon.js +0 -40
  61. package/src/components/PageTitle.js +0 -13
  62. package/src/components/Popup.js +0 -104
  63. package/src/components/ProfilePic.js +0 -50
  64. package/src/components/RadioButton.js +0 -144
  65. package/src/components/Reactions.js +0 -77
  66. package/src/components/SVGIcon.js +0 -33
  67. package/src/components/SideNavItem.js +0 -98
  68. package/src/components/StatBox.js +0 -49
  69. package/src/components/StatusButton.js +0 -22
  70. package/src/components/SuccessPopup.js +0 -57
  71. package/src/components/Tabs.js +0 -56
  72. package/src/components/Tag.js +0 -62
  73. package/src/components/Text.js +0 -20
  74. package/src/components/TextFormatPopup.js +0 -54
  75. package/src/components/TimePicker.js +0 -225
  76. package/src/components/UserListing.js +0 -111
  77. package/src/components/index.js +0 -46
  78. package/src/components/svg-icons.json +0 -821
  79. package/src/config.js +0 -25
  80. package/src/helper/HelpDeskWidget.js +0 -16
  81. package/src/helper/api/getUrl.js +0 -15
  82. package/src/helper/api/getUrlParams.js +0 -9
  83. package/src/helper/api/safeReadParams.js +0 -6
  84. package/src/helper/auth/getUserFromState.js +0 -8
  85. package/src/helper/colours/getAppColourFromState.js +0 -10
  86. package/src/helper/files/canvasImageUploader.js +0 -159
  87. package/src/helper/files/generateImageName.js +0 -10
  88. package/src/helper/files/get1400.js +0 -32
  89. package/src/helper/files/getExtension.js +0 -9
  90. package/src/helper/files/getFileName.js +0 -13
  91. package/src/helper/files/getThumb300.js +0 -36
  92. package/src/helper/files/isVideo.js +0 -8
  93. package/src/helper/helper.js +0 -97
  94. package/src/helper/index.js +0 -44
  95. package/src/helper/site/getMerchantsFromState.js +0 -9
  96. package/src/helper/site/getSiteLevelFromState.js +0 -34
  97. package/src/helper/site/getSiteName.js +0 -16
  98. package/src/helper/site/getSiteNameFromRoles.js +0 -12
  99. package/src/helper/site/getSiteSettingFromState.js +0 -10
  100. package/src/helper/storage/readJSONFromStorage.js +0 -9
  101. package/src/helper/storage/readStorageWithCookie.js +0 -22
  102. package/src/helper/storage/setLocalStorage.js +0 -5
  103. package/src/helper/strings/getFirstName.js +0 -10
  104. package/src/helper/strings/htmlDecode.js +0 -4
  105. package/src/helper/strings/htmlEncode.js +0 -4
  106. package/src/helper/strings/isEmail.js +0 -11
  107. package/src/helper/strings/isUrl.js +0 -13
  108. package/src/helper/strings/onlyAlphanumeric.js +0 -8
  109. package/src/helper/strings/randomString.js +0 -10
  110. package/src/helper/strings/toParagraphed.js +0 -17
  111. package/src/index.js +0 -12
  112. package/src/reducers/ScheduledActionsReducer.js +0 -14
  113. package/src/reducers/TemplatesReducer.js +0 -29
  114. package/src/reducers/index.js +0 -7
  115. package/src/session.js +0 -289
  116. package/src/urls.js +0 -21
@@ -1,169 +0,0 @@
1
- import _ from 'lodash';
2
- import { authedFunction } from '../session';
3
- import { getUrl } from '../helper';
4
-
5
- export const userActions = {
6
- createNewUser: (user, userExtra) => {
7
- return authedFunction({
8
- method: 'POST',
9
- url: getUrl('users', 'add'),
10
- data: {
11
- user,
12
- userExtra,
13
- },
14
- });
15
- },
16
- bulkNewUser: (users, site, sendWelcome) => {
17
- return authedFunction({
18
- method: 'POST',
19
- url: getUrl('users', 'addbulk'),
20
- data: {
21
- site,
22
- users,
23
- sendWelcome,
24
- },
25
- });
26
- },
27
- getbulks: (site) => {
28
- return authedFunction({
29
- method: 'POST',
30
- url: getUrl('users', 'getbulks'),
31
- data: {
32
- site,
33
- },
34
- });
35
- },
36
- fetchUsers: (site) => {
37
- return authedFunction({
38
- method: 'POST',
39
- url: getUrl('users', 'get'),
40
- data: {
41
- site,
42
- },
43
- });
44
- },
45
- fetchInitialPasswords: (site) => {
46
- return authedFunction({
47
- method: 'GET',
48
- url: getUrl('users', 'initialpasswords', { site }),
49
- });
50
- },
51
- fetchUser: (site, userId) => {
52
- return authedFunction({
53
- method: 'POST',
54
- url: getUrl('users', 'getsingle'),
55
- data: {
56
- site,
57
- userId,
58
- },
59
- });
60
- },
61
- updateUser: (site, userId, user) => {
62
- return authedFunction({
63
- method: 'POST',
64
- url: getUrl('users', 'manageUser'),
65
- data: {
66
- site,
67
- userId,
68
- user,
69
- },
70
- });
71
- },
72
- getSiteResidentsCount: (site) => {
73
- return authedFunction({
74
- method: 'POST',
75
- url: getUrl('users', 'getexp'),
76
- data: { site, isCount: true },
77
- });
78
- },
79
- sendWelcomeEmail: (site, userId) => {
80
- return authedFunction({
81
- method: 'POST',
82
- url: getUrl('users', 'welcome/email'),
83
- data: { site, userId },
84
- });
85
- },
86
- sendWelcomeText: (site, userId) => {
87
- return authedFunction({
88
- method: 'POST',
89
- url: getUrl('users', 'welcome/text'),
90
- data: { site, userId },
91
- });
92
- },
93
- getInviteCode: (userId, type, site) => {
94
- const query = {};
95
- if (!_.isEmpty(userId)) {
96
- query.userId = userId;
97
- }
98
- if (!_.isEmpty(type)) {
99
- query.type = type;
100
- }
101
- if (!_.isEmpty(site)) {
102
- query.site = site;
103
- }
104
- return authedFunction({
105
- method: 'GET',
106
- url: getUrl('users', 'invite/get', query),
107
- });
108
- },
109
- generateInviteCode: (userId, type, site) => {
110
- const data = {};
111
- if (!_.isEmpty(userId)) {
112
- data.userId = userId;
113
- }
114
- if (!_.isEmpty(type)) {
115
- data.type = type;
116
- }
117
- if (!_.isEmpty(site)) {
118
- data.site = site;
119
- }
120
- return authedFunction({
121
- method: 'POST',
122
- url: getUrl('users', 'invite/generate'),
123
- data,
124
- });
125
- },
126
- createInviteCode: (userId, site, userType, expiry) => {
127
- return authedFunction({
128
- method: 'POST',
129
- url: getUrl('users', 'invite/update/add'),
130
- data: { userId, site, userType, expiry },
131
- });
132
- },
133
- editInviteCode: (code, userType, expiry) => {
134
- return authedFunction({
135
- method: 'POST',
136
- url: getUrl('users', 'invite/update/edit'),
137
- data: { code, userType, expiry },
138
- });
139
- },
140
- deleteInviteCode: (code) => {
141
- return authedFunction({
142
- method: 'POST',
143
- url: getUrl('users', 'invite/update/delete'),
144
- data: { code },
145
- });
146
- },
147
- getInviteCodes: (site, excludeFamily = false) => {
148
- const action = excludeFamily ? 'excludeFamily' : 'all';
149
- return authedFunction({
150
- method: 'GET',
151
- url: getUrl('users', `invite/get/${action}`, { site }),
152
- });
153
- },
154
- getInviteCodeByCode: (code) => {
155
- return authedFunction({
156
- method: 'GET',
157
- url: getUrl('users', 'invite/get/code', { code }),
158
- });
159
- },
160
- updateProfile: (input) => {
161
- return authedFunction({
162
- method: 'POST',
163
- url: getUrl('users', 'updateProfile'),
164
- data: {
165
- details: input,
166
- },
167
- });
168
- },
169
- };
@@ -1,35 +0,0 @@
1
- import Config from '../config';
2
- import { authedFunction, unauthedFunction } from '../session';
3
- import { getUrl } from '../helper';
4
-
5
- export const utilityActions = {
6
- getUpvotyToken: () => {
7
- return authedFunction({
8
- method: 'GET',
9
- url: getUrl('utility', 'upvoty/usertoken'),
10
- });
11
- },
12
- getBoardHash: () => {
13
- return authedFunction({
14
- method: 'GET',
15
- url: getUrl('utility', 'upvoty/boardhash'),
16
- });
17
- },
18
- getRoadmapHash: () => {
19
- return authedFunction({
20
- method: 'GET',
21
- url: getUrl('utility', 'upvoty/roadmap'),
22
- });
23
- },
24
- generateMake: (templateId, data) => {
25
- return unauthedFunction({
26
- method: 'POST',
27
- url: `https://api.make.cm/make/t/${templateId}/sync`,
28
- data,
29
- headers: {
30
- 'Content-Type': 'application/json',
31
- 'X-MAKE-API-KEY': Config.env.makeApiKey,
32
- },
33
- });
34
- },
35
- };
package/src/colours.js DELETED
@@ -1,134 +0,0 @@
1
- // const COLOUR_1 = '#011d5c';
2
- // const COLOUR_2 = '#3179cb';
3
- // const COLOUR_3 = '#1bb7ee';
4
-
5
- const COLOUR_BRANDING_MAIN = '#4a57b7';
6
- // const COLOUR_BRANDING_DARK = '#364196';
7
- // const COLOUR_BRANDING_LIGHT = '#597db4';
8
- const COLOUR_BRANDING_OFF = '#597db4';
9
- const COLOUR_BRANDING_ACTION = '#5c90df';
10
- const COLOUR_BRANDING_INACTIVE = '#dbddf1';
11
-
12
- // const TEXT_DARKEST = '#262a2d';
13
- // const TEXT_DARK = '#262a2d';
14
- // const TEXT_DARK_ALPHA50 = 'rgba(60, 60, 80, .5)';
15
- // const TEXT_DARK_ALPHA20 = 'rgba(60, 60, 80, .2)';
16
- // const TEXT_DARK_ALPHA10 = 'rgba(60, 60, 80, .1)';
17
- // const TEXT_MID = '#5a5a6e';
18
- // const TEXT_MID_ALPHA50 = 'rgba(90, 90, 110, .5)';
19
- const TEXT_LIGHT = '#717b81';
20
- // const TEXT_SUPER_LIGHT = '#d2d9e5';
21
- const COLOUR_DUSK = '#536280';
22
- const COLOUR_DUSK_LIGHT = '#67758f';
23
- const COLOUR_DUSK_LIGHTER = '#a1afcc';
24
-
25
- const LINEGREY = COLOUR_BRANDING_INACTIVE;
26
- // const BORDER_LINE_GREY = COLOUR_BRANDING_INACTIVE;
27
-
28
- // const COLOUR_TEAL = '#49bdbb';
29
- // const COLOUR_TEAL_ALPHA50 = 'rgba(4, 196, 169, 0.2)';
30
- // const COLOUR_BLUE = '#5e9efc';
31
- // const COLOUR_BLUE_ALPHA10 = 'rgba(0, 131, 238, 0.1)';
32
- // const COLOUR_DARKBLUE = '#191e78';
33
- // const COLOUR_PURPLE = '#6e79c5';
34
- const COLOUR_RED = '#c02743';
35
- const COLOUR_GREEN = '#00cc9c';
36
- // const COLOUR_TANGERINE = '#ff8c75';
37
- // const COLOUR_CITRON = '#bdbd27';
38
- // const COLOUR_GRAPEFRUIT = '#ff6363';
39
- // const DARK_OVERLAY = 'rgba(19,19,26,.9)';
40
- // const FACEBOOK_BLUE = '#3B5998';
41
-
42
- // const COLOUR_NAV_GREY = '#f6f6f6';
43
- // const COLOUR_TRANSPARENT = 'rgba(0,0,0,0)';
44
- // const COLOUR_SIDEBAR = '#303030';
45
- const COLOUR_LIGHTGREY = '#8695b2';
46
-
47
- const INACTIVE_TEXT = COLOUR_LIGHTGREY;
48
-
49
- const COLOUR_BRANDING_APP = '#4a57b7';
50
-
51
- const hexToRGB = (hex) => {
52
- // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
53
- const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
54
- hex = hex.replace(shorthandRegex, (m, r, g, b) => {
55
- return r + r + g + g + b + b;
56
- });
57
-
58
- const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
59
- return result
60
- ? {
61
- r: parseInt(result[1], 16),
62
- g: parseInt(result[2], 16),
63
- b: parseInt(result[3], 16),
64
- }
65
- : null;
66
- };
67
-
68
- const hexToRGBAstring = (hex, opacity) => {
69
- // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
70
- const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
71
- hex = hex.replace(shorthandRegex, (m, r, g, b) => {
72
- return r + r + g + g + b + b;
73
- });
74
-
75
- const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
76
- return result ? `rgba(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}, ${opacity})` : null;
77
- };
78
-
79
- // const pctBtwnColours = (c1, c2, percentage) => {
80
- // const rgbC1 = hexToRGB(c1);
81
- // const rgbC2 = hexToRGB(c2);
82
- // const r = rgbC2.r + (rgbC1.r - rgbC2.r) * percentage;
83
- // const g = rgbC2.g + (rgbC1.g - rgbC2.g) * percentage;
84
- // const b = rgbC2.b + (rgbC1.b - rgbC2.b) * percentage;
85
- // return `rgb(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)})`;
86
- // };
87
-
88
- export {
89
- // COLOUR_1,
90
- // COLOUR_2,
91
- // COLOUR_3,
92
- // TEXT_DARKEST,
93
- // TEXT_DARK,
94
- // TEXT_DARK_ALPHA50,
95
- // TEXT_DARK_ALPHA20,
96
- // TEXT_DARK_ALPHA10,
97
- // TEXT_MID,
98
- // TEXT_MID_ALPHA50,
99
- TEXT_LIGHT,
100
- // TEXT_SUPER_LIGHT,
101
- COLOUR_DUSK,
102
- COLOUR_DUSK_LIGHT,
103
- COLOUR_DUSK_LIGHTER,
104
- LINEGREY,
105
- // BORDER_LINE_GREY,
106
- // COLOUR_TEAL,
107
- // COLOUR_TEAL_ALPHA50,
108
- // COLOUR_BLUE,
109
- // COLOUR_BLUE_ALPHA10,
110
- // COLOUR_DARKBLUE,
111
- // COLOUR_PURPLE,
112
- COLOUR_RED,
113
- // COLOUR_TANGERINE,
114
- // COLOUR_CITRON,
115
- // COLOUR_GRAPEFRUIT,
116
- // DARK_OVERLAY,
117
- hexToRGB,
118
- hexToRGBAstring,
119
- // pctBtwnColours,
120
- // FACEBOOK_BLUE,
121
- // COLOUR_NAV_GREY,
122
- // COLOUR_TRANSPARENT,
123
- // COLOUR_SIDEBAR,
124
- COLOUR_BRANDING_MAIN,
125
- COLOUR_BRANDING_OFF,
126
- // COLOUR_BRANDING_LIGHT,
127
- // COLOUR_BRANDING_DARK,
128
- COLOUR_BRANDING_ACTION,
129
- COLOUR_GREEN,
130
- INACTIVE_TEXT,
131
- COLOUR_LIGHTGREY,
132
- COLOUR_BRANDING_APP,
133
- COLOUR_BRANDING_INACTIVE,
134
- };
@@ -1,27 +0,0 @@
1
- import React, { Component } from 'react';
2
- import FontAwesome from 'react-fontawesome';
3
-
4
- class AddButton extends Component {
5
- getClasses() {
6
- let classes = 'addButton';
7
- if (this.props.inactive) {
8
- classes += ' addButton--inactive';
9
- }
10
- return classes;
11
- }
12
-
13
- renderIcon() {
14
- return <FontAwesome className="addButton__icon" name={this.props.icon || 'plus'} />;
15
- }
16
-
17
- render() {
18
- return (
19
- <div style={this.props.style} onClick={this.props.onClick} className={this.getClasses()}>
20
- <div className="addButton__text">{this.props.text}</div>
21
- <div className="addButton__right">{this.renderIcon()}</div>
22
- </div>
23
- );
24
- }
25
- }
26
-
27
- export { AddButton };
@@ -1,115 +0,0 @@
1
- import React, { PureComponent } from 'react';
2
- import { DropdownButton, DropdownItem } from 'react-bootstrap';
3
- import _ from 'lodash';
4
- import moment from 'moment';
5
- import { getAnalyticsFilterOptions } from '../analytics';
6
- import { GenericInput } from './GenericInput';
7
- import { DatePicker } from './DatePicker';
8
-
9
- class AnalyticsFilter extends PureComponent {
10
- constructor(props) {
11
- super(props);
12
- const filterOptions = getAnalyticsFilterOptions();
13
- const selectedFilter = this.props.defaultFilter || filterOptions[1];
14
-
15
- this.state = {
16
- filterOptions,
17
- selectedFilter,
18
- dateRangeText: 'Select date range',
19
- startDate: moment(this.props.defaultStart),
20
- endDate: moment(this.props.defaultEnd),
21
- calendarVisible: true,
22
- };
23
- }
24
-
25
- renderOptions = () => {
26
- return this.state.filterOptions.map((ev) => {
27
- if (this.props.hideOptions && _.includes(this.props.hideOptions, ev.dayCount)) {
28
- return null;
29
- }
30
- return (
31
- <DropdownItem key={ev.dayCount} eventKey={ev.dayCount} active={this.state.selectedFilter === ev}>
32
- {ev.text}
33
- </DropdownItem>
34
- );
35
- });
36
- };
37
-
38
- selectFilter = (key) => {
39
- const selectedFilter = _.find(this.state.filterOptions, (o) => {
40
- return o.dayCount === key;
41
- });
42
- this.setState(
43
- {
44
- selectedFilter,
45
- dateRangeText: 'Select date range',
46
- startDate: moment(),
47
- endDate: moment(),
48
- calendarVisible: true,
49
- },
50
- () => {
51
- this.props.filterChanged(selectedFilter);
52
- },
53
- );
54
- };
55
-
56
- getDateRangeText = (start, end) => {
57
- return `${moment(start).format('DD/MM/YYYY')} to ${moment(end).format('DD/MM/YYYY')}`;
58
- };
59
-
60
- toggleDateSelectors = () => {
61
- this.setState({ calendarVisible: !this.state.calendarVisible });
62
- };
63
-
64
- startDateChanged = (date) => {
65
- if (moment(date).isSameOrBefore(this.state.endDate)) {
66
- this.setState({ startDate: date, dateRangeText: this.getDateRangeText(date, this.state.endDate) }, () => {
67
- this.props.filterDateRangeChanged(this.state.startDate, this.state.endDate);
68
- });
69
- }
70
- };
71
-
72
- endDateChanged = (date) => {
73
- if (moment(date).isSameOrAfter(this.state.startDate)) {
74
- this.setState({ endDate: date, dateRangeText: this.getDateRangeText(this.state.startDate, date) }, () => {
75
- this.props.filterDateRangeChanged(this.state.startDate, this.state.endDate);
76
- });
77
- }
78
- };
79
-
80
- render() {
81
- return (
82
- <>
83
- <div className="analyticsFilter__dropDown">
84
- <DropdownButton
85
- id="secondLevelSort"
86
- bsSize="xsmall"
87
- className="siteSelector__button analyticsFilter__dropDown__button"
88
- title={this.state.selectedFilter.text}
89
- onSelect={this.selectFilter}
90
- >
91
- {this.renderOptions()}
92
- </DropdownButton>
93
- {this.state.selectedFilter.dayCount === 0 && (
94
- <GenericInput
95
- id="customDateRange"
96
- placeholder={'Select date range'}
97
- className="analyticsFilter__dropDown__input"
98
- value={this.state.dateRangeText}
99
- onClick={this.toggleDateSelectors}
100
- readOnly
101
- />
102
- )}
103
- </div>
104
- {this.state.selectedFilter.dayCount === 0 && this.state.calendarVisible && (
105
- <div className="analyticsFilter__dateRange">
106
- <DatePicker hideTop selectedDate={this.state.startDate} selectDate={this.startDateChanged} />
107
- <DatePicker hideTop selectedDate={this.state.endDate} selectDate={this.endDateChanged} />
108
- </div>
109
- )}
110
- </>
111
- );
112
- }
113
- }
114
-
115
- export { AnalyticsFilter };
@@ -1,27 +0,0 @@
1
- import React, { Component } from 'react';
2
- import FontAwesome from 'react-fontawesome';
3
- import { COLOUR_DUSK_LIGHT } from '../colours';
4
- import getFileName from '../helper/files/getFileName';
5
- import { SVGIcon } from './SVGIcon';
6
-
7
- class Attachment extends Component {
8
- render() {
9
- return (
10
- <div
11
- className={`pdfAttachment${this.props.className ? ` ${this.props.className}` : ''}${
12
- this.props.white ? ' pdfAttachment-white' : ''
13
- }`}
14
- >
15
- <a href={this.props.source} target="_blank" className="pdfAttachment_container">
16
- <FontAwesome className="pdfAttachment_icon" name={`${this.props.uploading ? 'spinner fa-pulse' : 'paperclip'} fa-fw`} />
17
- <p className="pdfAttachment_title">{this.props.title || getFileName(this.props.source)}</p>
18
- </a>
19
- {this.props.onRemove && (
20
- <SVGIcon colour={COLOUR_DUSK_LIGHT} icon="close" className="pdfAttachment_close" onClick={this.props.onRemove} />
21
- )}
22
- </div>
23
- );
24
- }
25
- }
26
-
27
- export { Attachment };
@@ -1,175 +0,0 @@
1
- import React, { Component } from 'react';
2
- import _ from 'lodash';
3
- import { withRouter } from 'react-router';
4
- import { connect } from 'react-redux';
5
- import Config from '../config';
6
- import { SVGIcon } from './SVGIcon';
7
- import { GenericInput } from './GenericInput';
8
- import { Text } from './Text';
9
- import { COLOUR_DUSK } from '../colours';
10
-
11
- class AudienceIncluder extends Component {
12
- constructor(props) {
13
- super(props);
14
- this.state = {
15
- showUserAdd: false,
16
- userSearch: '',
17
- returnList: [],
18
- userList: [],
19
-
20
- selectionList: [],
21
- };
22
- }
23
-
24
- UNSAFE_componentWillMount() {
25
- this.updateProps(this.props);
26
- }
27
-
28
- UNSAFE_componentWillReceiveProps(nextProps) {
29
- this.updateProps(nextProps);
30
- }
31
-
32
- updateProps(props) {
33
- var stateChange = { selectionList: props.selectionList, userList: props.userList };
34
-
35
- if (!_.isEmpty(this.state.userSearch) && this.state.userSearch.length > 1) {
36
- stateChange.returnList = _.filter(props.userList, (ev) => {
37
- return ev.displayName.toLowerCase().indexOf(this.state.userSearch.toLowerCase()) > -1;
38
- });
39
-
40
- stateChange.returnList = _.reject(stateChange.returnList, (item) =>
41
- _.find(props.selectionList, (t) => {
42
- return t.Id === item.Id;
43
- }),
44
- );
45
- }
46
- this.setState(stateChange);
47
- }
48
-
49
- showUserAdd() {
50
- this.setState({ showUserAdd: true });
51
- }
52
-
53
- handleChange(event) {
54
- if (this.state.searchUserLoading) {
55
- return;
56
- }
57
- var stateChange = { returnList: [] };
58
- stateChange[event.target.getAttribute('id')] = event.target.value;
59
-
60
- if (!_.isEmpty(event.target.value) && event.target.value.length > 1) {
61
- stateChange.returnList = _.filter(this.props.userList, (ev) => {
62
- return ev.displayName.toLowerCase().indexOf(event.target.value.toLowerCase()) > -1;
63
- });
64
-
65
- stateChange.returnList = _.reject(stateChange.returnList, (item) =>
66
- _.find(this.state.selectionList, (t) => {
67
- return t.Id === item.Id;
68
- }),
69
- );
70
- }
71
-
72
- this.setState(stateChange);
73
- }
74
-
75
- renderSearch() {
76
- return (
77
- <div style={{}}>
78
- {this.state.returnList.map((user, index) => {
79
- return (
80
- <div
81
- onClick={() => {
82
- this.props.add(user);
83
- }}
84
- key={user.Id}
85
- className="pointer"
86
- style={{ marginBottom: 8, display: 'flex', flexDirection: 'row', alignItems: 'center' }}
87
- >
88
- <img
89
- style={{ height: 30, width: 30, borderRadius: 15, marginRight: 16 }}
90
- src={user.profilePic != null ? user.profilePic : Config.env.defaultProfileImage}
91
- alt="user profilePic"
92
- />
93
- <div className={`fontMedium fontSize-16 text-dark'`}>{user.displayName}</div>
94
- </div>
95
- );
96
- })}
97
- </div>
98
- );
99
- }
100
-
101
- renderUserAdd() {
102
- return (
103
- <div className="" style={{ backgroundColor: '#fff' }}>
104
- {' '}
105
- {/* Search for peeps */}
106
- <GenericInput
107
- id="userSearch"
108
- type="text"
109
- label="Search for User"
110
- placeholder="Search for user"
111
- value={this.state.userSearch}
112
- onChange={(e) => this.handleChange(e)}
113
- alwaysShowLabel
114
- />
115
- {this.renderSearch()}
116
- </div>
117
- );
118
- }
119
-
120
- renderAttendees() {
121
- if (this.state.selectionList && !_.isEmpty(this.state.selectionList)) {
122
- return (
123
- <div style={{ marginTop: 16 }}>
124
- <Text type="formLabel" className="marginBottom-8">
125
- Selected Users
126
- </Text>
127
- {this.state.selectionList.map((user, index) => {
128
- return (
129
- <div
130
- key={user.Id}
131
- style={{ marginBottom: 8, display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}
132
- >
133
- <div className="flex" style={{ alignItems: 'center' }}>
134
- <img
135
- style={{ height: 30, width: 30, borderRadius: 15, marginRight: 16 }}
136
- src={user.profilePic != null ? user.profilePic : Config.env.defaultProfileImage}
137
- alt="user profilePic"
138
- />
139
- <div className={`fontMedium fontSize-16 text-dark'`}>{user.displayName}</div>
140
- </div>
141
- <SVGIcon
142
- className="removeIcon"
143
- icon="close"
144
- onClick={() => {
145
- this.props.remove(user);
146
- }}
147
- colour={COLOUR_DUSK}
148
- />
149
- {/* <ConfirmActions declineOnly onDecline={() => {}} /> */}
150
- </div>
151
- );
152
- })}
153
- </div>
154
- );
155
- }
156
- return null;
157
- }
158
-
159
- render() {
160
- return (
161
- <div>
162
- <div>{this.renderUserAdd()}</div>
163
- <div>{this.renderAttendees()}</div>
164
- </div>
165
- );
166
- }
167
- }
168
-
169
- const mapStateToProps = (state) => {
170
- return { auth: state.auth };
171
- };
172
-
173
- let exportObj = connect(mapStateToProps, {})(withRouter(AudienceIncluder));
174
-
175
- export { exportObj as AudienceIncluder };