Skip to content

Commit 5b10af3

Browse files
authored
Merge pull request #1 from codeuino/development
Merge
2 parents b7e3d69 + 7d8ea62 commit 5b10af3

39 files changed

+2707
-1136
lines changed

package-lock.json

Lines changed: 631 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,28 @@
1010
"@testing-library/jest-dom": "^4.2.4",
1111
"@testing-library/react": "^9.4.0",
1212
"@testing-library/user-event": "^7.2.1",
13+
"@tinymce/tinymce-react": "^3.6.0",
1314
"axios": "^0.19.1",
1415
"boostrap": "^2.0.0",
16+
"html-react-parser": "^0.13.0",
1517
"jwt-decode": "^2.2.0",
18+
"markdown-it": "^11.0.0",
1619
"node-sass": "^4.13.0",
1720
"react": "^16.12.0",
1821
"react-bootstrap": "^1.0.0-beta.16",
1922
"react-content-loader": "^5.0.4",
2023
"react-cookies": "^0.1.1",
2124
"react-dom": "^16.12.0",
25+
"react-dropzone": "^11.0.1",
2226
"react-icons": "^3.9.0",
27+
"react-images": "^1.1.7",
2328
"react-lottie": "^1.2.3",
29+
"react-markdown-editor-lite": "^1.1.4",
2430
"react-redux": "^7.2.0",
2531
"react-responsive": "^8.0.3",
2632
"react-router-dom": "^5.1.2",
2733
"react-scripts": "^3.4.0",
34+
"react-spinners": "^0.8.3",
2835
"react-toastify": "^6.0.5",
2936
"redux": "^4.0.5",
3037
"redux-thunk": "^2.3.0",

src/actions/notificationAction.js

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,63 @@
1-
import { GET_PLATFORM_NOTIFICATIONS, GET_USER_NOTIFICATIONS } from './types'
2-
import axios from 'axios'
3-
import { errorHandler } from '../utils/errorHandler';
4-
import { setRequestStatus } from '../utils/setRequestStatus';
1+
import {
2+
GET_PLATFORM_NOTIFICATIONS,
3+
GET_USER_NOTIFICATIONS,
4+
GET_PROPOSAL_NOTIFICATIONS,
5+
} from "./types";
6+
import axios from "axios";
7+
import { errorHandler } from "../utils/errorHandler";
8+
import { setRequestStatus } from "../utils/setRequestStatus";
59

610
// GET NOTIFICATIONS FOR WHOLE PLATFORM AS WELL AS FOR A USER
711
export const getAllNotifications = () => async (dispatch) => {
812
try {
9-
const res = await axios.get('/notification/org/all')
10-
dispatch(setRequestStatus(false))
13+
const res = await axios.get("/notification/org/all");
14+
dispatch(setRequestStatus(false));
1115
if (res.status === 200) {
12-
dispatch(setRequestStatus(true))
13-
console.log('Whole platform notification ', res.data.notifications)
16+
dispatch(setRequestStatus(true));
17+
console.log("Whole platform notification ", res.data.notifications);
1418

1519
dispatch({
1620
type: GET_PLATFORM_NOTIFICATIONS,
17-
payload: res.data.notifications
18-
})
21+
payload: res.data.notifications,
22+
});
1923
}
2024
} catch (error) {
21-
dispatch(errorHandler(error))
25+
dispatch(errorHandler(error));
2226
}
23-
}
27+
};
2428

2529
// GET NOTIFICATIONS FOR A USER
2630
export const getUserNotification = () => async (dispatch) => {
2731
try {
28-
const res = await axios.get('/notification/user/all')
29-
dispatch(setRequestStatus(false))
32+
const res = await axios.get("/notification/user/all");
33+
dispatch(setRequestStatus(false));
3034
if (res.status === 200) {
31-
dispatch(setRequestStatus(true))
32-
console.log('User notification ', res.data.notifications)
35+
dispatch(setRequestStatus(true));
36+
console.log("User notification ", res.data.notifications);
3337
dispatch({
3438
type: GET_USER_NOTIFICATIONS,
35-
payload: res.data.notifications
36-
})
39+
payload: res.data.notifications,
40+
});
3741
}
3842
} catch (error) {
39-
dispatch(errorHandler(error))
43+
dispatch(errorHandler(error));
4044
}
41-
}
45+
};
46+
47+
// GET PROPOSAL NOTIFICATIONS
48+
export const getProposalNotifications = () => async (dispatch) => {
49+
try {
50+
const res = await axios.get("/notification/proposal/all");
51+
dispatch(setRequestStatus(false));
52+
if (res.status === 200) {
53+
dispatch(setRequestStatus(true));
54+
console.log("Proposal notification ", res.data.notifications);
55+
dispatch({
56+
type: GET_PROPOSAL_NOTIFICATIONS,
57+
payload: res.data.notifications,
58+
});
59+
}
60+
} catch (error) {
61+
dispatch(errorHandler(error));
62+
}
63+
};

src/actions/proposalActions.js

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
import axios from "axios";
2+
import { errorHandler } from "../utils/errorHandler";
3+
import { setRequestStatus } from "../utils/setRequestStatus";
4+
import {
5+
CREATE_PROPOSAL,
6+
GET_PROPOSAL,
7+
GET_USER_PROPOSAL_NOTIFICATIONS,
8+
GET_ALL_PROPOSALS,
9+
GET_USER_PROPOSALS,
10+
} from "../actions/types";
11+
12+
// CREATE PROPOSAL
13+
export const createProposal = (proposalInfo) => async (dispatch) => {
14+
try {
15+
const res = await axios.post("/proposal", proposalInfo);
16+
dispatch(setRequestStatus(false));
17+
if (res.status === 201) {
18+
dispatch(setRequestStatus(true));
19+
console.log("proposal created in ACTION", res.data);
20+
dispatch({
21+
type: CREATE_PROPOSAL,
22+
payload: res.data.proposal || res.data.msg,
23+
});
24+
}
25+
} catch (error) {
26+
dispatch(errorHandler(error));
27+
}
28+
};
29+
30+
// GET PROPOSAL DATA
31+
export const getProposal = (proposalId) => async (dispatch) => {
32+
try {
33+
const res = await axios.get("/proposal/" + proposalId);
34+
dispatch(setRequestStatus(false));
35+
if (res.status === 200) {
36+
dispatch(setRequestStatus(true));
37+
console.log("proposal data fetched in action", res.data);
38+
dispatch({
39+
type: GET_PROPOSAL,
40+
payload: res.data.proposal || res.data.msg,
41+
});
42+
}
43+
} catch (error) {
44+
dispatch(errorHandler(error));
45+
}
46+
};
47+
48+
// SAVE PROPOSAL DATA
49+
export const saveProposal = (proposalData) => async (dispatch) => {
50+
try {
51+
const res = await axios.patch(
52+
"/proposal/" + proposalData.proposalId,
53+
proposalData
54+
);
55+
dispatch(setRequestStatus(false));
56+
if (res.status === 200) {
57+
dispatch(setRequestStatus(true));
58+
}
59+
} catch (error) {
60+
dispatch(errorHandler(error));
61+
}
62+
};
63+
64+
// SUBMIT PROPOSAL
65+
export const submitProposal = (proposalData) => async (dispatch) => {
66+
console.log(proposalData);
67+
try {
68+
const res = await axios.patch(
69+
"/proposal/change/" + proposalData.proposalId,
70+
proposalData
71+
);
72+
dispatch(setRequestStatus(false));
73+
if (res.status === 200) {
74+
dispatch(setRequestStatus(true));
75+
}
76+
} catch (error) {
77+
dispatch(errorHandler(error));
78+
}
79+
};
80+
81+
// DELETE PROPOSAL
82+
export const deleteProposal = (proposalId) => async (dispatch) => {
83+
try {
84+
const res = await axios.delete("/proposal", {
85+
headers: {},
86+
data: { proposalId: proposalId },
87+
});
88+
dispatch(setRequestStatus(false));
89+
if (res.status === 200) {
90+
dispatch(setRequestStatus(true));
91+
}
92+
} catch (error) {
93+
dispatch(errorHandler(error));
94+
}
95+
};
96+
97+
// COMMENT ON PROPOSAL
98+
export const commentProposal = (commentData) => async (dispatch) => {
99+
try {
100+
const res = await axios.post("/proposal/comment", commentData);
101+
dispatch(setRequestStatus(false));
102+
if (res.status === 200) {
103+
dispatch(setRequestStatus(true));
104+
}
105+
} catch (error) {
106+
dispatch(errorHandler(error));
107+
}
108+
};
109+
110+
// GET USER RELATED PROPOSAL NOTIFICATIONS
111+
export const getUserProposalNotifications = (data) => async (dispatch) => {
112+
try {
113+
const res = await axios.post("/proposal/notifications", data);
114+
console.log(res);
115+
if (res.status === 200) {
116+
dispatch(setRequestStatus(true));
117+
dispatch({
118+
type: GET_USER_PROPOSAL_NOTIFICATIONS,
119+
payload: res.data.proposal || res.data.msg,
120+
});
121+
}
122+
} catch (error) {
123+
dispatch(errorHandler(error));
124+
}
125+
};
126+
127+
// GET ALL PROPOSALS
128+
export const getAllProposals = () => async (dispatch) => {
129+
try {
130+
const res = await axios.post("/proposal/all");
131+
dispatch(setRequestStatus(false));
132+
if (res.status === 200) {
133+
dispatch(setRequestStatus(true));
134+
dispatch({
135+
type: GET_ALL_PROPOSALS,
136+
payload: res.data.proposals || res.data.msg,
137+
});
138+
}
139+
} catch (error) {
140+
dispatch(errorHandler(error));
141+
}
142+
};
143+
144+
// GET PROPOSALS BY USER ID
145+
export const getProposalsByUser = (userId) => async (dispatch) => {
146+
try {
147+
const res = await axios.get(`/proposal/user/${userId}`);
148+
dispatch(setRequestStatus(false));
149+
if (res.status === 200) {
150+
dispatch(setRequestStatus(true));
151+
dispatch({
152+
type: GET_USER_PROPOSALS,
153+
payload: res.data.proposal || res.data.msg,
154+
});
155+
}
156+
} catch (error) {
157+
dispatch(errorHandler(error));
158+
}
159+
};

src/actions/types.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
export const GET_CURRENT_USER = "GET_CURRENT_USER";
2-
export const SET_CURRENT_USER = "SET_CURRENT_USER";
3-
export const RESPONSE_MSG = "RESPONSE_MSG";
1+
export const GET_CURRENT_USER = "GET_CURRENT_USER";
2+
export const SET_CURRENT_USER = "SET_CURRENT_USER";
3+
export const RESPONSE_MSG = "RESPONSE_MSG";
44
export const GET_ERRORS = "GET_ERRORS";
55
export const SET_ERROR = "SET_ERROR";
66
export const SET_STATUS = "SET_STATUS";
77
export const GET_PLATFORM_NOTIFICATIONS = "GET_PLATFORM_NOTIFICATIONS";
88
export const GET_USER_NOTIFICATIONS = "GET_USER_NOTIFICATIONS";
9-
export const GET_ALL_NOTIFICATIONS = "GET_ALL_NOTIFICATIONS";
9+
export const GET_PROPOSAL_NOTIFICATIONS = "GET_PROPOSAL_NOTIFICATIONS";
10+
export const GET_USER_PROPOSAL_NOTIFICATIONS =
11+
"GET_USER_PROPOSAL_NOTIFICATIONS";
1012
export const SET_ADMIN = "SET_ADMIN";
1113
export const GET_ALL_UPCOMING_EVENTS = "GET_ALL_UPCOMING_EVENTS";
1214
export const GET_ALL_MEMBERS = "GET_ALL_MEMBERS";
@@ -27,12 +29,18 @@ export const GET_ALL_EVENTS = "GET_ALL_EVENTS";
2729
export const GET_ALL_PROJECTS = "GET_ALL_PROJECTS";
2830
export const GET_ALL_POSTS = "GET_ALL_POSTS";
2931
export const GET_USER_POSTS = "GET_USER_POSTS";
32+
export const CREATE_PROPOSAL = "CREATE_PROPOSAL";
33+
export const GET_PROPOSAL = "GET_PROPOSAL";
34+
export const GET_ALL_PROPOSALS = "GET_ALL_PROPOSALS";
35+
export const EXIT = "EXIT";
36+
export const GET_USER_PROPOSALS = "GET USER PROPOSALS";
3037
export const GET_ALL_PINNED_POSTS = "GET_ALL_PINNED_POSTS";
3138
export const GET_EVENT_BY_ID = "GET_EVENT_BY_ID";
3239
export const GET_ADMIN = "GET_ADMIN";
3340
export const GET_COMMENTS_OF_A_POST = "GET_COMMENTS_OF_A_POST";
3441
export const GET_SINGLE_PROJECT = "GET_SINGLE_PROJECT";
35-
export const PASSWORD_CHANGE_REQUEST_SUCCESS = "PASSWORD_CHANGE_REQUEST_SUCCESS";
42+
export const PASSWORD_CHANGE_REQUEST_SUCCESS =
43+
"PASSWORD_CHANGE_REQUEST_SUCCESS";
3644
export const PASSWORD_SUCCESSFULLY_CHANGED = "PASSWORD_SUCCESSFULLY_CHANGED";
3745
export const GET_INVITE_LINK = "GET_INVITE_LINK";
38-
export const PROCESS_INVITE_LINK = "PROCESS_INVITE_LINK";
46+
export const PROCESS_INVITE_LINK = "PROCESS_INVITE_LINK";

src/reducers/index.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
import { combineReducers } from 'redux';
2-
import authReducers from './authReducer';
3-
import postReducers from './postReducer';
4-
import userReducers from './userReducer';
5-
import errorReducer from './errorReducer';
6-
import requestStatus from './requestStatus';
7-
import notificationReducer from './notificationReducer'
8-
import dashboardReducer from './dashboardReducer'
9-
import insightReducer from './insightReducer';
10-
import orgReducer from './orgReducer';
11-
import eventReducer from './eventReducer';
12-
import projectReducer from './projectReducer';
13-
import adminReducers from './adminReducers';
14-
import commentReducer from './commentReducer';
1+
import { combineReducers } from "redux";
2+
import authReducers from "./authReducer";
3+
import postReducers from "./postReducer";
4+
import userReducers from "./userReducer";
5+
import errorReducer from "./errorReducer";
6+
import requestStatus from "./requestStatus";
7+
import notificationReducer from "./notificationReducer";
8+
import dashboardReducer from "./dashboardReducer";
9+
import insightReducer from "./insightReducer";
10+
import orgReducer from "./orgReducer";
11+
import eventReducer from "./eventReducer";
12+
import projectReducer from "./projectReducer";
13+
import proposalReducer from "./proposalReducer";
14+
import adminReducers from "./adminReducers";
15+
import commentReducer from "./commentReducer";
1516

1617
const rootReducer = combineReducers({
1718
auth: authReducers,
@@ -24,9 +25,10 @@ const rootReducer = combineReducers({
2425
org: orgReducer,
2526
event: eventReducer,
2627
project: projectReducer,
28+
status: requestStatus,
29+
proposal: proposalReducer,
2730
admin: adminReducers,
2831
comment: commentReducer,
29-
status: requestStatus
3032
});
3133

32-
export default rootReducer;
34+
export default rootReducer;

0 commit comments

Comments
 (0)