@plusscommunities/pluss-circles-web 1.0.9 → 1.0.12
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/index.cjs.js +198 -707
- package/dist/index.esm.js +197 -706
- package/dist/index.umd.js +201 -710
- package/package.json +10 -4
- package/src/actions/types.js +5 -3
- package/src/apis/circleActions.js +15 -12
- package/src/feature.config.js +33 -18
- package/src/index.js +3 -2
- package/src/screens/AddCircle.js +66 -10
- package/src/screens/Circle.js +9 -9
- package/src/screens/Circles.js +19 -12
- package/src/values.config.default.js +35 -0
- package/src/values.config.groups.js +35 -0
- package/src/values.config.js +35 -0
package/package.json
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusscommunities/pluss-circles-web",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Extension package to enable circles on Pluss Communities Platform",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "npm i && rollup -c",
|
|
8
|
-
"
|
|
8
|
+
"betapatch": "npm version prepatch --preid=beta",
|
|
9
9
|
"patch": "npm version patch",
|
|
10
|
+
"betaupload": "npm run build && npm publish --access public --tag beta && rm -rf node_modules",
|
|
11
|
+
"betaupload:p": "npm run betapatch && npm run betaupload",
|
|
10
12
|
"upload": "npm run build && npm publish --access public && rm -rf node_modules",
|
|
11
13
|
"upload:p": "npm run patch && npm run upload",
|
|
12
|
-
"
|
|
14
|
+
"copy:add": "run(){ ext=${1:-default}; test -f src/values.config.$ext.js || cp src/values.config.default.js src/values.config.$ext.js; }; run",
|
|
15
|
+
"copy:get": "echo $npm_package_name",
|
|
16
|
+
"copy:set": "run(){ target='\\@plusscommunities\\/pluss-circles-web'; ext=${1:-default}; [ $ext == 'default' ] && replace=$target || replace=$target'-'$ext; echo 'Setting target to '$replace; test -f src/values.config.$ext.js && cp -f src/values.config.$ext.js src/values.config.js; sed -i '' -e 's/'$target'.*\"/'$replace'\"/g' package.json; }; run",
|
|
17
|
+
"copy:betaupload": "npm run betapatch; for file in `ls ./src/values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run betaupload; done; npm run copy:set;",
|
|
18
|
+
"copy:upload": "npm run patch; for file in `ls ./src/values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run upload; done; npm run copy:set;"
|
|
13
19
|
},
|
|
14
20
|
"author": "Phillip Suh",
|
|
15
21
|
"license": "ISC",
|
|
@@ -29,7 +35,7 @@
|
|
|
29
35
|
},
|
|
30
36
|
"dependencies": {
|
|
31
37
|
"@babel/runtime": "^7.14.0",
|
|
32
|
-
"@plusscommunities/pluss-core-web": "
|
|
38
|
+
"@plusscommunities/pluss-core-web": "1.4.10",
|
|
33
39
|
"lodash": "^4.17.4",
|
|
34
40
|
"moment": "^2.18.1",
|
|
35
41
|
"react": "^16.14.0",
|
package/src/actions/types.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export const
|
|
1
|
+
import { values } from '../values.config';
|
|
2
|
+
|
|
3
|
+
export const CIRCLES_LOADED = `${values.actionCircleKey}S_LOADED`;
|
|
4
|
+
export const CIRCLE_UPDATED = `${values.actionCircleKey}_UPDATED`;
|
|
5
|
+
export const CIRCLE_REMOVED = `${values.actionCircleKey}_REMOVED`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
+
import { values } from '../values.config';
|
|
2
3
|
import { PlussCore } from '../feature.config';
|
|
3
4
|
const { Helper, Session } = PlussCore;
|
|
4
5
|
|
|
@@ -6,49 +7,51 @@ export const circleActions = {
|
|
|
6
7
|
getAll: (site) => {
|
|
7
8
|
return Session.authedFunction({
|
|
8
9
|
method: 'GET',
|
|
9
|
-
url: Helper.getUrl(
|
|
10
|
+
url: Helper.getUrl(values.serviceKey, 'get/all', { site }),
|
|
10
11
|
});
|
|
11
12
|
},
|
|
12
13
|
getFiles: (circleId) => {
|
|
13
14
|
return Session.authedFunction({
|
|
14
15
|
method: 'GET',
|
|
15
|
-
url: Helper.getUrl(
|
|
16
|
+
url: Helper.getUrl(values.serviceKey, 'get/files', { circleId }),
|
|
16
17
|
});
|
|
17
18
|
},
|
|
18
19
|
getImages: (circleId) => {
|
|
19
20
|
return Session.authedFunction({
|
|
20
21
|
method: 'GET',
|
|
21
|
-
url: Helper.getUrl(
|
|
22
|
+
url: Helper.getUrl(values.serviceKey, 'get/images', { circleId }),
|
|
22
23
|
});
|
|
23
24
|
},
|
|
24
|
-
add: (site, title, image, audience) => {
|
|
25
|
+
add: (site, title, image, audience, isPublic) => {
|
|
25
26
|
return Session.authedFunction({
|
|
26
27
|
method: 'POST',
|
|
27
|
-
url: Helper.getUrl(
|
|
28
|
+
url: Helper.getUrl(values.serviceKey, 'update/add'),
|
|
28
29
|
data: {
|
|
29
30
|
site,
|
|
30
31
|
title,
|
|
31
32
|
image,
|
|
32
33
|
audience,
|
|
34
|
+
isPublic,
|
|
33
35
|
},
|
|
34
36
|
});
|
|
35
37
|
},
|
|
36
|
-
edit: (circleId, title, image, audience) => {
|
|
38
|
+
edit: (circleId, title, image, audience, isPublic) => {
|
|
37
39
|
return Session.authedFunction({
|
|
38
40
|
method: 'POST',
|
|
39
|
-
url: Helper.getUrl(
|
|
41
|
+
url: Helper.getUrl(values.serviceKey, 'update/edit'),
|
|
40
42
|
data: {
|
|
41
43
|
circleId,
|
|
42
44
|
title,
|
|
43
45
|
image,
|
|
44
46
|
audience,
|
|
47
|
+
isPublic,
|
|
45
48
|
},
|
|
46
49
|
});
|
|
47
50
|
},
|
|
48
51
|
delete: (circleId) => {
|
|
49
52
|
return Session.authedFunction({
|
|
50
53
|
method: 'POST',
|
|
51
|
-
url: Helper.getUrl(
|
|
54
|
+
url: Helper.getUrl(values.serviceKey, 'update/delete'),
|
|
52
55
|
data: {
|
|
53
56
|
circleId,
|
|
54
57
|
},
|
|
@@ -57,7 +60,7 @@ export const circleActions = {
|
|
|
57
60
|
addAdmin: (circleId, userId) => {
|
|
58
61
|
return Session.authedFunction({
|
|
59
62
|
method: 'POST',
|
|
60
|
-
url: Helper.getUrl(
|
|
63
|
+
url: Helper.getUrl(values.serviceKey, 'update/addadmin'),
|
|
61
64
|
data: {
|
|
62
65
|
circleId,
|
|
63
66
|
userId,
|
|
@@ -67,7 +70,7 @@ export const circleActions = {
|
|
|
67
70
|
removeAdmin: (circleId, userId) => {
|
|
68
71
|
return Session.authedFunction({
|
|
69
72
|
method: 'POST',
|
|
70
|
-
url: Helper.getUrl(
|
|
73
|
+
url: Helper.getUrl(values.serviceKey, 'update/removeadmin'),
|
|
71
74
|
data: {
|
|
72
75
|
circleId,
|
|
73
76
|
userId,
|
|
@@ -87,13 +90,13 @@ export const circleActions = {
|
|
|
87
90
|
}
|
|
88
91
|
return Session.authedFunction({
|
|
89
92
|
method: 'GET',
|
|
90
|
-
url: Helper.getUrl(
|
|
93
|
+
url: Helper.getUrl(values.serviceKey, 'getMessages', query),
|
|
91
94
|
});
|
|
92
95
|
},
|
|
93
96
|
sendMessage: async (circleId, message) => {
|
|
94
97
|
return Session.authedFunction({
|
|
95
98
|
method: 'post',
|
|
96
|
-
url: Helper.getUrl(
|
|
99
|
+
url: Helper.getUrl(values.serviceKey, 'sendMessage'),
|
|
97
100
|
data: {
|
|
98
101
|
groupId: circleId,
|
|
99
102
|
message,
|
package/src/feature.config.js
CHANGED
|
@@ -1,39 +1,54 @@
|
|
|
1
1
|
// import * as PlussCore from '../../pluss-core/src';
|
|
2
|
+
import _ from 'lodash';
|
|
2
3
|
import * as PlussCore from '@plusscommunities/pluss-core-web';
|
|
4
|
+
import { values } from './values.config';
|
|
3
5
|
|
|
4
6
|
export { PlussCore };
|
|
5
7
|
|
|
6
8
|
const FeatureConfig = {
|
|
7
|
-
key:
|
|
8
|
-
singularName:
|
|
9
|
-
description:
|
|
10
|
-
emptyText:
|
|
11
|
-
widgetOptions: [
|
|
9
|
+
key: values.featureKey,
|
|
10
|
+
singularName: _.capitalize(values.entityName),
|
|
11
|
+
description: `App users can create ${values.entityName}s and message each other.`,
|
|
12
|
+
emptyText: `You aren't in any ${_.capitalize(values.entityName)}s`,
|
|
13
|
+
widgetOptions: [
|
|
14
|
+
{
|
|
15
|
+
widget: true,
|
|
16
|
+
main: true,
|
|
17
|
+
hideOnTabNumbers: [],
|
|
18
|
+
optionKey: values.allowPublicKey,
|
|
19
|
+
type: 'toggle',
|
|
20
|
+
inverseOption: false,
|
|
21
|
+
title: `Allow for public ${values.entityName}s`,
|
|
22
|
+
description: `Public ${values.entityName}s can be viewed and joined by anyone in the community.`,
|
|
23
|
+
defaultNew: values.allowPublicKeyDefault,
|
|
24
|
+
default: values.allowPublicKeyDefault,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
12
27
|
menu: {
|
|
13
28
|
order: 11,
|
|
14
|
-
text:
|
|
15
|
-
icon:
|
|
16
|
-
isFontAwesome:
|
|
17
|
-
url:
|
|
29
|
+
text: values.textFeatureTitle,
|
|
30
|
+
icon: values.menuIcon,
|
|
31
|
+
isFontAwesome: values.isFontAwesome,
|
|
32
|
+
url: `/${values.featureKey}`,
|
|
18
33
|
countProps: null,
|
|
19
34
|
visibleExps: {
|
|
20
35
|
type: 'feature',
|
|
21
|
-
value:
|
|
36
|
+
value: values.featureKey,
|
|
22
37
|
},
|
|
23
38
|
},
|
|
24
|
-
addUrl:
|
|
25
|
-
addPermission:
|
|
39
|
+
addUrl: `/${values.featureKey}/add`,
|
|
40
|
+
addPermission: values.permission,
|
|
26
41
|
permissions: [
|
|
27
42
|
{
|
|
28
|
-
displayName:
|
|
29
|
-
key:
|
|
43
|
+
displayName: `Manage and View ${_.capitalize(values.entityName)}s`,
|
|
44
|
+
key: values.permission,
|
|
30
45
|
},
|
|
31
46
|
],
|
|
32
47
|
routes: [
|
|
33
|
-
{ path:
|
|
34
|
-
{ path:
|
|
35
|
-
{ path:
|
|
36
|
-
{ path:
|
|
48
|
+
{ path: `/${values.featureKey}`, component: values.componentCircles, exact: false },
|
|
49
|
+
{ path: `/${values.featureKey}/add`, component: values.componentAddCircle, exact: true },
|
|
50
|
+
{ path: `/${values.featureKey}/${values.entityKey}/:circleId`, component: values.componentCircle, exact: true },
|
|
51
|
+
{ path: `/${values.featureKey}/edit/:circleId`, component: values.componentAddCircle, exact: true },
|
|
37
52
|
],
|
|
38
53
|
env: {
|
|
39
54
|
baseStage: '',
|
package/src/index.js
CHANGED
|
@@ -2,9 +2,10 @@ import Circles from './screens/Circles';
|
|
|
2
2
|
import AddCircle from './screens/AddCircle';
|
|
3
3
|
import Circle from './screens/Circle';
|
|
4
4
|
import CircleReducer from './reducers/CircleReducer';
|
|
5
|
+
import { values } from './values.config';
|
|
5
6
|
|
|
6
|
-
export const Reducers = {
|
|
7
|
-
export const Screens = { Circles, AddCircle, Circle };
|
|
7
|
+
export const Reducers = { [values.reducerKey]: CircleReducer };
|
|
8
|
+
export const Screens = { [values.componentCircles]: Circles, [values.componentAddCircle]: AddCircle, [values.componentCircle]: Circle };
|
|
8
9
|
export { default as Config } from './feature.config';
|
|
9
10
|
export { default as ViewWidget } from './components/ViewWidget';
|
|
10
11
|
export { default as ViewFull } from './components/ViewFull';
|
package/src/screens/AddCircle.js
CHANGED
|
@@ -5,6 +5,7 @@ import { connect } from 'react-redux';
|
|
|
5
5
|
import { PlussCore } from '../feature.config';
|
|
6
6
|
import { circleActions } from '../apis';
|
|
7
7
|
import { circlesLoaded, circleUpdated } from '../actions';
|
|
8
|
+
import { values } from '../values.config';
|
|
8
9
|
|
|
9
10
|
const { Actions, Components, Session, Apis, Colours, Helper } = PlussCore;
|
|
10
11
|
|
|
@@ -24,12 +25,14 @@ class AddCircle extends Component {
|
|
|
24
25
|
users: [],
|
|
25
26
|
selectedUsers: [],
|
|
26
27
|
userSearch: '',
|
|
28
|
+
isPublic: false,
|
|
29
|
+
selectedOption: 'visibility',
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
componentDidMount() {
|
|
31
34
|
Session.checkLoggedIn(this, this.props.auth);
|
|
32
|
-
this.props.addRecentlyCreated(
|
|
35
|
+
this.props.addRecentlyCreated(values.entityKey);
|
|
33
36
|
this.getUsers();
|
|
34
37
|
|
|
35
38
|
this.checkGetCircle();
|
|
@@ -85,6 +88,7 @@ class AddCircle extends Component {
|
|
|
85
88
|
});
|
|
86
89
|
const newState = {
|
|
87
90
|
title: circle.Title,
|
|
91
|
+
isPublic: !!circle.IsPublic,
|
|
88
92
|
selectedUsers,
|
|
89
93
|
};
|
|
90
94
|
this.setState(newState);
|
|
@@ -180,7 +184,7 @@ class AddCircle extends Component {
|
|
|
180
184
|
|
|
181
185
|
if (this.state.circleId) {
|
|
182
186
|
circleActions
|
|
183
|
-
.edit(this.state.circleId, this.state.title, this.state.image, audience)
|
|
187
|
+
.edit(this.state.circleId, this.state.title, this.state.image, audience, this.state.isPublic)
|
|
184
188
|
.then((res) => {
|
|
185
189
|
this.setState({
|
|
186
190
|
success: true,
|
|
@@ -196,7 +200,7 @@ class AddCircle extends Component {
|
|
|
196
200
|
});
|
|
197
201
|
} else {
|
|
198
202
|
circleActions
|
|
199
|
-
.add(this.props.auth.site, this.state.title, this.state.image, audience)
|
|
203
|
+
.add(this.props.auth.site, this.state.title, this.state.image, audience, this.state.isPublic)
|
|
200
204
|
.then((res) => {
|
|
201
205
|
this.setState({
|
|
202
206
|
success: true,
|
|
@@ -249,14 +253,14 @@ class AddCircle extends Component {
|
|
|
249
253
|
if (!this.state.success) return null;
|
|
250
254
|
return (
|
|
251
255
|
<Components.SuccessPopup
|
|
252
|
-
text={
|
|
256
|
+
text={`${_.capitalize(values.entityName)} has been ${this.state.circleId == null ? 'added' : 'edited'}`}
|
|
253
257
|
buttons={[
|
|
254
258
|
{
|
|
255
259
|
type: 'outlined',
|
|
256
260
|
onClick: () => {
|
|
257
261
|
window.history.back();
|
|
258
262
|
},
|
|
259
|
-
text: `Back to
|
|
263
|
+
text: `Back to ${values.textFeatureTitle}`,
|
|
260
264
|
},
|
|
261
265
|
]}
|
|
262
266
|
/>
|
|
@@ -273,7 +277,7 @@ class AddCircle extends Component {
|
|
|
273
277
|
<Components.Button
|
|
274
278
|
inline
|
|
275
279
|
buttonType="tertiary"
|
|
276
|
-
onClick={() => this.props.history.push(
|
|
280
|
+
onClick={() => this.props.history.push(`/${values.featureKey}`)}
|
|
277
281
|
isActive
|
|
278
282
|
style={{ marginRight: 16 }}
|
|
279
283
|
>
|
|
@@ -286,12 +290,61 @@ class AddCircle extends Component {
|
|
|
286
290
|
);
|
|
287
291
|
}
|
|
288
292
|
|
|
293
|
+
renderVisibility() {
|
|
294
|
+
return (
|
|
295
|
+
<div className="optionsContent_bottom">
|
|
296
|
+
<Components.RadioButton
|
|
297
|
+
label={`Do you want to make this ${values.entityName} a public ${values.entityName}?`}
|
|
298
|
+
isActive={this.state.isPublic}
|
|
299
|
+
options={[
|
|
300
|
+
{ Label: 'Yes', Value: true, onChange: () => this.setState({ isPublic: true }) },
|
|
301
|
+
{ Label: 'No', Value: false, onChange: () => this.setState({ isPublic: false }) },
|
|
302
|
+
]}
|
|
303
|
+
/>
|
|
304
|
+
<div className="genericInput-help" style={{ marginTop: 4 }}>
|
|
305
|
+
{`This will allow anyone in the community to view and join the ${values.entityName}.`}
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
renderSelectedOption() {
|
|
312
|
+
return (
|
|
313
|
+
<div>
|
|
314
|
+
<div style={{ display: this.state.selectedOption === 'visibility' ? 'block' : 'none' }}>{this.renderVisibility()}</div>
|
|
315
|
+
</div>
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
renderOptionsSection() {
|
|
320
|
+
let options = [
|
|
321
|
+
{
|
|
322
|
+
key: 'visibility',
|
|
323
|
+
icon: 'people3',
|
|
324
|
+
text: 'Visibility',
|
|
325
|
+
},
|
|
326
|
+
];
|
|
327
|
+
if (!this.props.circleAllowPublicCircles) {
|
|
328
|
+
options = _.filter(options, (o) => {
|
|
329
|
+
return o.key !== 'visibility';
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
if (_.isEmpty(options)) {
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
return (
|
|
336
|
+
<Components.OptionsSection options={options} selected={this.state.selectedOption} selectOption={this.selectOption}>
|
|
337
|
+
{this.renderSelectedOption()}
|
|
338
|
+
</Components.OptionsSection>
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
|
|
289
342
|
renderMain() {
|
|
290
343
|
return (
|
|
291
|
-
<div
|
|
344
|
+
<div>
|
|
292
345
|
<div className="padding-60 paddingVertical-40 bottomDivideBorder">
|
|
293
346
|
<Components.Text type="formTitleLarge" className="marginBottom-24">
|
|
294
|
-
{this.state.circleId == null ? 'New' : 'Edit'}
|
|
347
|
+
{this.state.circleId == null ? 'New' : 'Edit'} {_.capitalize(values.entityName)}
|
|
295
348
|
</Components.Text>
|
|
296
349
|
{/* Resident Information */}
|
|
297
350
|
<div className="flex flex-reverse">
|
|
@@ -309,7 +362,7 @@ class AddCircle extends Component {
|
|
|
309
362
|
id="title"
|
|
310
363
|
type="text"
|
|
311
364
|
label="Title"
|
|
312
|
-
placeholder=
|
|
365
|
+
placeholder={`Name the ${_.capitalize(values.entityName)}`}
|
|
313
366
|
value={this.state.title}
|
|
314
367
|
onChange={(e) => this.onHandleChange(e)}
|
|
315
368
|
isRequired
|
|
@@ -392,6 +445,8 @@ class AddCircle extends Component {
|
|
|
392
445
|
</div>
|
|
393
446
|
</div>
|
|
394
447
|
</div>
|
|
448
|
+
|
|
449
|
+
{this.renderOptionsSection()}
|
|
395
450
|
</div>
|
|
396
451
|
);
|
|
397
452
|
}
|
|
@@ -416,11 +471,12 @@ class AddCircle extends Component {
|
|
|
416
471
|
}
|
|
417
472
|
|
|
418
473
|
const mapStateToProps = (state) => {
|
|
419
|
-
const { circles } = state.
|
|
474
|
+
const { circles } = state[values.reducerKey];
|
|
420
475
|
const { auth } = state;
|
|
421
476
|
return {
|
|
422
477
|
circles,
|
|
423
478
|
auth,
|
|
479
|
+
circleAllowPublicCircles: Helper.getSiteSettingFromState(state, values.allowPublicKey),
|
|
424
480
|
};
|
|
425
481
|
};
|
|
426
482
|
|
package/src/screens/Circle.js
CHANGED
|
@@ -7,7 +7,7 @@ import { circlesLoaded } from '../actions';
|
|
|
7
7
|
import { circleActions } from '../apis';
|
|
8
8
|
import FontAwesome from 'react-fontawesome';
|
|
9
9
|
import moment from 'moment';
|
|
10
|
-
import {
|
|
10
|
+
import { values } from '../values.config';
|
|
11
11
|
|
|
12
12
|
const { Components, Helper, Actions, Session, Colours } = PlussCore;
|
|
13
13
|
|
|
@@ -294,7 +294,7 @@ class Circle extends Component {
|
|
|
294
294
|
};
|
|
295
295
|
|
|
296
296
|
validateCircleAdmin() {
|
|
297
|
-
if (Session.validateAccess(this.props.auth.site,
|
|
297
|
+
if (Session.validateAccess(this.props.auth.site, values.permission, this.props.auth)) {
|
|
298
298
|
return true;
|
|
299
299
|
}
|
|
300
300
|
return _.some(this.getCircle().Audience, (user) => {
|
|
@@ -306,7 +306,7 @@ class Circle extends Component {
|
|
|
306
306
|
if (!this.isMember()) {
|
|
307
307
|
return (
|
|
308
308
|
<Components.Text type="highlightedHelp" className="chat_noMessage">
|
|
309
|
-
You can't send a message to this
|
|
309
|
+
You can't send a message to this {_.capitalize(values.entityName)} as you are not a member.
|
|
310
310
|
</Components.Text>
|
|
311
311
|
);
|
|
312
312
|
}
|
|
@@ -423,7 +423,7 @@ class Circle extends Component {
|
|
|
423
423
|
}
|
|
424
424
|
return (
|
|
425
425
|
<div className="flex flex-center">
|
|
426
|
-
<Link to={
|
|
426
|
+
<Link to={`/${values.featureKey}/edit/${this.state.circleId}`}>
|
|
427
427
|
<FontAwesome className="header_back" name="cog" />
|
|
428
428
|
</Link>
|
|
429
429
|
</div>
|
|
@@ -450,7 +450,7 @@ class Circle extends Component {
|
|
|
450
450
|
/>
|
|
451
451
|
<div className="flex-1">
|
|
452
452
|
<Components.Text type="formTitleMedium">
|
|
453
|
-
Member{getPluralS(members.length)} ({members.length})
|
|
453
|
+
Member{Helper.getPluralS(members.length)} ({members.length})
|
|
454
454
|
</Components.Text>
|
|
455
455
|
</div>
|
|
456
456
|
</div>
|
|
@@ -471,7 +471,7 @@ class Circle extends Component {
|
|
|
471
471
|
/>
|
|
472
472
|
<div className="flex-1">
|
|
473
473
|
<Components.Text type="formTitleMedium">
|
|
474
|
-
Image{getPluralS(this.state.images.length)} ({this.state.images.length})
|
|
474
|
+
Image{Helper.getPluralS(this.state.images.length)} ({this.state.images.length})
|
|
475
475
|
</Components.Text>
|
|
476
476
|
</div>
|
|
477
477
|
</div>
|
|
@@ -480,7 +480,7 @@ class Circle extends Component {
|
|
|
480
480
|
{this.state.images.map((image, i) => {
|
|
481
481
|
return (
|
|
482
482
|
<a href={image.Url} target="_blank">
|
|
483
|
-
<img src={image.Url} className="chat_section_image" alt={getFileName(image.Url)} />
|
|
483
|
+
<img src={image.Url} className="chat_section_image" alt={Helper.getFileName(image.Url)} />
|
|
484
484
|
</a>
|
|
485
485
|
);
|
|
486
486
|
})}
|
|
@@ -496,7 +496,7 @@ class Circle extends Component {
|
|
|
496
496
|
/>
|
|
497
497
|
<div className="flex-1">
|
|
498
498
|
<Components.Text type="formTitleMedium">
|
|
499
|
-
File{getPluralS(this.state.files.length)} ({this.state.files.length})
|
|
499
|
+
File{Helper.getPluralS(this.state.files.length)} ({this.state.files.length})
|
|
500
500
|
</Components.Text>
|
|
501
501
|
</div>
|
|
502
502
|
</div>
|
|
@@ -579,7 +579,7 @@ class Circle extends Component {
|
|
|
579
579
|
const styles = {};
|
|
580
580
|
|
|
581
581
|
const mapStateToProps = (state) => {
|
|
582
|
-
const { circles } = state.
|
|
582
|
+
const { circles } = state[values.reducerKey];
|
|
583
583
|
const { auth } = state;
|
|
584
584
|
return {
|
|
585
585
|
circles,
|
package/src/screens/Circles.js
CHANGED
|
@@ -8,6 +8,7 @@ import { circlesLoaded, circleRemoved } from '../actions';
|
|
|
8
8
|
import { circleActions } from '../apis';
|
|
9
9
|
import { Table } from 'react-bootstrap';
|
|
10
10
|
import FontAwesome from 'react-fontawesome';
|
|
11
|
+
import { values } from '../values.config';
|
|
11
12
|
|
|
12
13
|
const { Components, Session, Helper } = PlussCore;
|
|
13
14
|
|
|
@@ -77,7 +78,7 @@ class Circles extends Component {
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
validateCircleAdmin(circle, onlyCreator) {
|
|
80
|
-
if (Session.validateAccess(this.props.auth.site,
|
|
81
|
+
if (Session.validateAccess(this.props.auth.site, values.permission, this.props.auth)) {
|
|
81
82
|
return true;
|
|
82
83
|
}
|
|
83
84
|
if (onlyCreator) {
|
|
@@ -90,13 +91,13 @@ class Circles extends Component {
|
|
|
90
91
|
|
|
91
92
|
canAddNew = () => {
|
|
92
93
|
const { auth } = this.props;
|
|
93
|
-
return Session.validateAccess(auth.site,
|
|
94
|
+
return Session.validateAccess(auth.site, values.permission, auth);
|
|
94
95
|
};
|
|
95
96
|
|
|
96
97
|
onAddNew = () => {
|
|
97
98
|
const { auth } = this.props;
|
|
98
|
-
if (Session.validateAccess(auth.site,
|
|
99
|
-
this.props.history.push(
|
|
99
|
+
if (Session.validateAccess(auth.site, values.permission, auth)) {
|
|
100
|
+
this.props.history.push(`/${values.featureKey}/add`);
|
|
100
101
|
}
|
|
101
102
|
};
|
|
102
103
|
|
|
@@ -159,7 +160,11 @@ class Circles extends Component {
|
|
|
159
160
|
};
|
|
160
161
|
|
|
161
162
|
removeCircle = (circle) => {
|
|
162
|
-
if (
|
|
163
|
+
if (
|
|
164
|
+
window.confirm(
|
|
165
|
+
`Are you sure you want to delete that ${values.entityName}? You will no longer be able to access the messages in the ${values.entityName}.`,
|
|
166
|
+
)
|
|
167
|
+
) {
|
|
163
168
|
this.props.circleRemoved(circle.Id);
|
|
164
169
|
circleActions
|
|
165
170
|
.delete(circle.Id)
|
|
@@ -176,7 +181,7 @@ class Circles extends Component {
|
|
|
176
181
|
if (type === 'private') {
|
|
177
182
|
return 'Private Message';
|
|
178
183
|
}
|
|
179
|
-
return
|
|
184
|
+
return _.capitalize(values.entityName);
|
|
180
185
|
};
|
|
181
186
|
|
|
182
187
|
getTitle = (circle) => {
|
|
@@ -192,7 +197,7 @@ class Circles extends Component {
|
|
|
192
197
|
return (
|
|
193
198
|
<tr key={circle.Id}>
|
|
194
199
|
<td className="table-TitleColumn">
|
|
195
|
-
<Link to={
|
|
200
|
+
<Link to={`/${values.featureKey}/${values.entityKey}/${circle.Id}`}>{this.getTitle(circle)}</Link>
|
|
196
201
|
</td>
|
|
197
202
|
<td>{moment(circle.Changed).local().format('D MMM YYYY')}</td>
|
|
198
203
|
<td>
|
|
@@ -210,7 +215,7 @@ class Circles extends Component {
|
|
|
210
215
|
<td className="table-options">
|
|
211
216
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
212
217
|
{this.validateCircleAdmin(circle) && !circle.IsPrivate && (
|
|
213
|
-
<Link to={
|
|
218
|
+
<Link to={`/${values.featureKey}/edit/${circle.Id}`}>
|
|
214
219
|
<FontAwesome
|
|
215
220
|
style={{
|
|
216
221
|
fontSize: 20,
|
|
@@ -318,7 +323,7 @@ class Circles extends Component {
|
|
|
318
323
|
onClick={() => {
|
|
319
324
|
this.selectTypeFilter('circle');
|
|
320
325
|
}}
|
|
321
|
-
text=
|
|
326
|
+
text={_.capitalize(values.entityName)}
|
|
322
327
|
className="marginRight-10"
|
|
323
328
|
/>
|
|
324
329
|
<Components.Tag
|
|
@@ -336,10 +341,12 @@ class Circles extends Component {
|
|
|
336
341
|
<div>
|
|
337
342
|
{this.renderTypeFilterPopup()}
|
|
338
343
|
{this.renderUserFilterPopup()}
|
|
339
|
-
<Components.Header>
|
|
344
|
+
<Components.Header>
|
|
345
|
+
{this.canAddNew() && <Components.AddButton onClick={this.onAddNew} text={`NEW ${_.upperCase(values.entityName)}`} />}
|
|
346
|
+
</Components.Header>
|
|
340
347
|
<div className="pageContainer paddingVertical-20 paddingHorizontal-40">
|
|
341
348
|
<Components.Text type="h1" className="">
|
|
342
|
-
|
|
349
|
+
{values.textFeatureTitle}
|
|
343
350
|
</Components.Text>
|
|
344
351
|
{this.renderFilters()}
|
|
345
352
|
|
|
@@ -368,7 +375,7 @@ class Circles extends Component {
|
|
|
368
375
|
const styles = {};
|
|
369
376
|
|
|
370
377
|
const mapStateToProps = (state) => {
|
|
371
|
-
const { circles } = state.
|
|
378
|
+
const { circles } = state[values.reducerKey];
|
|
372
379
|
const { auth } = state;
|
|
373
380
|
|
|
374
381
|
return {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const values = {
|
|
2
|
+
featureKey: 'circles',
|
|
3
|
+
entityKey: 'circle',
|
|
4
|
+
entityName: 'circle',
|
|
5
|
+
serviceKey: 'circles',
|
|
6
|
+
permission: 'circles',
|
|
7
|
+
menuIcon: 'circle-o',
|
|
8
|
+
isFontAwesome: true,
|
|
9
|
+
|
|
10
|
+
reducerKey: 'circles',
|
|
11
|
+
|
|
12
|
+
actionCircleKey: 'CIRCLE',
|
|
13
|
+
|
|
14
|
+
textFeatureTitle: 'Circles',
|
|
15
|
+
textAddMenuTitle: 'Circle',
|
|
16
|
+
textEmptyGroups: "You aren't in any Circles",
|
|
17
|
+
textEmptyPeople: 'Contacts will show here',
|
|
18
|
+
|
|
19
|
+
componentCircles: 'Circles',
|
|
20
|
+
componentAddCircle: 'AddCircle',
|
|
21
|
+
componentCircle: 'Circle',
|
|
22
|
+
|
|
23
|
+
inviteKey: 'circleInvite',
|
|
24
|
+
messageKey: 'circleMessage',
|
|
25
|
+
chatRoute: 'circleChat',
|
|
26
|
+
updateKeyUserCircles: 'userCircles',
|
|
27
|
+
allowPublicKey: 'circleAllowPublicCircles',
|
|
28
|
+
allowPublicKeyDefault: false,
|
|
29
|
+
|
|
30
|
+
settings: {
|
|
31
|
+
allowAnyCreate: false,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { values };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const values = {
|
|
2
|
+
featureKey: 'groups',
|
|
3
|
+
entityKey: 'group',
|
|
4
|
+
entityName: 'group',
|
|
5
|
+
serviceKey: 'groups',
|
|
6
|
+
permission: 'groups',
|
|
7
|
+
menuIcon: 'comments',
|
|
8
|
+
isFontAwesome: true,
|
|
9
|
+
|
|
10
|
+
reducerKey: 'groups',
|
|
11
|
+
|
|
12
|
+
actionCircleKey: 'GROUP',
|
|
13
|
+
|
|
14
|
+
textFeatureTitle: 'Groups',
|
|
15
|
+
textAddMenuTitle: 'Group',
|
|
16
|
+
textEmptyGroups: "You aren't in any Groups",
|
|
17
|
+
textEmptyPeople: 'Contacts will show here',
|
|
18
|
+
|
|
19
|
+
componentCircles: 'Groups',
|
|
20
|
+
componentAddCircle: 'AddGroup',
|
|
21
|
+
componentCircle: 'Group',
|
|
22
|
+
|
|
23
|
+
inviteKey: 'groupInvite',
|
|
24
|
+
messageKey: 'groupMessage',
|
|
25
|
+
chatRoute: 'groupChat',
|
|
26
|
+
updateKeyUserCircles: 'userGroups',
|
|
27
|
+
allowPublicKey: 'groupAllowPublicGroups',
|
|
28
|
+
allowPublicKeyDefault: true,
|
|
29
|
+
|
|
30
|
+
settings: {
|
|
31
|
+
allowAnyCreate: true,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { values };
|