From 6dad1ed544deb5a7be54c80c125e3376dff92fc4 Mon Sep 17 00:00:00 2001 From: rhodinemma Date: Wed, 3 Jul 2024 17:36:57 +0300 Subject: [PATCH] chore: integrate activity feed endpoint in users dashboard --- src/assets/images/infosvg.svg | 4 + .../FeaturedProjectsSection.module.css | 9 ++ .../FeaturedProjectsSection/index.jsx | 84 ++++++++--- .../FeaturedUsersSection.module.css | 9 ++ src/components/FeaturedUsersSection/index.jsx | 62 +++++--- .../NewAppCard/NewAppCard.module.css | 111 ++++++++++++++ src/components/NewAppCard/index.jsx | 30 ++++ .../NewProjectCard/NewProjectCard.module.css | 31 ++++ src/components/NewProjectCard/index.jsx | 31 +++- .../NewUserCard/NewUserCard.module.css | 11 ++ src/components/NewUserCard/index.jsx | 30 ++-- .../ProjectsListSection.module.css | 9 ++ src/components/ProjectsListSection/index.jsx | 73 ++++++--- src/components/RecentActivityItem/index.jsx | 41 +++--- .../RecentActivitySection.module.css | 14 ++ .../RecentActivitySection/index.jsx | 139 ++++++++++-------- .../UsersDashboard/UsersDashboard.module.css | 1 + src/redux/actions/actionTypes.js | 4 + src/redux/actions/getUserRecentActivity.js | 43 ++++++ src/redux/actions/users.js | 10 +- src/redux/reducers/getUserRecentActivity.js | 46 ++++++ src/redux/reducers/index.js | 2 + 22 files changed, 640 insertions(+), 154 deletions(-) create mode 100644 src/assets/images/infosvg.svg create mode 100644 src/components/NewAppCard/NewAppCard.module.css create mode 100644 src/components/NewAppCard/index.jsx create mode 100644 src/redux/actions/getUserRecentActivity.js create mode 100644 src/redux/reducers/getUserRecentActivity.js diff --git a/src/assets/images/infosvg.svg b/src/assets/images/infosvg.svg new file mode 100644 index 000000000..90447e0f9 --- /dev/null +++ b/src/assets/images/infosvg.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/components/FeaturedProjectsSection/FeaturedProjectsSection.module.css b/src/components/FeaturedProjectsSection/FeaturedProjectsSection.module.css index 1004e0719..ebe230a34 100644 --- a/src/components/FeaturedProjectsSection/FeaturedProjectsSection.module.css +++ b/src/components/FeaturedProjectsSection/FeaturedProjectsSection.module.css @@ -7,4 +7,13 @@ .viewMoreButton { width: 100%; +} + +.noActivity { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 40vh; + text-align: center; } \ No newline at end of file diff --git a/src/components/FeaturedProjectsSection/index.jsx b/src/components/FeaturedProjectsSection/index.jsx index 51d06b49c..81f70373b 100644 --- a/src/components/FeaturedProjectsSection/index.jsx +++ b/src/components/FeaturedProjectsSection/index.jsx @@ -1,40 +1,88 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; import styles from "./FeaturedProjectsSection.module.css"; import NewProjectCard from "../NewProjectCard"; import PrimaryButton from "../PrimaryButton"; +import Spinner from "../Spinner"; const projects = [ { - name: "My Project 1", + name: "NextJs Boilerplate", description: - "This is my description description description description description description description description", + "A robust and scalable boilerplate for building Next.js applications, featuring best practices and industry standards for modern web development.", number: 1, + organisation: "Company", + type: "Charity", }, { - name: "My Project 2", - description: "This is my description", + name: "NodeJs Rate Limiting", + description: + "An implementation of rate limiting in a Node.js application to manage traffic and prevent abuse, ensuring smooth and secure performance.", number: 2, + organisation: "Startup", + type: "Personal", + }, + { + name: "Go Playground", + description: + "An interactive Go programming environment for testing and experimenting with Go code snippets, designed for learning and quick prototyping.", + number: 3, + organisation: "Final Year Project", + type: "Student", + }, + { + name: "Python Scripts", + description: + "A collection of Python scripts for automating various tasks and processes, enhancing productivity and efficiency in everyday operations.", + number: 4, + organisation: "Startup", + type: "Personal", }, - { name: "My Project 3", description: "This is my description", number: 3 }, - { name: "My Project 4", description: "This is my description", number: 3 }, ]; const FeaturedProjectsSection = () => { + const [loading, setLoading] = useState(true); + + useEffect(() => { + const timer = setTimeout(() => { + setLoading(false); + }, 3000); + + return () => clearTimeout(timer); + }, []); + return (

Featured Projects

- {projects.map((project, index) => ( - - ))} + {loading ? ( +
+
+
+ +
+
+
+ ) : ( + <> + {projects?.map((project, index) => ( + + ))} + + )} - View More + {!loading && ( + + View More + + )}
); }; diff --git a/src/components/FeaturedUsersSection/FeaturedUsersSection.module.css b/src/components/FeaturedUsersSection/FeaturedUsersSection.module.css index 604af14b5..b52d05d72 100644 --- a/src/components/FeaturedUsersSection/FeaturedUsersSection.module.css +++ b/src/components/FeaturedUsersSection/FeaturedUsersSection.module.css @@ -7,4 +7,13 @@ .viewMoreButton { width: 100%; +} + +.noActivity { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 40vh; + text-align: center; } \ No newline at end of file diff --git a/src/components/FeaturedUsersSection/index.jsx b/src/components/FeaturedUsersSection/index.jsx index d6141068f..b73292ea2 100644 --- a/src/components/FeaturedUsersSection/index.jsx +++ b/src/components/FeaturedUsersSection/index.jsx @@ -1,31 +1,53 @@ -import React from "react"; +import React, { useEffect } from "react"; import styles from "./FeaturedUsersSection.module.css"; import NewUserCard from "../NewUserCard"; import PrimaryButton from "../PrimaryButton"; - -const users = [ - { name: "User 1", followers: 120, projects: 10, apps: 5 }, - { name: "User 2", followers: 90, projects: 8, apps: 3 }, - { name: "User 3", followers: 150, projects: 12, apps: 7 }, - { name: "User 4", followers: 120, projects: 10, apps: 4 }, - { name: "User 5", followers: 100, projects: 9, apps: 5 }, -]; +import { useDispatch, useSelector } from "react-redux"; +import getUsersList from "../../redux/actions/users"; +import Spinner from "../Spinner"; const FeaturedUsersSection = () => { + const dispatch = useDispatch(); + + useEffect(() => { + dispatch(getUsersList(null, null, 1, null)); + }, [dispatch]); + + const { isFetching, users, isFetched } = useSelector( + (state) => state.usersListReducer + ); + return (
-

Featured Users

- {users.map((user, index) => ( - - ))} +

Suggested Users

+ + {isFetching && !isFetched ? ( +
+
+
+ +
+
+
+ ) : ( + <> + {users?.slice(0, 7).map((user, index) => ( + + ))} + + )} - View More + {!isFetching && ( + + View More + + )}
); }; diff --git a/src/components/NewAppCard/NewAppCard.module.css b/src/components/NewAppCard/NewAppCard.module.css new file mode 100644 index 000000000..fbccdf3ea --- /dev/null +++ b/src/components/NewAppCard/NewAppCard.module.css @@ -0,0 +1,111 @@ +.projectCard { + position: relative; + display: flex; + justify-content: space-between; + align-items: center; + background-color: #ffff; + padding: 20px; + border-radius: 8px; + margin: 10px 0; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); +} + +.cardContent { + display: flex; + flex-direction: column; +} + +.title { + font-size: 1em; + font-weight: 600; + margin: 0; + /* color: var(--primary-color); */ +} + +/* .title:hover { + cursor: pointer; + text-decoration: underline; + transform: scale(1.05); +} */ + +.description { + color: var(--primary-color); + display: -webkit-box; + -webkit-box-orient: vertical; + overflow: hidden; + -webkit-line-clamp: 2; + line-clamp: 2; + min-height: 2.3em; + margin: 5px 0 0 0; + text-decoration: underline; +} + +.description:hover { + cursor: pointer; +} + +.numberBox { + position: absolute; + top: 10px; + right: 10px; + background-color: #fafae5; + padding: 2px; + border-radius: 8px; + min-width: 40px; + display: flex; + justify-content: center; + align-items: center; +} + +.numberBox:hover { + cursor: pointer; +} + +.number { + font-size: 1em; +} + +.cardExtras { + display: flex; + padding-top: 0.3rem; +} + +.membersIcon { + width: 1rem; + height: 1rem; +} + +.memberCount { + padding-left: 0.5rem; +} + +.stats { + display: flex; + flex-direction: column; + margin: 10px 0; +} + +.statItem { + background-color: #f0f0f0; + border-radius: 8px; + padding: 5px 10px; + display: flex; + align-items: center; +} + +.statItem p, +.statItem span { + margin: 0; + font-size: 0.9em; +} + +.cardSummary { + display: flex; + gap: 10px; + flex-wrap: wrap; +} + +.appUrl { + text-decoration: none; + color: var(--primary-color); +} \ No newline at end of file diff --git a/src/components/NewAppCard/index.jsx b/src/components/NewAppCard/index.jsx new file mode 100644 index 000000000..489200267 --- /dev/null +++ b/src/components/NewAppCard/index.jsx @@ -0,0 +1,30 @@ +import React from "react"; +import styles from "./NewAppCard.module.css"; + +const NewAppCard = ({ name, url, image, port }) => { + return ( +
+
+

{name}

+

+ + {url} + +

+ +
+
+
+ Image: {image} +
+
+ Port: {port} +
+
+
+
+
+ ); +}; + +export default NewAppCard; diff --git a/src/components/NewProjectCard/NewProjectCard.module.css b/src/components/NewProjectCard/NewProjectCard.module.css index 706c0d915..1427d9489 100644 --- a/src/components/NewProjectCard/NewProjectCard.module.css +++ b/src/components/NewProjectCard/NewProjectCard.module.css @@ -15,6 +15,12 @@ flex-direction: column; } +.cardSummary { + display: flex; + gap: 8px; + flex-wrap: wrap; +} + .title { font-size: 1em; font-weight: 600; @@ -92,4 +98,29 @@ cursor: pointer; font-size: 0.9em; transition: background-color 0.3s ease; +} + +.stats { + display: flex; + flex-direction: column; + margin: 10px 0; +} + +.statItem { + background-color: #f0f0f0; + border-radius: 8px; + padding: 5px 10px; + display: flex; + align-items: center; +} + +.statItem p, +.statItem span { + margin: 0; + font-size: 0.9em; +} + +.linkBlue { + color: var(--primary-color); + text-decoration: none; } \ No newline at end of file diff --git a/src/components/NewProjectCard/index.jsx b/src/components/NewProjectCard/index.jsx index a79ed14b1..17f8d726c 100644 --- a/src/components/NewProjectCard/index.jsx +++ b/src/components/NewProjectCard/index.jsx @@ -1,10 +1,14 @@ import React from "react"; import styles from "./NewProjectCard.module.css"; import { ReactComponent as ProjectMembers } from "../../assets/images/project-members.svg"; +import { Link } from "react-router-dom/cjs/react-router-dom.min"; const NewProjectCard = ({ + projectID, name, description, + organization, + type, number, showFollowers, showFollowButton, @@ -12,10 +16,20 @@ const NewProjectCard = ({ return (
-

{name}

+

+ + {name} + +

{description}

-
+ {/*
{showFollowers && ( <> {number} )} +
*/} + +
+
+
+ Organisation: {organization} +
+
+ Type: {type} +
+
- {!showFollowers && !showFollowButton ? ( + {!showFollowButton && number !== undefined ? (
{number}
diff --git a/src/components/NewUserCard/NewUserCard.module.css b/src/components/NewUserCard/NewUserCard.module.css index 767247e3c..5a5507862 100644 --- a/src/components/NewUserCard/NewUserCard.module.css +++ b/src/components/NewUserCard/NewUserCard.module.css @@ -73,6 +73,17 @@ font-size: 0.9em; } +.cardSummary { + display: flex; + gap: 8px; + flex-wrap: wrap; +} + +.linkBlue { + color: var(--primary-color); + text-decoration: none; +} + .icon { margin-right: 5px; } diff --git a/src/components/NewUserCard/index.jsx b/src/components/NewUserCard/index.jsx index e61db5707..aebddf391 100644 --- a/src/components/NewUserCard/index.jsx +++ b/src/components/NewUserCard/index.jsx @@ -1,13 +1,21 @@ import React from "react"; import styles from "./NewUserCard.module.css"; +import { Link } from "react-router-dom/cjs/react-router-dom.min"; -const NewUserCard = ({ name, followers, projects, apps }) => { +const NewUserCard = ({ userID, name, organisation, age }) => { return (

- {name} + + {name} +

@@ -15,15 +23,15 @@ const NewUserCard = ({ name, followers, projects, apps }) => {
-
-

- {followers} Followers -

-
-
- - {projects} Projects - +
+
+ {/*
+ Organisation: {organisation} +
*/} +
+ Joined {age} +
+
diff --git a/src/components/ProjectsListSection/ProjectsListSection.module.css b/src/components/ProjectsListSection/ProjectsListSection.module.css index 1e997c2eb..f46dcf74f 100644 --- a/src/components/ProjectsListSection/ProjectsListSection.module.css +++ b/src/components/ProjectsListSection/ProjectsListSection.module.css @@ -7,4 +7,13 @@ .viewMoreButton { width: 100%; +} + +.noActivity { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 80vh; + text-align: center; } \ No newline at end of file diff --git a/src/components/ProjectsListSection/index.jsx b/src/components/ProjectsListSection/index.jsx index ac58d10e2..75711a79b 100644 --- a/src/components/ProjectsListSection/index.jsx +++ b/src/components/ProjectsListSection/index.jsx @@ -1,51 +1,76 @@ -import React from "react"; +import React, { useEffect } from "react"; import styles from "./ProjectsListSection.module.css"; import NewProjectCard from "../NewProjectCard"; import PrimaryButton from "../PrimaryButton"; -import { useSelector } from "react-redux"; +import { useDispatch, useSelector } from "react-redux"; import { useHistory } from "react-router-dom"; import Spinner from "../Spinner"; +import getUserProjects from "../../redux/actions/projectsList"; +import { ReactComponent as InfoSvg } from "../../assets/images/infosvg.svg"; const ProjectListSection = () => { + const dispatch = useDispatch(); const history = useHistory(); - const handleViewMoreClick = () => { - history.push("/projects"); - }; - const { isRetrieved, isRetrieving, projects } = useSelector( (state) => state.userProjectsReducer ); + useEffect(() => { + dispatch(getUserProjects(1)); + }, [dispatch]); + + const noProjectsFound = projects?.length === 0 && isRetrieved; + + const handleViewMoreClick = () => { + history.push("/projects"); + }; + return (

Projects

{isRetrieving && !isRetrieved ? ( -
-
- +
+
+
+ +
) : ( <> - {projects.slice(0, 5).map((project, index) => ( - - ))} + {noProjectsFound ? ( +
+ +

No Projects Found

+
+ ) : ( + projects + ?.slice(0, 5) + .map((project, index) => ( + + )) + )} + + {!noProjectsFound && ( + + View More + + )} )} - - - View More -
); }; diff --git a/src/components/RecentActivityItem/index.jsx b/src/components/RecentActivityItem/index.jsx index f8b156f65..c1b092776 100644 --- a/src/components/RecentActivityItem/index.jsx +++ b/src/components/RecentActivityItem/index.jsx @@ -1,30 +1,37 @@ import React from "react"; import styles from "./RecentActivityItem.module.css"; import NewProjectCard from "../NewProjectCard"; +import tellAge from "../../helpers/ageUtility"; +import NewAppCard from "../NewAppCard"; -const RecentActivityItem = ({ - user, - action, - time, - projectName, - projectDescription, - followers, -}) => { +const RecentActivityItem = ({ item }) => { return (
-
{user[0]}
+
{item?.user_name[0]}
- {user} {action} + {item?.user_name} -{" "} + {(item?.description).toLowerCase()}
-
{time}
+
{tellAge(item?.creation_date)}
- + {item?.a_app_id == null ? ( + + ) : ( + + )}
diff --git a/src/components/RecentActivitySection/RecentActivitySection.module.css b/src/components/RecentActivitySection/RecentActivitySection.module.css index c3adb1fbe..853c06c04 100644 --- a/src/components/RecentActivitySection/RecentActivitySection.module.css +++ b/src/components/RecentActivitySection/RecentActivitySection.module.css @@ -13,4 +13,18 @@ .viewMoreButton { width: 100%; +} + +.noActivity { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 80vh; + text-align: center; +} + +.noActivityMessage { + font-size: 18px; + color: #555; } \ No newline at end of file diff --git a/src/components/RecentActivitySection/index.jsx b/src/components/RecentActivitySection/index.jsx index c2394022c..495152000 100644 --- a/src/components/RecentActivitySection/index.jsx +++ b/src/components/RecentActivitySection/index.jsx @@ -1,72 +1,91 @@ -import React from "react"; +import React, { useCallback, useEffect } from "react"; import styles from "./RecentActivitySection.module.css"; import RecentActivityItem from "../RecentActivityItem"; import PrimaryButton from "../PrimaryButton"; - -const activities = [ - { - user: "Moses", - action: "followed your project", - time: "yesterday", - projectName: "My Project 1", - projectDescription: - "This is my description description description description description description description description", - followers: 90, - }, - { - user: "Moses", - action: "followed your project", - time: "yesterday", - projectName: "My Project 1", - projectDescription: "This is my description", - followers: 90, - }, - { - user: "Moses", - action: "followed your project", - time: "yesterday", - projectName: "My Project 1", - projectDescription: "This is my description", - followers: 90, - }, - { - user: "Moses", - action: "followed your project", - time: "yesterday", - projectName: "My Project 1", - projectDescription: "This is my description", - followers: 90, - }, - { - user: "Moses", - action: "followed your project", - time: "yesterday", - projectName: "My Project 1", - projectDescription: "This is my description", - followers: 90, - }, -]; +import { ReactComponent as InfoSvg } from "../../assets/images/infosvg.svg"; +import { useDispatch, useSelector } from "react-redux"; +import getUserRecentActivities from "../../redux/actions/getUserRecentActivity"; +import Spinner from "../Spinner"; +import usePaginator from "../../hooks/usePaginator"; +import Pagination from "../Pagination"; const RecentActivitySection = () => { + const dispatch = useDispatch(); + + const [currentPage, handleChangePage] = usePaginator(); + + const user = useSelector((state) => state.user); + + const userRecentActivities = useCallback( + () => dispatch(getUserRecentActivities(user?.data?.id, currentPage)), + [dispatch, user?.data?.id, currentPage] + ); + + useEffect(() => { + userRecentActivities(); + }, [userRecentActivities, user?.data?.id]); + + const { + recentActivities, + pagination, + isFetchingRecentActivities, + recentActivitiesFetched, + } = useSelector((state) => state.userRecentActivitiesReducer); + + const noRecentActivity = + recentActivities?.length === 0 && recentActivitiesFetched; + + const handlePageChange = (currentPage) => { + handleChangePage(currentPage); + userRecentActivities(); + }; + + console.log(recentActivities); + return (

Recent Activity

- {activities.map((activity, index) => ( - - ))} - - View All Activity - + {isFetchingRecentActivities ? ( +
+
+
+ +
+
+
+ ) : ( + <> + {noRecentActivity ? ( +
+ +

+ No Recent Activity Found +

+
+ ) : ( + recentActivities?.map((item, index) => ( + + + + )) + )} + + {!noRecentActivity && pagination?.pages > 1 && ( +
+ +
+ + // + // View All Activity + // + )} + + )}
); }; diff --git a/src/pages/UsersDashboard/UsersDashboard.module.css b/src/pages/UsersDashboard/UsersDashboard.module.css index d57ad5be7..bfdf4253f 100644 --- a/src/pages/UsersDashboard/UsersDashboard.module.css +++ b/src/pages/UsersDashboard/UsersDashboard.module.css @@ -9,6 +9,7 @@ position: sticky; top: 0; height: 100vh; + overflow-y: auto; } .activitySection { diff --git a/src/redux/actions/actionTypes.js b/src/redux/actions/actionTypes.js index bc0e56527..48097223b 100644 --- a/src/redux/actions/actionTypes.js +++ b/src/redux/actions/actionTypes.js @@ -287,3 +287,7 @@ export const USER_ACTIVITIES_FAIL = "USER_ACTIVITIES_FAIL"; // export const UPDATE_MEMBER_ROLE_FAIL = "UPDATE_MEMBER_ROLE_FAIL"; // export const START_UPDATING_MEMBER_ROLE = "START_UPDATING_MEMBER_ROLE"; // export const CLEAR_UPDATE_MEMBER_ROLE_STATE = "CLEAR_UPDATE_MEMBER_ROLE_STATE"; + +export const GETTING_USER_RECENT_ACTIVITIES = "GETTING_USER_RECENT_ACTIVITIES"; +export const USER_RECENT_ACTIVITIES_SUCCESS = "USER_RECENT_ACTIVITIES_SUCCESS"; +export const USER_RECENT_ACTIVITIES_FAIL = "USER_RECENT_ACTIVITIES_FAIL"; diff --git a/src/redux/actions/getUserRecentActivity.js b/src/redux/actions/getUserRecentActivity.js new file mode 100644 index 000000000..35432af61 --- /dev/null +++ b/src/redux/actions/getUserRecentActivity.js @@ -0,0 +1,43 @@ +import axios from "../../axios"; +import { + GETTING_USER_RECENT_ACTIVITIES, + USER_RECENT_ACTIVITIES_SUCCESS, + USER_RECENT_ACTIVITIES_FAIL, +} from "./actionTypes"; + +const startFetchingUserRecentActivities = () => ({ + type: GETTING_USER_RECENT_ACTIVITIES, +}); + +const userRecentActivitiesSuccess = (response) => ({ + type: USER_RECENT_ACTIVITIES_SUCCESS, + payload: response.data, +}); + +const userRecentActivitiesFailed = (error) => ({ + type: USER_RECENT_ACTIVITIES_FAIL, + payload: { + status: false, + error: error.status, + }, +}); + +const getUserRecentActivities = (userID, currentPage) => async (dispatch) => { + dispatch(startFetchingUserRecentActivities()); + + let link; + if (userID !== "") { + link = `/activity_feed?user_id=${userID}&page=${currentPage}`; + } else { + link = `/activity_feed`; + } + try { + const response = await axios.get(link); + console.log("action res", response.data); + dispatch(userRecentActivitiesSuccess(response.data.user_feed)); + } catch (error) { + dispatch(userRecentActivitiesFailed(error)); + } +}; + +export default getUserRecentActivities; diff --git a/src/redux/actions/users.js b/src/redux/actions/users.js index 1d9700936..c3e5d688f 100644 --- a/src/redux/actions/users.js +++ b/src/redux/actions/users.js @@ -39,7 +39,15 @@ const getUsersList = // have a default range of 30days link = `/users/inactive_users?range=30&page=${page}`; } else { - link = `/users/inactive_users?range=${dateRange}&page=${page}`; + if ( + dateRange === null || + sectionValue === null || + keywords === null + ) { + link = `/users?page=${page}`; + } else { + link = `/users/inactive_users?range=${dateRange}&page=${page}`; + } } } } else { diff --git a/src/redux/reducers/getUserRecentActivity.js b/src/redux/reducers/getUserRecentActivity.js new file mode 100644 index 000000000..7b38e1fc0 --- /dev/null +++ b/src/redux/reducers/getUserRecentActivity.js @@ -0,0 +1,46 @@ +import { + GETTING_USER_RECENT_ACTIVITIES, + USER_RECENT_ACTIVITIES_SUCCESS, + USER_RECENT_ACTIVITIES_FAIL, +} from "../actions/actionTypes"; + +const initialState = { + recentActivities: [], + isFetchingRecentActivities: false, + recentActivitiesFetched: false, + pagination: {}, + recentActivitiesMessage: "No Recent Activity Found", +}; + +const userRecentActivitiesReducer = (state = initialState, action) => { + switch (action.type) { + case USER_RECENT_ACTIVITIES_SUCCESS: + return { + ...state, + recentActivities: action.payload.activity, + pagination: action.payload.pagination, + isFetchingRecentActivities: false, + recentActivitiesFetched: true, + recentActivitiesMessage: "Fetched recent activities", + }; + + case GETTING_USER_RECENT_ACTIVITIES: + return { + ...state, + recentActivitiesFetched: false, + isFetchingRecentActivities: true, + }; + + case USER_RECENT_ACTIVITIES_FAIL: + return { + ...state, + isFetchingRecentActivities: false, + recentActivitiesFetched: false, + pagination: {}, + recentActivitiesMessage: "Error fetching recent activities", + }; + default: + return state; + } +}; +export default userRecentActivitiesReducer; diff --git a/src/redux/reducers/index.js b/src/redux/reducers/index.js index 90f026c1e..9bbc74170 100644 --- a/src/redux/reducers/index.js +++ b/src/redux/reducers/index.js @@ -60,6 +60,7 @@ import getGraphDataReducer from "./getGraphData"; import adminGetInactiveUsersReducer from "./adminGetInactiveUsers"; import appsAdminListReducer from "./adminAppsList"; import appRevisionsReducer from "./getRevisions"; +import userRecentActivitiesReducer from "./getUserRecentActivity"; // import inviteMembersReducer from "./inviteMembers"; //import removeMemberReducer from "./removeMembers"; // import updateMemberRoleReducer from "./updateMemberRole"; @@ -126,6 +127,7 @@ export default combineReducers({ appsAdminListReducer, userActivitiesReducer, appRevisionsReducer, + userRecentActivitiesReducer, // inviteMembersReducer, // removeMemberReducer, // updateMemberRoleReducer,