@plusscommunities/pluss-feeds-web 1.0.1-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.
- package/.babelrc +3 -0
- package/dist/index.cjs.js +2912 -0
- package/dist/index.esm.js +2874 -0
- package/dist/index.umd.js +2906 -0
- package/package.json +56 -0
- package/rollup.config.js +59 -0
- package/src/actions/FeedActions.js +73 -0
- package/src/actions/index.js +6 -0
- package/src/actions/types.js +8 -0
- package/src/apis/feedActions.js +94 -0
- package/src/apis/index.js +9 -0
- package/src/apis/reactionActions.js +46 -0
- package/src/components/FeedList.js +682 -0
- package/src/components/FeedSubmissions.js +169 -0
- package/src/components/FeedTypes.js +324 -0
- package/src/components/PreviewFull.js +25 -0
- package/src/components/PreviewGrid.js +29 -0
- package/src/components/PreviewWidget.js +27 -0
- package/src/components/ViewFull.js +18 -0
- package/src/components/ViewWidget.js +16 -0
- package/src/feature.config.js +87 -0
- package/src/images/full.png +0 -0
- package/src/images/fullNoTitle.png +0 -0
- package/src/images/previewWidget.png +0 -0
- package/src/images/widget.png +0 -0
- package/src/index.js +27 -0
- package/src/reducers/FeedReducer.js +71 -0
- package/src/screens/AddFeed.js +402 -0
- package/src/screens/Feed.js +323 -0
- package/src/screens/FeedHub.js +245 -0
- package/src/values.config.default.js +42 -0
- package/src/values.config.js +42 -0
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plusscommunities/pluss-feeds-web",
|
|
3
|
+
"version": "1.0.1-beta.0",
|
|
4
|
+
"description": "Extension package to enable feeds on Pluss Communities Platform",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "npm i && rollup -c",
|
|
8
|
+
"betapatch": "npm version prepatch --preid=beta",
|
|
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",
|
|
12
|
+
"upload": "npm run build && npm publish --access public && rm -rf node_modules",
|
|
13
|
+
"upload:p": "npm run patch && npm run upload",
|
|
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-feeds-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;"
|
|
19
|
+
},
|
|
20
|
+
"author": "Phillip Suh",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@babel/cli": "^7.14.3",
|
|
24
|
+
"@babel/core": "^7.14.3",
|
|
25
|
+
"@babel/plugin-transform-runtime": "^7.14.3",
|
|
26
|
+
"@babel/preset-env": "^7.14.2",
|
|
27
|
+
"@babel/preset-react": "^7.13.13",
|
|
28
|
+
"@rollup/plugin-babel": "^5.3.0",
|
|
29
|
+
"@rollup/plugin-image": "^2.0.6",
|
|
30
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
31
|
+
"autoprefixer": "^10.2.6",
|
|
32
|
+
"rollup": "^2.50.1",
|
|
33
|
+
"rollup-plugin-local-resolve": "^1.0.7",
|
|
34
|
+
"rollup-plugin-styles": "^3.14.1"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@babel/runtime": "^7.14.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@plusscommunities/pluss-core-web": "1.6.1-beta.0",
|
|
41
|
+
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
|
42
|
+
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
|
43
|
+
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
44
|
+
"js-cookie": "^2.2.0",
|
|
45
|
+
"lodash": "^4.17.4",
|
|
46
|
+
"moment": "^2.30.1",
|
|
47
|
+
"react": "^16.14.0",
|
|
48
|
+
"react-bootstrap": "^0.31.2",
|
|
49
|
+
"react-dom": "^16.14.0",
|
|
50
|
+
"react-fontawesome": "^1.6.1",
|
|
51
|
+
"react-redux": "^5.0.6",
|
|
52
|
+
"react-router-dom": "^4.2.2",
|
|
53
|
+
"react-textarea-autosize": "^7.1.0-1"
|
|
54
|
+
},
|
|
55
|
+
"keywords": []
|
|
56
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import styles from 'rollup-plugin-styles';
|
|
2
|
+
const autoprefixer = require('autoprefixer');
|
|
3
|
+
import babel from '@rollup/plugin-babel';
|
|
4
|
+
import json from '@rollup/plugin-json';
|
|
5
|
+
import image from '@rollup/plugin-image';
|
|
6
|
+
import localResolve from 'rollup-plugin-local-resolve';
|
|
7
|
+
|
|
8
|
+
// the entry point for the library
|
|
9
|
+
const input = 'src/index.js';
|
|
10
|
+
|
|
11
|
+
var MODE = [
|
|
12
|
+
{
|
|
13
|
+
fomart: 'cjs',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
fomart: 'esm',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
fomart: 'umd',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
var config = [];
|
|
24
|
+
|
|
25
|
+
MODE.map((m) => {
|
|
26
|
+
var conf = {
|
|
27
|
+
input: input,
|
|
28
|
+
output: {
|
|
29
|
+
// then name of your package
|
|
30
|
+
name: '@plusscommunities/pluss-feeds-web',
|
|
31
|
+
file: `dist/index.${m.fomart}.js`,
|
|
32
|
+
format: m.fomart,
|
|
33
|
+
exports: 'auto',
|
|
34
|
+
},
|
|
35
|
+
// this externelizes react to prevent rollup from compiling it
|
|
36
|
+
external: ['react', /@babel\/runtime/],
|
|
37
|
+
plugins: [
|
|
38
|
+
// these are babel comfigurations
|
|
39
|
+
babel({
|
|
40
|
+
exclude: 'node_modules/**',
|
|
41
|
+
presets: ['@babel/preset-react', '@babel/preset-env'],
|
|
42
|
+
plugins: ['@babel/transform-runtime'],
|
|
43
|
+
babelHelpers: 'runtime',
|
|
44
|
+
}),
|
|
45
|
+
// this adds support for styles
|
|
46
|
+
styles({
|
|
47
|
+
postcss: {
|
|
48
|
+
plugins: [autoprefixer()],
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
json(),
|
|
52
|
+
image(),
|
|
53
|
+
localResolve(),
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
config.push(conf);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export default [...config];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import {
|
|
3
|
+
FEEDS_LOADING,
|
|
4
|
+
FEEDS_LOADED,
|
|
5
|
+
FEEDS_REMOVED,
|
|
6
|
+
FEEDS_SUBMISSIONS_LOADED,
|
|
7
|
+
FEEDS_SUBMISSIONS_REMOVED,
|
|
8
|
+
FEED_TYPES_LOADED,
|
|
9
|
+
} from './types';
|
|
10
|
+
import { feedActions } from '../apis';
|
|
11
|
+
|
|
12
|
+
import { PlussCore } from '../feature.config';
|
|
13
|
+
const { Helper } = PlussCore;
|
|
14
|
+
|
|
15
|
+
export const feedsUpdate = (site, isdashboard) => {
|
|
16
|
+
return (dispatch) => {
|
|
17
|
+
if (isdashboard) dispatch({ type: FEEDS_LOADING });
|
|
18
|
+
feedActions.getFeedsRecursive(site).then((res) => {
|
|
19
|
+
const currentSite = Helper.readStorageWithCookie('site');
|
|
20
|
+
if (!_.isEmpty(res) && res[0].site === currentSite) {
|
|
21
|
+
dispatch({ type: FEEDS_LOADED, payload: res });
|
|
22
|
+
} else {
|
|
23
|
+
dispatch({ type: FEEDS_LOADED, payload: [] });
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const feedsLoaded = (feeds) => {
|
|
30
|
+
return {
|
|
31
|
+
type: FEEDS_LOADED,
|
|
32
|
+
payload: feeds,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const removeFeed = (id) => {
|
|
37
|
+
return {
|
|
38
|
+
type: FEEDS_REMOVED,
|
|
39
|
+
payload: id,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const feedsSubmissionsLoaded = (submissions) => {
|
|
44
|
+
return {
|
|
45
|
+
type: FEEDS_SUBMISSIONS_LOADED,
|
|
46
|
+
payload: submissions,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const removeFeedSubmission = (id) => {
|
|
51
|
+
return {
|
|
52
|
+
type: FEEDS_SUBMISSIONS_REMOVED,
|
|
53
|
+
payload: id,
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const feedTypesUpdate = (site) => {
|
|
58
|
+
return (dispatch) => {
|
|
59
|
+
feedActions.getFeedTypes(site).then((res) => {
|
|
60
|
+
dispatch({
|
|
61
|
+
type: FEED_TYPES_LOADED,
|
|
62
|
+
payload: res.data,
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const feedTypesLoaded = (feedTypes) => {
|
|
69
|
+
return {
|
|
70
|
+
type: FEED_TYPES_LOADED,
|
|
71
|
+
payload: feedTypes,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { values } from '../values.config';
|
|
2
|
+
|
|
3
|
+
export const FEEDS_LOADED = values.actionFeedsLoaded;
|
|
4
|
+
export const FEED_TYPES_LOADED = values.actionFeedTypeLoaded;
|
|
5
|
+
export const FEEDS_REMOVED = values.actionFeedRemoved;
|
|
6
|
+
export const FEEDS_LOADING = values.actionFeedsLoading;
|
|
7
|
+
export const FEEDS_SUBMISSIONS_LOADED = values.actionFeedsSubmissionsLoaded;
|
|
8
|
+
export const FEEDS_SUBMISSIONS_REMOVED = values.actionFeedsSubmissionsRemoved;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { PlussCore } from '../feature.config';
|
|
2
|
+
import { values } from '../values.config';
|
|
3
|
+
const { Helper, Session } = PlussCore;
|
|
4
|
+
|
|
5
|
+
export const feedActions = {
|
|
6
|
+
getFeedTypes: (site) => {
|
|
7
|
+
let url = Helper.getUrl(values.serviceKey, 'getTypes', { site });
|
|
8
|
+
return Session.authedFunction({ method: 'GET', url });
|
|
9
|
+
},
|
|
10
|
+
addFeedType: (site, label, colour) => {
|
|
11
|
+
return Session.authedFunction({
|
|
12
|
+
method: 'POST',
|
|
13
|
+
url: Helper.getUrl(values.serviceKey, 'createType'),
|
|
14
|
+
data: { site, label, colour },
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
editFeedType: (site, id, label, colour) => {
|
|
18
|
+
return Session.authedFunction({
|
|
19
|
+
method: 'POST',
|
|
20
|
+
url: Helper.getUrl(values.serviceKey, 'editType'),
|
|
21
|
+
data: { site, id, label, colour },
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
deleteFeedType: (site, id) => {
|
|
25
|
+
return Session.authedFunction({
|
|
26
|
+
method: 'POST',
|
|
27
|
+
url: Helper.getUrl(values.serviceKey, 'deleteType'),
|
|
28
|
+
data: { site, id },
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
getFeed: (id) => {
|
|
32
|
+
const query = { id };
|
|
33
|
+
return Session.authedFunction({
|
|
34
|
+
method: 'GET',
|
|
35
|
+
url: Helper.getUrl(values.serviceKey, 'getPost', query),
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
getFeedSubmissions: (site) => {
|
|
39
|
+
const query = { site };
|
|
40
|
+
return Session.authedFunction({
|
|
41
|
+
method: 'GET',
|
|
42
|
+
url: Helper.getUrl(values.serviceKey, 'getPendingPosts', query),
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
getFeeds: (site, userId, authorId, lastKey) => {
|
|
46
|
+
const query = { site };
|
|
47
|
+
if (userId) query.userId = userId;
|
|
48
|
+
if (authorId) query.authorId = authorId;
|
|
49
|
+
if (lastKey) query.lastKey = JSON.stringify(lastKey);
|
|
50
|
+
return Session.authedFunction({
|
|
51
|
+
method: 'GET',
|
|
52
|
+
url: Helper.getUrl(values.serviceKey, 'getPosts', query),
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
getFeedsRecursive: (site, userId, authorId, lastKey, feeds = []) => {
|
|
56
|
+
return new Promise((resolve) => {
|
|
57
|
+
feedActions.getFeeds(site, userId, authorId, lastKey).then((res) => {
|
|
58
|
+
const newFeeds = [...feeds, ...res.data.Items];
|
|
59
|
+
if (!res.data.LastKey) {
|
|
60
|
+
return resolve(newFeeds);
|
|
61
|
+
}
|
|
62
|
+
return resolve(feedActions.getFeedsRecursive(site, userId, authorId, res.data.LastKey, newFeeds));
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
createFeed: (feed) => {
|
|
67
|
+
return Session.authedFunction({
|
|
68
|
+
method: 'POST',
|
|
69
|
+
url: Helper.getUrl(values.serviceKey, 'createPost'),
|
|
70
|
+
data: { ...feed },
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
editFeed: (feed) => {
|
|
74
|
+
return Session.authedFunction({
|
|
75
|
+
method: 'POST',
|
|
76
|
+
url: Helper.getUrl(values.serviceKey, 'editPost'),
|
|
77
|
+
data: { ...feed },
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
deleteFeed: (id) => {
|
|
81
|
+
return Session.authedFunction({
|
|
82
|
+
method: 'POST',
|
|
83
|
+
url: Helper.getUrl(values.serviceKey, 'deletePost'),
|
|
84
|
+
data: { id },
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
reviewFeed: (id, approved) => {
|
|
88
|
+
return Session.authedFunction({
|
|
89
|
+
method: 'POST',
|
|
90
|
+
url: Helper.getUrl(values.serviceKey, 'reviewPost'),
|
|
91
|
+
data: { id, approved },
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { PlussCore } from '../feature.config';
|
|
3
|
+
const { Helper, Session } = PlussCore;
|
|
4
|
+
|
|
5
|
+
export const reactionActions = {
|
|
6
|
+
addComment: (entityId, entityType, entityName, site, comment, image, parentId) => {
|
|
7
|
+
const data = {
|
|
8
|
+
entityId,
|
|
9
|
+
entityType,
|
|
10
|
+
entityName,
|
|
11
|
+
site,
|
|
12
|
+
comment,
|
|
13
|
+
parentId,
|
|
14
|
+
};
|
|
15
|
+
if (!_.isEmpty(image)) {
|
|
16
|
+
data.image = image;
|
|
17
|
+
}
|
|
18
|
+
return Session.authedFunction({
|
|
19
|
+
method: 'POST',
|
|
20
|
+
url: Helper.getUrl('reactions', 'comments/add'),
|
|
21
|
+
data,
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
// removeComment: (id) => {
|
|
25
|
+
// return Session.authedFunction({
|
|
26
|
+
// method: 'POST',
|
|
27
|
+
// url: Helper.getUrl('reactions', 'comments/remove'),
|
|
28
|
+
// data: {
|
|
29
|
+
// id,
|
|
30
|
+
// },
|
|
31
|
+
// });
|
|
32
|
+
// },
|
|
33
|
+
getComments: (entityId, entityType, minTime) => {
|
|
34
|
+
const query = {
|
|
35
|
+
entityId,
|
|
36
|
+
entityType,
|
|
37
|
+
};
|
|
38
|
+
if (minTime) {
|
|
39
|
+
query.minTime = minTime;
|
|
40
|
+
}
|
|
41
|
+
return Session.authedFunction({
|
|
42
|
+
method: 'GET',
|
|
43
|
+
url: Helper.getUrl('reactions', 'comments/get', query),
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
};
|