diff --git a/src/actions/adminAction.js b/src/actions/adminAction.js
index 8a97b2fc..1504e9eb 100644
--- a/src/actions/adminAction.js
+++ b/src/actions/adminAction.js
@@ -1,7 +1,11 @@
import axios from 'axios'
import { errorHandler } from '../utils/errorHandler'
import { setRequestStatus } from '../utils/setRequestStatus'
-import { SET_ADMIN } from './types'
+import { SET_ADMIN, GET_ADMIN } from './types'
+import { setAuthToken } from '../utils/setAuthToken'
+import jwt_decode from 'jwt-decode';
+import { setCurrentUser } from './authAction'
+
export const createAdmin = (adminInfo) => async (dispatch) => {
try {
@@ -9,24 +13,40 @@ export const createAdmin = (adminInfo) => async (dispatch) => {
setRequestStatus(false)
if (res.status === 201) {
setRequestStatus(true)
+ dispatch({
+ type: GET_ADMIN,
+ payload: res.data.user
+ })
}
} catch (error) {
dispatch(errorHandler(error))
}
}
-export const loginAdmin = (adminInfo) => async (dispatch) => {
+export const loginAdmin = (adminInfo, history) => async (dispatch) => {
try {
const res = await axios.post('/auth/login/', adminInfo)
- dispatch(setRequestStatus(false))
- if (res.status === 200) {
- dispatch(setRequestStatus(true))
- localStorage.setItem('admin', true)
- dispatch({
- type: SET_ADMIN,
- payload: true
- })
- }
+ dispatch(setRequestStatus(false));
+ if (res.status === 200) {
+
+ const token = res.data.token;
+ dispatch(setRequestStatus(true));
+
+ localStorage.setItem("jwtToken", JSON.stringify(token));
+ setAuthToken(token);
+
+ // update state with user
+ const decodedData = await jwt_decode(token);
+ localStorage.setItem('userId', decodedData._id)
+ dispatch(setCurrentUser(decodedData));
+
+ dispatch({
+ type: SET_ADMIN,
+ payload: true
+ })
+
+ history.push("/dashboard");
+ }
} catch (error) {
dispatch(errorHandler(error))
}
diff --git a/src/actions/authAction.js b/src/actions/authAction.js
index 270d7b6e..543bb639 100644
--- a/src/actions/authAction.js
+++ b/src/actions/authAction.js
@@ -1,4 +1,4 @@
-import { SET_CURRENT_USER } from './types';
+import { SET_CURRENT_USER, GET_USER_PROFILE, PASSWORD_SUCCESSFULLY_CHANGED, PASSWORD_CHANGE_REQUEST_SUCCESS } from './types';
import axios from 'axios';
import { setAuthToken } from '../utils/setAuthToken';
import jwt_decode from 'jwt-decode';
@@ -14,6 +14,10 @@ export const registerUser = (userInfo, history) => async (dispatch) => {
if(res.status === 201) {
dispatch(setRequestStatus(true));
+ dispatch({
+ type: GET_USER_PROFILE,
+ payload: res.data.user
+ })
history.push('/');
}
@@ -53,13 +57,17 @@ export const loginUser = (userInfo, history) => async (dispatch) => {
// forgot password
export const forgotPassword = (email) => async (dispatch) => {
try {
- const res = await axios.post('/user/password_reset', email);
+ const res = await axios.patch('/user/password_reset/request/', email);
dispatch(setRequestStatus(false));
if(res.status === 200){
dispatch(setRequestStatus(true));
console.log("Forgot password request sent!!");
forgotPasswordToken = res.data.token;
+ dispatch({
+ type: PASSWORD_CHANGE_REQUEST_SUCCESS,
+ payload: res.data.token
+ })
}
} catch (error) {
@@ -70,13 +78,17 @@ export const forgotPassword = (email) => async (dispatch) => {
// update password
export const changePassword = (passObj) => async (dispatch) => {
try {
- const res = await axios.post(`/user/password_reset/${forgotPasswordToken}`, passObj);
+ const res = await axios.patch(`/user/password_reset/${forgotPasswordToken}`, passObj);
dispatch(setRequestStatus(false));
if(res.status === 200){
dispatch(setRequestStatus(true));
console.log("Password updated!", res.data);
// show password updated notification from here
+ dispatch({
+ type: PASSWORD_SUCCESSFULLY_CHANGED,
+ payload: res.data.updated
+ })
}
} catch(error) {
diff --git a/src/actions/commentAction.js b/src/actions/commentAction.js
new file mode 100644
index 00000000..94e9fe99
--- /dev/null
+++ b/src/actions/commentAction.js
@@ -0,0 +1,67 @@
+import { GET_COMMENTS_OF_A_POST } from './types'
+import { errorHandler } from '../utils/errorHandler'
+import axios from 'axios'
+import { setRequestStatus } from '../utils/setRequestStatus'
+
+// CREATE COMMENT ON A PARTICULAR POST
+export const createComment = (postId, comment) => async (dispatch) => {
+ try {
+ const res = await axios.post(`/comment/${postId}`, comment)
+ dispatch(setRequestStatus(false));
+ if(res.status === 201) {
+ dispatch(setRequestStatus(true))
+ console.log('created comment ', res.data.comment)
+ dispatch(getAllCommentsOfPost());
+ }
+ } catch(error) {
+ dispatch(errorHandler(error))
+ }
+}
+
+// GET ALL COMMENTS OF A POST
+export const getAllCommentsOfPost = (postId) => async (dispatch) => {
+ try {
+ const res = await axios.get(`/comment/${postId}`)
+ dispatch(setRequestStatus(false))
+ if(res.status === 200) {
+ dispatch(setRequestStatus(true));
+ console.log('fetching comments of ', postId, res.data.comments);
+ dispatch({
+ type: GET_COMMENTS_OF_A_POST,
+ payload: res.data.comments
+ })
+ }
+ } catch(error) {
+ dispatch(errorHandler(error))
+ }
+}
+
+// UPDATE COMMENT OF A POST
+export const updateComment = (commentId, updatedComment) => async (dispatch) => {
+ try {
+ const res = await axios.patch(`/comment/${commentId}`, updatedComment)
+ dispatch(setRequestStatus(false))
+ if(res.status === 200) {
+ dispatch(setRequestStatus(true))
+ console.log('comment updated ', res.data.comment)
+ dispatch(getAllCommentsOfPost())
+ }
+ } catch(error) {
+ errorHandler(error)
+ }
+}
+
+// DELETE COMMENT
+export const deleteComment = (commentId) => async (dispatch) => {
+ try {
+ const res = await axios.delete(`/comment/${commentId}`)
+ dispatch(setRequestStatus(false))
+ if(res.status === 200) {
+ dispatch(setRequestStatus(true));
+ console.log('comment deleted ', res.data)
+ dispatch(getAllCommentsOfPost())
+ }
+ } catch(error) {
+ dispatch(errorHandler(error))
+ }
+}
\ No newline at end of file
diff --git a/src/actions/dashboardAction.js b/src/actions/dashboardAction.js
index 8076881f..d47cb95d 100644
--- a/src/actions/dashboardAction.js
+++ b/src/actions/dashboardAction.js
@@ -2,6 +2,9 @@ import axios from 'axios'
import { setRequestStatus } from '../utils/setRequestStatus'
import { errorHandler } from '../utils/errorHandler'
import { GET_ALL_UPCOMING_EVENTS } from './types'
+import { getAllEvents } from './eventAction'
+import { getAllPosts } from './postAction'
+import { getAllProjects } from './projectAction'
// GET UPCOMING EVENTS
export const upcomingEvents = () => async (dispatch) => {
@@ -29,6 +32,7 @@ export const createPost = (postInfo) => async (dispatch) => {
if (res.status === 201) {
dispatch(setRequestStatus(true))
console.log('post created ', res.data)
+ dispatch(getAllPosts())
}
} catch (error) {
dispatch(errorHandler(error))
@@ -43,6 +47,7 @@ export const createEvent = (eventInfo) => async (dispatch) => {
if (res.status === 201) {
dispatch(setRequestStatus(true))
console.log('event created ', res.data)
+ dispatch(getAllEvents())
}
} catch (error) {
dispatch(errorHandler(error))
@@ -58,6 +63,7 @@ export const createProject = (projectInfo) => async (dispatch) => {
if (res.status === 201) {
dispatch(setRequestStatus(true))
console.log('project created ', res.data)
+ dispatch(getAllProjects())
}
} catch (error) {
dispatch(errorHandler(error))
diff --git a/src/actions/eventAction.js b/src/actions/eventAction.js
index 72ac4069..5aa603a6 100644
--- a/src/actions/eventAction.js
+++ b/src/actions/eventAction.js
@@ -1,7 +1,7 @@
import axios from 'axios';
import { errorHandler } from '../utils/errorHandler';
import { setRequestStatus } from '../utils/setRequestStatus';
-import { GET_ALL_EVENTS } from './types';
+import { GET_ALL_EVENTS, GET_EVENT_BY_ID } from './types';
// DELETE EVENT REQUEST
export const deleteEvent = (eventId) => async (dispatch) => {
@@ -10,6 +10,7 @@ export const deleteEvent = (eventId) => async (dispatch) => {
dispatch(setRequestStatus(false));
if(res.status === 200){
dispatch(setRequestStatus(true));
+ dispatch(getAllEvents())
}
} catch(error) {
dispatch(errorHandler(error))
@@ -23,6 +24,7 @@ export const updateEvent = (eventId, updatedInfo) => async (dispatch) => {
dispatch(setRequestStatus(false));
if(res.status === 200){
dispatch(setRequestStatus(true));
+ dispatch(getAllEvents())
}
} catch(error) {
dispatch(errorHandler(error))
@@ -60,3 +62,22 @@ export const getAllEvents = (pagination = 10, page = 1) => async (dispatch) => {
dispatch(errorHandler(error))
}
}
+
+// GET EVENT BY ID
+export const getEventById = (eventId) => async (dispatch) => {
+ try {
+ console.log('fetching event ', eventId)
+ const res = await axios.get(`/event/${eventId}`)
+ dispatch(setRequestStatus(false))
+ if(res.status === 200){
+ dispatch(setRequestStatus(true))
+ console.log('fetching event by id ', res.data.event)
+ dispatch({
+ type: GET_EVENT_BY_ID,
+ payload: res.data.event
+ })
+ }
+ } catch(error) {
+ dispatch(errorHandler(error))
+ }
+}
\ No newline at end of file
diff --git a/src/actions/orgAction.js b/src/actions/orgAction.js
index b46aa774..15a44800 100644
--- a/src/actions/orgAction.js
+++ b/src/actions/orgAction.js
@@ -11,6 +11,7 @@ export const registerCommunity = (orgInfo) => async (dispatch) => {
if (res.status === 201) {
dispatch(setRequestStatus(true))
localStorage.setItem('orgId', JSON.stringify(res.data.org._id))
+ dispatch(getOrgProfile())
}
} catch (error) {
dispatch(errorHandler(error))
@@ -61,15 +62,17 @@ export const getOrgProfile = () => async (dispatch) => {
export const updateOrgProfile = (updatedInfo) => async (dispatch) => {
try {
let orgId = localStorage.getItem('orgId')
+ console.log('updatedInfo ', updatedInfo);
const res = await axios.patch(`/org/${orgId}`, updatedInfo)
dispatch(setRequestStatus(false));
if(res.status === 200) {
dispatch(setRequestStatus(true))
console.log('org profile updated!', res.data)
- dispatch({
- type: UPDATE_ORG_PROFILE,
- payload: res.data.organization
- })
+ dispatch(getOrgProfile());
+ // dispatch({
+ // type: UPDATE_ORG_PROFILE,
+ // payload: res.data.organization
+ // })
}
} catch(error) {
dispatch(errorHandler(error))
diff --git a/src/actions/postAction.js b/src/actions/postAction.js
index 6ca6e777..f5b56f8c 100644
--- a/src/actions/postAction.js
+++ b/src/actions/postAction.js
@@ -1,7 +1,7 @@
import axios from 'axios';
import { errorHandler } from '../utils/errorHandler';
import { setRequestStatus } from '../utils/setRequestStatus';
-import { GET_ALL_POSTS } from './types';
+import { GET_ALL_POSTS, GET_ALL_PINNED_POSTS } from './types';
// GET ALL POSTS
export const getAllPosts = (pagination = 10, page = 1) => async (dispatch) => {
@@ -21,3 +21,20 @@ export const getAllPosts = (pagination = 10, page = 1) => async (dispatch) => {
}
}
+// GET ALL PINNED POSTS
+export const getAllPinnedPosts = (pagination = 10, page = 1) => async (dispatch) => {
+ try {
+ const res = await axios.get(`/post/all/pinned?pagination=${pagination}&page=${page}`)
+ dispatch(setRequestStatus(false))
+ if(res.status === 200){
+ dispatch(setRequestStatus(true))
+ console.log('fetching all pinned posts ', res.data.pinnedPost)
+ dispatch({
+ type: GET_ALL_PINNED_POSTS,
+ payload: res.data.pinnedPost
+ })
+ }
+ } catch(error) {
+ dispatch(errorHandler(error))
+ }
+}
\ No newline at end of file
diff --git a/src/actions/projectAction.js b/src/actions/projectAction.js
index f21d3c34..ffa6594b 100644
--- a/src/actions/projectAction.js
+++ b/src/actions/projectAction.js
@@ -1,7 +1,7 @@
import axios from 'axios';
import { errorHandler } from '../utils/errorHandler';
import { setRequestStatus } from '../utils/setRequestStatus';
-import { GET_ALL_PROJECTS } from './types';
+import { GET_ALL_PROJECTS, GET_SINGLE_PROJECT } from './types';
// CREATE PROJECT
export const createProject = (projectInfo) => async (dispatch) => {
@@ -34,4 +34,56 @@ export const getAllProjects = (pagination = 10, page = 1) => async (dispatch) =>
} catch(error) {
dispatch(errorHandler(error))
}
-}
\ No newline at end of file
+}
+
+// GET PROJECT BY ID
+export const getProjectById = (projectId) => async (dispatch) => {
+ try {
+ const res = await axios.get(`/project/${projectId}`)
+ dispatch(setRequestStatus(false))
+ if(res.status === 200) {
+ dispatch(setRequestStatus(true));
+ dispatch({
+ type: GET_SINGLE_PROJECT,
+ payload: res.data.project
+ })
+ }
+ } catch(error) {
+ dispatch(errorHandler(error))
+ }
+}
+
+// UPDATE PROJECT
+export const updateProject = (projectId, updatedInfo) => async (dispatch) => {
+ try {
+ const res = await axios.patch(`/project/${projectId}`, updatedInfo)
+ dispatch(setRequestStatus(false))
+ if(res.status === 200) {
+ dispatch(setRequestStatus(true));
+ console.log('updated project info ', res.data)
+ dispatch({
+ type: GET_SINGLE_PROJECT,
+ payload: res.data.project
+ })
+ }
+ } catch(error) {
+ dispatch(errorHandler(error))
+ }
+}
+
+// DELETE PROJECT BY ID
+export const deleteProjectById = (projectId, history) => async (dispatch) => {
+ try {
+ const res = await axios.delete(`/project/${projectId}`)
+ dispatch(setRequestStatus(false))
+ if(res.status === 200) {
+ dispatch(setRequestStatus(true))
+ console.log('Project deleted', res.data.msg);
+ // window.location.href = '/projects'
+ // dispatch(getAllProjects())
+ history.push('/projects');
+ }
+ } catch(error) {
+ dispatch(errorHandler(error))
+ }
+}
diff --git a/src/actions/types.js b/src/actions/types.js
index ca25eeac..cdcbc38d 100644
--- a/src/actions/types.js
+++ b/src/actions/types.js
@@ -26,4 +26,13 @@ export const GET_USER_PROJECTS = "GET_USER_PROJECTS";
export const GET_ALL_EVENTS = "GET_ALL_EVENTS";
export const GET_ALL_PROJECTS = "GET_ALL_PROJECTS";
export const GET_ALL_POSTS = "GET_ALL_POSTS";
-export const GET_USER_POSTS = "GET_USER_POSTS";
\ No newline at end of file
+export const GET_USER_POSTS = "GET_USER_POSTS";
+export const GET_ALL_PINNED_POSTS = "GET_ALL_PINNED_POSTS";
+export const GET_EVENT_BY_ID = "GET_EVENT_BY_ID";
+export const GET_ADMIN = "GET_ADMIN";
+export const GET_COMMENTS_OF_A_POST = "GET_COMMENTS_OF_A_POST";
+export const GET_SINGLE_PROJECT = "GET_SINGLE_PROJECT";
+export const PASSWORD_CHANGE_REQUEST_SUCCESS = "PASSWORD_CHANGE_REQUEST_SUCCESS";
+export const PASSWORD_SUCCESSFULLY_CHANGED = "PASSWORD_SUCCESSFULLY_CHANGED";
+export const GET_INVITE_LINK = "GET_INVITE_LINK";
+export const PROCESS_INVITE_LINK = "PROCESS_INVITE_LINK";
\ No newline at end of file
diff --git a/src/actions/usersAction.js b/src/actions/usersAction.js
index 149456e0..14fbe450 100644
--- a/src/actions/usersAction.js
+++ b/src/actions/usersAction.js
@@ -1,4 +1,4 @@
-import { GET_USER_PROFILE, GET_ALL_MEMBERS, UPDATE_USER_PROFILE, GET_USER_EVENTS, GET_USER_PROJECTS, GET_USER_POSTS } from './types'
+import { GET_USER_PROFILE, GET_ALL_MEMBERS, UPDATE_USER_PROFILE, GET_USER_EVENTS, GET_USER_PROJECTS, GET_USER_POSTS, GET_INVITE_LINK, PROCESS_INVITE_LINK } from './types'
import { errorHandler } from '../utils/errorHandler'
import axios from 'axios'
import { setRequestStatus } from '../utils/setRequestStatus'
@@ -158,3 +158,39 @@ export const getPostsCreatedByUser = (pagination = 10, page = 1) => async (dispa
dispatch(errorHandler(error))
}
}
+
+// GET INVITE LINK
+export const getInviteLink = () => async (dispatch) => {
+ try {
+ const res = await axios.get('/user/invite')
+ dispatch(setRequestStatus(false));
+ if(res.status === 200) {
+ dispatch(setRequestStatus(true));
+ console.log('Fetching invite link ', res.data.inviteLink)
+ dispatch({
+ type: GET_INVITE_LINK,
+ payload: res.data.inviteLink
+ })
+ }
+ } catch (error) {
+ dispatch(errorHandler(error))
+ }
+}
+
+// PROCESS INVITE LINK
+export const processInviteToken = (token) => async (dispatch) => {
+ try {
+ const res = await axios.get(`/user/invite/${token}`)
+ dispatch(setRequestStatus(false));
+ if(res.status === 200) {
+ dispatch(setRequestStatus(true))
+ console.log('Processing the invite link ', res.data);
+ dispatch({
+ type: PROCESS_INVITE_LINK,
+ payload: res.data.success || res.data.msg
+ })
+ }
+ } catch(error) {
+ dispatch(errorHandler(error));
+ }
+}
\ No newline at end of file
diff --git a/src/auth/login-form/login-form.js b/src/auth/login-form/login-form.js
index 317d817f..f6cea6f4 100644
--- a/src/auth/login-form/login-form.js
+++ b/src/auth/login-form/login-form.js
@@ -68,8 +68,6 @@ class LoginForm extends Component {
};
render() {
- const { email, password, error, isValidForm, isValidEmail } = this.state;
-
const handleToggle = (e) => {
const targetName = e.target.name;
this.setState({
diff --git a/src/auth/signup-form/signup-form.js b/src/auth/signup-form/signup-form.js
index bdcd1758..85843061 100644
--- a/src/auth/signup-form/signup-form.js
+++ b/src/auth/signup-form/signup-form.js
@@ -1,8 +1,6 @@
import React, { Component } from "react";
import { Form, Button, Row, Col } from "react-bootstrap";
-import { TextField } from "@material-ui/core";
import "./signup-form.scss";
-import Grid from "@material-ui/core/Grid";
import { makeStyles } from "@material-ui/core/styles";
import { connect } from "react-redux";
import { registerUser } from "../../actions/authAction";
@@ -172,9 +170,9 @@ class SignUpForm extends Component {
isValidEmail,
isValidPhone,
isValidDesc,
- isMatched,
- isValidForm,
- error,
+ // isMatched,
+ // isValidForm,
+ // error,
} = this.state;
return (
diff --git a/src/common/Popups.js b/src/common/Popups.js
index 89c950ab..b23399ed 100644
--- a/src/common/Popups.js
+++ b/src/common/Popups.js
@@ -5,6 +5,8 @@ import { MdVerifiedUser } from 'react-icons/md';
import { FaUserSlash } from 'react-icons/fa';
import { connect } from 'react-redux';
import { forgotPassword, changePassword } from '../actions/authAction';
+import { ToastContainer, toast } from "react-toastify";
+import "react-toastify/dist/ReactToastify.css";
class Popups extends Component {
constructor(props){
@@ -20,16 +22,26 @@ class Popups extends Component {
option: "",
optionValue: "",
newPass: "",
- cnfPass: ""
+ cnfPass: "",
+ requested: false
}
}
componentWillReceiveProps(nextProps){
+ console.log('nextProps in common ', nextProps)
this.setState({
show: nextProps.modalShow,
option: nextProps.option,
optionValue: nextProps.optionValue
});
+ const { currentStep, requested } = this.state
+ if (nextProps.auth.resetPassReq !== null && requested) {
+ toast.success('Link sent to your registered email!')
+ let step = currentStep >= 2 ? 2 : currentStep + 1
+ this.setState({
+ currentStep: step
+ })
+ }
}
handleClose = () => {
@@ -54,8 +66,8 @@ class Popups extends Component {
changePassword = (e) => {
e.preventDefault();
- const { newPass } = this.state;
- const { auth, changePassword, status } = this.props;
+ const { newPass, success } = this.state;
+ const { auth, changePassword } = this.props;
const passObj = {
password: newPass,
@@ -66,30 +78,21 @@ class Popups extends Component {
changePassword(passObj);
// show notification on sidebar if done successfully
- if(status.success) {
+ if(success) {
console.log("Successfully changed the password!");
}
}
forgotPasswordRequest = () => {
const { email } = this.state;
- const { forgotPassword, status } = this.props;
+ const { forgotPassword } = this.props;
console.log("forgot password request sending...")
- forgotPassword(email);
-
- let { currentStep } = this.state;
- // move to next step if forgot password request successful
- if(status.success){
- currentStep = currentStep >= 2 ? 2 : currentStep + 1
- this.setState({
- currentStep: currentStep
- })
- } else {
- // show error message in popup
- console.log("Something went wrong!!");
+ const emailObj = {
+ email: email
}
-
+ this.setState({ requested: true })
+ forgotPassword(emailObj);
}
@@ -305,12 +308,25 @@ function Step2(props) {
if (props.currentStep !== 2) {
return null
}
- return(
+ return (
-
-
-
-
+
+
+
+
);
}
diff --git a/src/css/components/_modals.scss b/src/css/components/_modals.scss
index 3892bb60..47702b99 100644
--- a/src/css/components/_modals.scss
+++ b/src/css/components/_modals.scss
@@ -30,9 +30,18 @@
letter-spacing: 0.2em;
padding-top: 5px;
}
+ .search_btn {
+ width: 6vw;
+ height: 5vh;
+ background: rgb(250, 251, 252);
+ border-radius: 100px;
+ color: #1A73E8;
+ padding: 0.3em;
+ margin-left: 1em;
+ }
}
.modal__search {
- width: 100%;
+ width: 50%;
border: 1px solid #cccccc;
box-sizing: border-box;
border-radius: 5px;
@@ -201,7 +210,7 @@
border-radius: 20px;
margin-top: 15px;
margin-bottom: 10px;
- justify-content: center;
+ margin-left: 10px;
align-items: center;
.member__image {
border: 1px solid #e6e6e5;
@@ -214,6 +223,7 @@
.member__content {
padding-left: 10px;
padding-right: 10px;
+ margin-right: 40px;
width: 50%;
}
diff --git a/src/reducers/adminReducers.js b/src/reducers/adminReducers.js
new file mode 100644
index 00000000..e015d7ce
--- /dev/null
+++ b/src/reducers/adminReducers.js
@@ -0,0 +1,19 @@
+import { SET_ADMIN } from '../actions/types'
+const initialState = {
+ isAdmin: false,
+ admin: {}
+}
+
+export default (state = initialState, action) => {
+ switch(action.type) {
+ case SET_ADMIN: {
+ return {
+ ...state,
+ isAdmin: action.payload
+ }
+ }
+ default: {
+ return state
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/reducers/authReducer.js b/src/reducers/authReducer.js
index 7320b181..5a4b7b16 100644
--- a/src/reducers/authReducer.js
+++ b/src/reducers/authReducer.js
@@ -1,4 +1,4 @@
-import { SET_CURRENT_USER, RESPONSE_MSG, SET_ADMIN, BLOCK_USER, UNBLOCK_USER, REMOVE_USER } from "../actions/types"
+import { SET_CURRENT_USER, RESPONSE_MSG, SET_ADMIN, BLOCK_USER, UNBLOCK_USER, REMOVE_USER, PASSWORD_CHANGE_REQUEST_SUCCESS, PASSWORD_SUCCESSFULLY_CHANGED } from "../actions/types"
const initialState = {
// make it false later, default is set to true so that contributors don't need to login for test
@@ -6,6 +6,8 @@ const initialState = {
isAdmin: false,
isBlocked: false,
isRemoved: false,
+ resetPassReq: null,
+ passUpdated: false,
user: {},
response_msg: ""
}
@@ -19,6 +21,18 @@ export default (state = initialState, action) => {
user: action.payload
}
}
+ case PASSWORD_CHANGE_REQUEST_SUCCESS: {
+ return {
+ ...state,
+ resetPassReq: action.payload
+ }
+ }
+ case PASSWORD_SUCCESSFULLY_CHANGED: {
+ return {
+ ...state,
+ passUpdated: action.payload
+ }
+ }
case BLOCK_USER: {
return {
...state,
diff --git a/src/reducers/commentReducer.js b/src/reducers/commentReducer.js
new file mode 100644
index 00000000..db8cd306
--- /dev/null
+++ b/src/reducers/commentReducer.js
@@ -0,0 +1,19 @@
+import { GET_COMMENTS_OF_A_POST } from '../actions/types'
+
+const initialState = {
+ allComments: []
+}
+
+export default (state = initialState, action) => {
+ switch(action.type) {
+ case GET_COMMENTS_OF_A_POST: {
+ return {
+ ...state,
+ allComments: action.payload
+ }
+ }
+ default: {
+ return state
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/reducers/eventReducer.js b/src/reducers/eventReducer.js
index e4873061..cab7f108 100644
--- a/src/reducers/eventReducer.js
+++ b/src/reducers/eventReducer.js
@@ -1,6 +1,7 @@
-import { GET_ALL_EVENTS } from '../actions/types'
+import { GET_ALL_EVENTS, GET_EVENT_BY_ID } from '../actions/types'
const initialState = {
- allEvents: []
+ allEvents: [],
+ event: {}
}
export default (state = initialState, action) => {
@@ -11,6 +12,12 @@ export default (state = initialState, action) => {
allEvents: action.payload
}
}
+ case GET_EVENT_BY_ID: {
+ return {
+ ...state,
+ event: action.payload
+ }
+ }
default:{
return state
}
diff --git a/src/reducers/index.js b/src/reducers/index.js
index 360c5d2b..250d51d9 100644
--- a/src/reducers/index.js
+++ b/src/reducers/index.js
@@ -10,6 +10,8 @@ import insightReducer from './insightReducer';
import orgReducer from './orgReducer';
import eventReducer from './eventReducer';
import projectReducer from './projectReducer';
+import adminReducers from './adminReducers';
+import commentReducer from './commentReducer';
const rootReducer = combineReducers({
auth: authReducers,
@@ -22,6 +24,8 @@ const rootReducer = combineReducers({
org: orgReducer,
event: eventReducer,
project: projectReducer,
+ admin: adminReducers,
+ comment: commentReducer,
status: requestStatus
});
diff --git a/src/reducers/postReducer.js b/src/reducers/postReducer.js
index 0975ac3a..aa70b762 100644
--- a/src/reducers/postReducer.js
+++ b/src/reducers/postReducer.js
@@ -1,6 +1,7 @@
-import { GET_ALL_POSTS } from '../actions/types'
+import { GET_ALL_POSTS, GET_ALL_PINNED_POSTS } from '../actions/types'
const initialState = {
- allPosts: []
+ allPosts: [],
+ pinnedPosts: []
}
export default (state = initialState, action) => {
@@ -11,6 +12,12 @@ export default (state = initialState, action) => {
allPosts: action.payload
}
}
+ case GET_ALL_PINNED_POSTS: {
+ return {
+ ...state,
+ pinnedPosts: action.payload
+ }
+ }
default:{
return state
}
diff --git a/src/reducers/projectReducer.js b/src/reducers/projectReducer.js
index 73b37577..790b563b 100644
--- a/src/reducers/projectReducer.js
+++ b/src/reducers/projectReducer.js
@@ -1,6 +1,7 @@
-import { GET_ALL_PROJECTS } from '../actions/types'
+import { GET_ALL_PROJECTS, GET_SINGLE_PROJECT } from '../actions/types'
const initialState = {
- allProjects: []
+ allProjects: [],
+ singleProject: {}
}
export default (state = initialState, action) => {
@@ -11,6 +12,12 @@ export default (state = initialState, action) => {
allProjects: action.payload
}
}
+ case GET_SINGLE_PROJECT: {
+ return {
+ ...state,
+ singleProject: action.payload
+ }
+ }
default:{
return state
}
diff --git a/src/reducers/userReducer.js b/src/reducers/userReducer.js
index 1448b093..0bbf1ed0 100644
--- a/src/reducers/userReducer.js
+++ b/src/reducers/userReducer.js
@@ -1,9 +1,10 @@
-import { GET_USER_PROFILE, UPDATE_USER_PROFILE, GET_USER_EVENTS, GET_USER_PROJECTS, GET_USER_POSTS } from '../actions/types'
+import { GET_USER_PROFILE, UPDATE_USER_PROFILE, GET_USER_EVENTS, GET_USER_PROJECTS, GET_USER_POSTS, GET_INVITE_LINK } from '../actions/types'
const initialState = {
userProfile: {},
userEvents: [],
userProjects: [],
- userPosts: []
+ userPosts: [],
+ inviteLink: ''
}
export default (state = initialState, action) => {
@@ -38,6 +39,12 @@ export default (state = initialState, action) => {
userProfile: action.payload
}
}
+ case GET_INVITE_LINK: {
+ return {
+ ...state,
+ inviteLink: action.payload
+ }
+ }
default: {
return state
}
diff --git a/src/user/Admin/Admin.js b/src/user/Admin/Admin.js
index 166af92d..ede675bf 100644
--- a/src/user/Admin/Admin.js
+++ b/src/user/Admin/Admin.js
@@ -1,11 +1,12 @@
import React, { Component } from 'react'
-import { Form, Button, Col, Row } from 'react-bootstrap'
+import { Button } from 'react-bootstrap'
import './register.scss'
import SmallDonut from '../../images/small_donut.png'
import ExtraDonuts from '../../images/extra-donuts.png'
import DonutShadow from '../../images/shadow.png'
import Register from './components/Register'
import Login from './components/Login'
+import { connect } from 'react-redux'
class Admin extends Component {
constructor(props) {
@@ -20,11 +21,13 @@ class Admin extends Component {
view: 'register'
}
}
+
toggleView = (name) => {
this.setState({ view: name })
}
+
render() {
- const { email, name, password, cnfPass, register, setup, activate, login, view } = this.state;
+ const { view } = this.state;
let adminEmailVerification = (
@@ -100,4 +103,11 @@ class Admin extends Component {
);
}
}
-export default Admin;
\ No newline at end of file
+// map state to props
+const mapStateToProps = (state) => ({
+ auth: state.auth,
+ error: state.error,
+ admin: state.admin
+})
+
+export default connect(mapStateToProps)(Admin);
\ No newline at end of file
diff --git a/src/user/Admin/components/Login.js b/src/user/Admin/components/Login.js
index 28031778..ddf47610 100644
--- a/src/user/Admin/components/Login.js
+++ b/src/user/Admin/components/Login.js
@@ -1,14 +1,44 @@
import React, { Component } from 'react'
import { Form, Button } from 'react-bootstrap'
+import { connect } from 'react-redux';
+import { loginAdmin } from '../../../actions/adminAction'
+import { withRouter } from 'react-router-dom'
class Login extends Component {
constructor(props) {
super(props);
this.state = {
register: false,
+ email: '',
+ password: ''
};
}
+
+ componentWillReceiveProps(nextProps) {
+ console.log('login nextProps', nextProps)
+ }
+
+ loginAdmin = (e) => {
+ e.preventDefault()
+ const { email, password } = this.state
+ const info = {
+ email: email,
+ password: password
+ }
+ console.log('admin login', info)
+ this.props.loginAdmin(info, this.props.history)
+ if(this.props.status.success) {
+ this.props.toggle('setup')
+ }
+ }
+
+ onChange = (e) => {
+ const { name, value } = e.target
+ this.setState({ [name]: value })
+ }
+
render() {
+ const { email, password } = this.state
return (
@@ -28,6 +58,7 @@ class Login extends Component {
type="email"
placeholder="abc@gmail.com"
name="email"
+ defaultValue={email}
onChange={this.onChange}
/>
@@ -38,6 +69,7 @@ class Login extends Component {
type="password"
placeholder="***********"
name="password"
+ defaultValue={password}
onChange={this.onChange}
/>
@@ -48,7 +80,7 @@ class Login extends Component {
type="submit"
variant="primary"
color="primary"
- onClick={() => this.props.toggle('setup')}
+ onClick={this.loginAdmin}
>
Login as an Admin
@@ -64,4 +96,12 @@ class Login extends Component {
}
}
-export default Login;
\ No newline at end of file
+// map state to props
+const mapStateToProps = (state) => ({
+ auth: state.auth,
+ error: state.error,
+ admin: state.admin,
+ status: state.status
+})
+
+export default connect(mapStateToProps, { loginAdmin })(withRouter(Login));
\ No newline at end of file
diff --git a/src/user/Admin/components/Register.js b/src/user/Admin/components/Register.js
index 076ff758..4bc96569 100644
--- a/src/user/Admin/components/Register.js
+++ b/src/user/Admin/components/Register.js
@@ -1,17 +1,51 @@
import React, { Component } from 'react'
-import { Form, Button} from 'react-bootstrap'
+import { Form, Button, Row, Col } from 'react-bootstrap'
+import { connect } from 'react-redux';
+import { createAdmin } from '../../../actions/adminAction'
class Register extends Component {
constructor(props) {
super(props);
this.state = {
- login: false
- }
+ login: false,
+ firstName: "",
+ lastName: "",
+ email: "",
+ password: "",
+ cnfPass: "",
+ };
}
- gotoLogin = () => {
+ componentWillReceiveProps(nextProps) {
+ console.log("Register admin nextProps ", nextProps);
}
+
+ onChange = (e) => {
+ const { name, value } = e.target;
+ this.setState({ [name]: value });
+ };
+
+ registerAdmin = (e) => {
+ e.preventDefault();
+ const { firstName, lastName, email, password } = this.state;
+ const info = {
+ name: {
+ firstName: firstName,
+ lastName: lastName,
+ },
+ email: email,
+ password: password,
+ isAdmin: true,
+ };
+ console.log("registering admin", info);
+ this.props.createAdmin(info)
+ if (this.props.status.success) {
+ this.props.toggle("activate");
+ }
+ };
+
render() {
+ const { firstName, lastName, email, password, cnfPass } = this.state;
return (
@@ -31,21 +65,38 @@ class Register extends Component {
type="email"
placeholder="abc@gmail.com"
name="email"
+ defaultValue={email}
onChange={this.onChange}
/>
-
-
- Admin Name
-
-
-
+
+
+
+ First Name
+
+
+
+
+
+ Last Name
+
+
+
+
Password
@@ -65,6 +117,7 @@ class Register extends Component {
type="password"
placeholder="***********"
name="cnfPass"
+ defaultValue={cnfPass}
onChange={this.onChange}
/>
@@ -75,13 +128,16 @@ class Register extends Component {
type="submit"
variant="primary"
color="primary"
- onClick={() => this.props.toggle('activate')}
+ onClick={this.registerAdmin}
>
Register as an Admin
-
this.props.toggle('login')}>
- Don't have an account?
+
this.props.toggle("login")}
+ >
+ Already have an account?
Login
@@ -90,4 +146,13 @@ class Register extends Component {
);
}
}
-export default Register;
+
+// map state to props
+const mapStateToProps = (state) => ({
+ auth: state.auth,
+ error: state.error,
+ admin: state.admin,
+ status: state.status
+})
+
+export default connect(mapStateToProps, { createAdmin })(Register);
diff --git a/src/user/dashboard/Community/CommunitySetting.js b/src/user/dashboard/Community/CommunitySetting.js
index 798c75cc..044c14a0 100644
--- a/src/user/dashboard/Community/CommunitySetting.js
+++ b/src/user/dashboard/Community/CommunitySetting.js
@@ -1,5 +1,4 @@
import React, { Component } from 'react'
-import { Modal, Button} from 'react-bootstrap'
import LeftNav from './LeftNav'
import './community.scss'
import OrgProfile from './components/OrgProfile';
diff --git a/src/user/dashboard/Community/LeftNav.js b/src/user/dashboard/Community/LeftNav.js
index 359a848c..fec66ca5 100644
--- a/src/user/dashboard/Community/LeftNav.js
+++ b/src/user/dashboard/Community/LeftNav.js
@@ -1,6 +1,5 @@
import React, { Component } from "react";
-import { ListGroup, Button } from "react-bootstrap";
-import { NavLink } from "react-router-dom";
+import { ListGroup } from "react-bootstrap";
import PropTypes from "prop-types";
import "./navigation.scss";
diff --git a/src/user/dashboard/Community/components/OrgAuth.js b/src/user/dashboard/Community/components/OrgAuth.js
index df436819..4a420afc 100644
--- a/src/user/dashboard/Community/components/OrgAuth.js
+++ b/src/user/dashboard/Community/components/OrgAuth.js
@@ -33,6 +33,7 @@ class OrgAuth extends Component {
gitlab
}
}
+ console.log('updating auth settings ', info);
this.props.updateSettings(info)
}
@@ -45,17 +46,25 @@ class OrgAuth extends Component {
const { authentication } = nextProps.org.org.options;
console.log("authentication ", authentication);
const { email, google, github, gitlab } = authentication;
- this.setState({ email, google, github, gitlab }, () => {
+ this.setState({
+ email,
+ google,
+ github,
+ gitlab,
+ error: nextProps.error.msg
+ }, () => {
console.log("updated state", this.state);
});
- this.setState({ error: nextProps.error.msg }, () => {
- console.log('state ', this.state)
- })
}
-
render() {
- const { email, github, gitlab, google, error } = this.state
+ const {
+ email,
+ github,
+ gitlab,
+ google,
+ // error
+ } = this.state
return (
diff --git a/src/user/dashboard/Community/components/OrgPermission.js b/src/user/dashboard/Community/components/OrgPermission.js
index f8e8beef..1c564a6e 100644
--- a/src/user/dashboard/Community/components/OrgPermission.js
+++ b/src/user/dashboard/Community/components/OrgPermission.js
@@ -60,12 +60,18 @@ class OrgPermission extends Component {
}
render() {
- const { canChangeEmail, canChangeName, sendInvite, canCreateManage, error } = this.state
+ const {
+ canChangeEmail,
+ canChangeName,
+ sendInvite,
+ canCreateManage,
+ // error
+ } = this.state
return (
-
Organization Permission
+
Organization Permission
@@ -76,14 +82,19 @@ class OrgPermission extends Component {
Are invitations required for joining the organization?
-
-
-
+
+
@@ -137,10 +148,30 @@ class OrgPermission extends Component {
>
Who can create and manage user groups
-
-
-
-
+
+
+
+
diff --git a/src/user/dashboard/Community/components/OrgProfile.js b/src/user/dashboard/Community/components/OrgProfile.js
index 264187f8..61dad877 100644
--- a/src/user/dashboard/Community/components/OrgProfile.js
+++ b/src/user/dashboard/Community/components/OrgProfile.js
@@ -12,10 +12,8 @@ class OrgProfile extends Component {
isDeactivated: false,
logo: null,
orgName: "",
- desc: {
- short: "",
- long: ""
- },
+ shortDesc: "",
+ longDesc: "",
error: ''
}
}
@@ -26,14 +24,9 @@ class OrgProfile extends Component {
}
componentWillReceiveProps(nextProps) {
- console.log('nextProps ', nextProps)
const { name, description } = nextProps.org.org;
- let info = {
- short: description.shortDescription,
- long: description.longDescription,
- };
const { isDeactivated } = nextProps.org
- this.setState({ orgName: name, desc: info, isDeactivated: isDeactivated }, () => {
+ this.setState({ orgName: name, shortDesc: description.shortDescription, longDesc: description.longDescription, isDeactivated: isDeactivated }, () => {
console.log('org info ', this.state)
})
const { msg } = nextProps.error
@@ -42,7 +35,9 @@ class OrgProfile extends Component {
handleChange = (event) => {
const { name, value } = event.target;
- this.setState({ [name] : value })
+ this.setState({ [name] : value }, () => {
+ console.log('state ', this.state)
+ })
}
deactivateOrg = () => {
@@ -52,15 +47,16 @@ class OrgProfile extends Component {
updateInfo = () => {
console.log('Update info clicked!');
- const { orgName, desc } = this.state
- const updatedInfo = {
+ const { orgName, shortDesc, longDesc } = this.state
+ const info = {
description: {
- shortDescription: desc.short,
- longDescription: desc.long,
+ shortDescription: shortDesc,
+ longDescription: longDesc,
},
name: orgName
};
- this.props.updateOrgProfile(updatedInfo)
+ console.log('updatedInfo ', info)
+ this.props.updateOrgProfile(info)
}
onFileChange = (e) => {
@@ -71,7 +67,14 @@ class OrgProfile extends Component {
}
render() {
- const { logo, orgName, desc, error, isDeactivated } = this.state;
+ const {
+ logo,
+ orgName,
+ shortDesc,
+ longDesc,
+ // error,
+ isDeactivated
+ } = this.state;
return (
@@ -118,13 +121,13 @@ class OrgProfile extends Component {
@@ -138,7 +141,7 @@ class OrgProfile extends Component {
placeholder="Long description"
required={true}
className="placeholder_text"
- defaultValue={desc.long}
+ defaultValue={longDesc}
onChange={this.handleChange}
name="longDesc"
/>
@@ -176,4 +179,8 @@ const mapStateToProps = (state) => ({
org: state.org
})
-export default connect(mapStateToProps, { getOrgProfile, updateOrgProfile, deactivateOrg })(OrgProfile);
\ No newline at end of file
+export default connect(mapStateToProps, {
+ getOrgProfile,
+ updateOrgProfile,
+ deactivateOrg
+})(OrgProfile);
diff --git a/src/user/dashboard/Community/components/OrgSettings.js b/src/user/dashboard/Community/components/OrgSettings.js
index 638a16dd..26a939aa 100644
--- a/src/user/dashboard/Community/components/OrgSettings.js
+++ b/src/user/dashboard/Community/components/OrgSettings.js
@@ -13,7 +13,8 @@ class OrgSettings extends Component {
enableEmail: true,
language: "",
time: "",
- error: ''
+ error: '',
+ editingTime: ''
};
}
@@ -35,9 +36,10 @@ class OrgSettings extends Component {
settings: {
enableEmail,
language,
- time
- }
+ timeFormat: time
+ },
};
+ console.log('updating settings ', info);
this.props.updateSettings(info)
}
@@ -59,7 +61,14 @@ class OrgSettings extends Component {
}
render() {
- const { enableEmail, language, time, error } = this.state;
+ const {
+ enableEmail,
+ language,
+ time,
+ editingTime,
+ // editing
+ // error
+ } = this.state;
return (
@@ -74,6 +83,7 @@ class OrgSettings extends Component {
as="select"
className="select_option"
name="editing"
+ value={editingTime}
onChange={this.onChange}
>
@@ -140,11 +150,27 @@ class OrgSettings extends Component {
as="select"
name="language"
className="select_option"
+ value={language}
onChange={this.onChange}
>
-
-
-
+
+
+
@@ -158,10 +184,19 @@ class OrgSettings extends Component {
as="select"
name="time"
className="select_option"
+ value={time}
onChange={this.onChange}
>
-
-
+
+
diff --git a/src/user/dashboard/Community/components/permission.scss b/src/user/dashboard/Community/components/permission.scss
index 06da56b8..fde907e6 100644
--- a/src/user/dashboard/Community/components/permission.scss
+++ b/src/user/dashboard/Community/components/permission.scss
@@ -17,6 +17,9 @@
border: 0.75px solid #90949C;
background: #FFFFFF;
box-sizing: border-box;
+ .hide {
+ display: none;
+ }
}
.placeholder_text {
color: #C9C9C9;
diff --git a/src/user/dashboard/Community/components/settings.scss b/src/user/dashboard/Community/components/settings.scss
index e64bc290..4007fc7e 100644
--- a/src/user/dashboard/Community/components/settings.scss
+++ b/src/user/dashboard/Community/components/settings.scss
@@ -17,6 +17,9 @@
border: 0.75px solid #90949C;
background: #FFFFFF;
box-sizing: border-box;
+ .hide {
+ display: none;
+ }
}
.placeholder_text {
color: #C9C9C9;
diff --git a/src/user/dashboard/dashboard.js b/src/user/dashboard/dashboard.js
index 275ee41f..ae42e0cd 100644
--- a/src/user/dashboard/dashboard.js
+++ b/src/user/dashboard/dashboard.js
@@ -5,8 +5,8 @@ import UpcomingEvents from "./upcoming-events/upcoming-events";
import Notifications from "./notifications/notifications";
import Portfolio from "./portfolio/portfolio";
import NewsFeed from "./news-feed/news-feed";
-import Updates from "./updates/updates";
-import orgUpdatesLoading from "../../placeholderLoading/orgUpdatesLoading/orgUpdatesLoading";
+// import Updates from "./updates/updates";
+// import orgUpdatesLoading from "../../placeholderLoading/orgUpdatesLoading/orgUpdatesLoading";
import notifyUsersLoading from "../../placeholderLoading/notifyUsersLoading/notifyUsersLoading";
import portfolioLoading from "../../placeholderLoading/portfolioLoading/portfolioLoading";
import newsFeedLoading from "../../placeholderLoading/newsFeedLoading/newsFeedLoading";
diff --git a/src/user/dashboard/insights/components/CommunityStats.js b/src/user/dashboard/insights/components/CommunityStats.js
index 562b8d51..d2d0f69e 100644
--- a/src/user/dashboard/insights/components/CommunityStats.js
+++ b/src/user/dashboard/insights/components/CommunityStats.js
@@ -1,7 +1,6 @@
import React, { Component } from 'react'
-import { Form, Button } from 'react-bootstrap';
+import { Button } from 'react-bootstrap';
import './community.scss'
-import Navigation from '../../navigation/navigation';
import { connect } from 'react-redux'
import { getMember, getMembers, getOrgOverview, getPersonalOverview } from '../../../../actions/insightAction'
diff --git a/src/user/dashboard/navigation/navigation.js b/src/user/dashboard/navigation/navigation.js
index f8071de8..72ac2e12 100644
--- a/src/user/dashboard/navigation/navigation.js
+++ b/src/user/dashboard/navigation/navigation.js
@@ -1,5 +1,5 @@
import React, { Component } from "react";
-import { ListGroup, Button, OverlayTrigger, Tooltip } from "react-bootstrap";
+import { ListGroup, Button } from "react-bootstrap";
import { NavLink } from "react-router-dom";
import PropTypes from "prop-types";
import "./navigation.scss";
@@ -11,9 +11,9 @@ import {
DonutTitleSmall,
DonutIconSmall,
} from "../../../donutTitle/donutTitle";
-import ComminytPng from "../../../images/community.png";
-import CommunitySetting from "../Community/CommunitySetting";
-import { Desktop, Mobile, Default, Tablet } from "../../../utils/breakpoints";
+// import ComminytPng from "../../../images/community.png";
+// import CommunitySetting from "../Community/CommunitySetting";
+import { Desktop, Mobile } from "../../../utils/breakpoints";
import SVGIcon from "../../../utils/SVGIcon";
class Navigation extends Component {
@@ -22,13 +22,13 @@ class Navigation extends Component {
org: false
};
render() {
- function renderTooltip(props) {
- return (
-
- Simple tooltip
-
- );
- }
+ // function renderTooltip(props) {
+ // return (
+ //
+ // Simple tooltip
+ //
+ // );
+ // }
const ListItem = (props) => {
const item = props.isMobile ? (
@@ -55,20 +55,15 @@ class Navigation extends Component {
this.setState({
open: false,
});
- // const closeOrgSetting = () => {
- // this.setState({
- // org: false
- // })
- // }
- const divStyle = {
- position: "fixed",
- bottom: '5em'
- };
+ // const divStyle = {
+ // position: "fixed",
+ // bottom: '5em'
+ // };
const divStyle2 = {
position: "fixed",
bottom: "2em"
};
- const { dashboard, posts, org, orgSettings, event, proj, profile, logout, settings } = this.props;
+ const { logout } = this.props;
return (
diff --git a/src/user/dashboard/navigation/navigation.scss b/src/user/dashboard/navigation/navigation.scss
index bde19203..03260b53 100644
--- a/src/user/dashboard/navigation/navigation.scss
+++ b/src/user/dashboard/navigation/navigation.scss
@@ -31,6 +31,14 @@
color: #1a73e8;
}
}
+ span {
+ .active {
+ background-color: rgba(26, 115, 232, 0.1);
+ .link {
+ color: #1a73e8;
+ }
+ }
+ }
}
}
@@ -41,6 +49,14 @@
color: rgba(0, 0, 0, 0.5);
}
}
+ span {
+ .active {
+ background-color: rgba(26, 115, 232, 0.1);
+ .link {
+ color: #1a73e8;
+ }
+ }
+ }
}
}
@@ -50,6 +66,11 @@
svg {
padding: 0px 10px 0px 10px;
}
+ span {
+ svg {
+ padding: 0px;
+ }
+ }
}
}
}
diff --git a/src/user/dashboard/news-feed/news-feed.js b/src/user/dashboard/news-feed/news-feed.js
index b813abae..62bde94b 100644
--- a/src/user/dashboard/news-feed/news-feed.js
+++ b/src/user/dashboard/news-feed/news-feed.js
@@ -9,7 +9,7 @@ import {
ListItemAvatar,
Avatar,
ListItemText,
- ListItemSecondaryAction,
+ // ListItemSecondaryAction,
IconButton,
CardMedia,
} from "@material-ui/core";
@@ -18,17 +18,18 @@ import { Button } from "react-bootstrap";
import AddEventModal from "./popups/AddEventModal";
import AddProjectModal from "./popups/AddProjectModal";
import ArrowDropUpIcon from "@material-ui/icons/ArrowDropUp";
-import ArrowDropDownIcon from "@material-ui/icons/ArrowDropDown";
+// import ArrowDropDownIcon from "@material-ui/icons/ArrowDropDown";
import ChatBubbleIcon from "@material-ui/icons/ChatBubble";
-import EventNoteIcon from "@material-ui/icons/EventNote";
-import EventIcon from "@material-ui/icons/Event";
-import ReplyIcon from '@material-ui/icons/Reply';
-import feed from "../../../jsonData/news-feed";
+// import EventNoteIcon from "@material-ui/icons/EventNote";
+// import EventIcon from "@material-ui/icons/Event";
+// import ReplyIcon from '@material-ui/icons/Reply';
+// import feed from "../../../jsonData/news-feed";
import "../../pinned-posts/posts/posts.scss";
import "./news-feed.scss";
import AddPostModal from "./popups/AddPostModal";
-import { Comment } from "./popups/comment";
+import Comment from "./popups/comment";
import { connect } from 'react-redux'
+import { getAllCommentsOfPost } from '../../../actions/commentAction'
import profileImg from '../../../svgs/evt-creator.svg';
import eventImg from "../../../svgs/event-img-1.svg";
import eventImg2 from "../../../svgs/event-img-2.svg";
@@ -97,17 +98,19 @@ function NewsFeed(props) {
const [writePost, showPostModal] = useState(false);
const [showComment, toggle] = useState(false);
const [commentId, setCommentId] = useState('');
- const [all, setAll] = useState([]);
+ // const [all, setAll] = useState([]);
const [events, setEvents] = useState([]);
const [projects, setAllProjects] = useState([]);
const [posts, setAllPosts] = useState([]);
+ // const [allCommentsOfPost, setAllCommentsOfPost] = useState({})
useEffect(() => {
console.log("useEffect from news-feed ", props);
setEvents(props?.allEvents);
setAllProjects(props?.allProjects);
setAllPosts(props?.allPosts);
- setAll(props?.allMix);
+ // setAll(props?.allMix);
+ // setAllCommentsOfPost(props?.comment?.allComments)
}, [props]);
let handleClick = (atrb) => () => {
@@ -141,18 +144,19 @@ function NewsFeed(props) {
let commentToggle = (postId) => {
console.log("Comment toggle clicked!", postId);
+ props.getAllCommentsOfPost(postId)
setCommentId(postId);
toggle(!showComment);
}
- let postContent = posts.map((post) => {
+ let postContent = posts?.map((post) => {
return (
-
-
+ */}
@@ -196,10 +200,6 @@ function NewsFeed(props) {
-
@@ -207,7 +207,7 @@ function NewsFeed(props) {
)
})
- let projectsContent = projects.map((project) => {
+ let projectsContent = projects?.map((project) => {
return (
@@ -269,7 +269,6 @@ function NewsFeed(props) {
-
@@ -277,7 +276,7 @@ function NewsFeed(props) {
)
})
- let eventsContent = events.map((event) => {
+ let eventsContent = events?.map((event) => {
return (
@@ -352,10 +351,14 @@ function NewsFeed(props) {
*/}
-
+
)
})
@@ -463,7 +466,7 @@ function NewsFeed(props) {
) : (