diff --git a/src/api/invitations.ts b/src/api/invitations.ts index 51ccee224..3b341c467 100644 --- a/src/api/invitations.ts +++ b/src/api/invitations.ts @@ -1,4 +1,4 @@ -import { axiosGet, axiosPost } from "../services/apiRequests" +import { axiosDelete, axiosGet, axiosPost } from "../services/apiRequests" import { apiRoutes } from "../config/apiRoutes"; import { getFromLocalStorage } from "./Auth"; @@ -149,6 +149,34 @@ export const getUserInvitations = async (pageNumber: number, pageSize: number, s } } + +export const getUserEcosystemInvitations = async (pageNumber: number, pageSize: number, search: string) => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID) + + const url = `${apiRoutes.Ecosystem.root}/${orgId}${apiRoutes.Ecosystem.usersInvitation}?pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}` + + const token = await getFromLocalStorage(storageKeys.TOKEN) + + const config = { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}` + } + } + const axiosPayload = { + url, + config + } + + try { + return await axiosGet(axiosPayload); + } + catch (error) { + const err = error as Error + return err?.message + } +} + // getEcosytemReceivedInvitations export const getEcosytemReceivedInvitations = async (pageNumber: number, pageSize: number, search = '') => { const orgId = await getFromLocalStorage(storageKeys.ORG_ID); @@ -178,6 +206,7 @@ export const getEcosytemReceivedInvitations = async (pageNumber: number, pageSiz } export const getEcosystemInvitations = async (pageNumber: number, pageSize: number, search:string) => { const ecosystemId = await getFromLocalStorage(storageKeys.ECOSYSTEM_ID); + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); const url = `${apiRoutes.Ecosystem.root}/${ecosystemId}/${orgId}${apiRoutes.Ecosystem.invitations}` @@ -204,9 +233,9 @@ export const getEcosystemInvitations = async (pageNumber: number, pageSize: numb } // Accept/ Reject Invitations -export const acceptRejectInvitations = async (invitationId: number,orgId: number, status: string) => { +export const acceptRejectEcosystemInvitations = async (invitationId: number,orgId: number, status: string) => { - const url = `${apiRoutes.users.invitations}/${invitationId}` + const url = `${apiRoutes.Ecosystem.root}/${orgId}${apiRoutes.Ecosystem.invitations}/${invitationId}` const payload = { orgId: Number(orgId), @@ -235,4 +264,61 @@ export const acceptRejectInvitations = async (invitationId: number,orgId: number } } +export const acceptRejectInvitations = async (invitationId: number,orgId: number, status: string) => { + + const url = `${apiRoutes.users.invitations}/${invitationId}` + + const payload = { + orgId: Number(orgId), + status + } + const token = await getFromLocalStorage(storageKeys.TOKEN) + const config = { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}` + } + } + const axiosPayload = { + url, + payload, + config + } + + try { + return await axiosPost(axiosPayload); + } + catch (error) { + const err = error as Error + return err?.message + } +} + +export const deleteEcosystemInvitations = async (invitationId: number) => { + + const ecosystemId = await getFromLocalStorage(storageKeys.ECOSYSTEM_ID); + const orgId = await getFromLocalStorage(storageKeys.ORG_ID) + const url = `${apiRoutes.Ecosystem.root}/${ecosystemId}/${orgId}${apiRoutes.Ecosystem.invitations}/${invitationId}` + + const token = await getFromLocalStorage(storageKeys.TOKEN) + + const config = { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}` + } + } + const axiosPayload = { + url, + config + } + + try { + return await axiosDelete(axiosPayload); + } + catch (error) { + const err = error as Error + return err?.message + } +} diff --git a/src/components/AlertComponent/index.tsx b/src/components/AlertComponent/index.tsx index 707835bc0..28827512a 100644 --- a/src/components/AlertComponent/index.tsx +++ b/src/components/AlertComponent/index.tsx @@ -1,5 +1,4 @@ import { Alert } from 'flowbite-react'; -import { pathRoutes } from '../../config/pathRoutes'; export const AlertComponent = ({ message, type, viewButton, onAlertClose, path='' }: { message: string | null, type: string, viewButton?: boolean, path?:string, onAlertClose: () => void }) => { diff --git a/src/components/Ecosystem/Dashboard.tsx b/src/components/Ecosystem/Dashboard.tsx index 77510ec88..359870de1 100644 --- a/src/components/Ecosystem/Dashboard.tsx +++ b/src/components/Ecosystem/Dashboard.tsx @@ -17,16 +17,27 @@ import checkEcosystem from '../../config/ecosystem'; import RoleViewButton from '../RoleViewButton'; import SendInvitationModal from '../organization/invitations/SendInvitationModal'; import { setToLocalStorage } from '../../api/Auth'; +import { getEcosytemReceivedInvitations } from '../../api/invitations'; +import { pathRoutes } from '../../config/pathRoutes'; + +const initialPageState = { + pageNumber: 1, + pageSize: 10, + total: 0, +}; const Dashboard = () => { const [ecosystemDetails, setEcosystemDetails] = useState(); - const [success, setSuccess] = useState(null); const [failure, setFailure] = useState(null); const [message, setMessage] = useState(null); const [loading, setLoading] = useState(true); - const[ecosystemId,setEcosystemId]=useState('') + const [error, setError] = useState(null); + const [ecosystemId, setEcosystemId] = useState(''); const [openModal, setOpenModal] = useState(false); + const [viewButton, setViewButton] = useState(false); + const [currentPage, setCurrentPage] = useState(initialPageState); + const props = { openModal, setOpenModal }; const createEcosystemModel = () => { @@ -37,30 +48,63 @@ const Dashboard = () => { props.setOpenModal(true); }; - + const getAllEcosystemInvitations = async () => { + setLoading(true); + const response = await getEcosytemReceivedInvitations( + currentPage.pageNumber, + currentPage.pageSize, + '', + ); + const { data } = response as AxiosResponse; + + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + const totalPages = data?.data?.totalPages; + + const invitationList = data?.data; + const ecoSystemName = invitationList.map((invitations: { name: string; })=>{ + return invitations.name + }) + const invitationPendingList = data?.data?.invitations.filter((invitation: { status: string; })=>{ + return invitation.status === 'pending' + }) + + if (invitationPendingList.length > 0) { + setMessage(`You have received invitation to join ${ecoSystemName} ecosystem `) + setViewButton(true); + } + setCurrentPage({ + ...currentPage, + total: totalPages, + }); + } else { + setError(response as string); + } + setLoading(false); + }; + const fetchEcosystemDetails = async () => { - setLoading(true); const response = await getEcosystem(); const { data } = response as AxiosResponse; - if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - const ecosystemData = data?.data[0] - await setToLocalStorage(storageKeys.ECOSYSTEM_ID,ecosystemData?.id) - setEcosystemId(ecosystemData?.id) - setEcosystemDetails({ - logoUrl: ecosystemData.logoUrl, - name: ecosystemData.name, - description: ecosystemData.description - }) - } else { - setFailure(response as string) - } - setLoading(false) - } + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + const ecosystemData = data?.data[0]; + await setToLocalStorage(storageKeys.ECOSYSTEM_ID, ecosystemData?.id); + setEcosystemId(ecosystemData?.id); + setEcosystemDetails({ + logoUrl: ecosystemData.logoUrl, + name: ecosystemData.name, + description: ecosystemData.description, + }); + } else { + setFailure(response as string); + } + setLoading(false); + }; useEffect(() => { fetchEcosystemDetails(); + getAllEcosystemInvitations(); }, []); const { isEcosystemLead } = checkEcosystem(); @@ -70,6 +114,34 @@ const Dashboard = () => {
+ + { + error ? <> {(success || failure) && ( + { + setSuccess(null); + setFailure(null); + }} + /> + )} + + : + <> +
+ { { + setMessage(null); + setError(null); + }} + />} +
+ {(success || failure) && ( { }} /> )} + + + + } + {ecosystemDetails ? (
diff --git a/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx b/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx index e69de29bb..227965c7e 100644 --- a/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx +++ b/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx @@ -0,0 +1,384 @@ +import { Button, Pagination } from 'flowbite-react'; +import { ChangeEvent, useEffect, useState } from 'react'; +import { + acceptRejectEcosystemInvitations, + getUserEcosystemInvitations, +} from '../../api/invitations'; +import { AlertComponent } from '../AlertComponent'; +import type { AxiosResponse } from 'axios'; +import BreadCrumbs from '../BreadCrumbs'; +import type { Invitation } from '../organization/interfaces/invitations'; +import type { OrgRole, Organisation } from '../organization/interfaces'; +import SendInvitationModal from '../organization/invitations/SendInvitationModal'; +import { apiStatusCodes, storageKeys } from '../../config/CommonConstant'; +import { pathRoutes } from '../../config/pathRoutes'; +import { EmptyListMessage } from '../EmptyListComponent'; +import CustomSpinner from '../CustomSpinner'; +import { getFromLocalStorage } from '../../api/Auth'; +import { getOrganizations } from '../../api/organization'; + +const initialPageState = { + pageNumber: 1, + pageSize: 10, + total: 0, +}; + +const ReceivedInvitations = () => { + const [openModal, setOpenModal] = useState(false); + const [loading, setLoading] = useState(false); + const [message, setMessage] = useState(null); + const [error, setError] = useState(null); + const [organizationsList, setOrganizationList] =useState | null>(null); + const [currentPage, setCurrentPage] = useState(initialPageState); + const [selectedId, setSelectedId] = useState(); + + const onPageChange = (page: number) => { + setCurrentPage({ + ...currentPage, + pageNumber: page, + }); + }; + const [searchText, setSearchText] = useState(''); + const [invitationsList, setInvitationsList] = useState | null>(null); + + const props = { openModal, setOpenModal }; + + const getAllOrganizationsForEcosystem = async () => { + setLoading(true); + const response = await getOrganizations( + currentPage.pageNumber, + currentPage.pageSize, + searchText, + ); + const { data } = response as AxiosResponse; + + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + const totalPages = data?.data?.totalPages; + + const orgList = data?.data?.organizations.map((userOrg: Organisation) => { + const roles: string[] = userOrg.userOrgRoles.map( + (role) => role.orgRole.name, + ); + userOrg.roles = roles; + return userOrg; + }); + + setOrganizationList(orgList); + setCurrentPage({ + ...currentPage, + total: totalPages, + }); + } else { + setError(response as string); + } + setLoading(false); + }; + + const getAllInvitations = async () => { + setLoading(true); + const response = await getUserEcosystemInvitations( + currentPage.pageNumber, + currentPage.pageSize, + searchText, + ); + const { data } = response as AxiosResponse; + + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + const totalPages = data?.data?.totalPages; + + const invitationList = data?.data?.invitations.filter((invitation: { status: string; })=>{ + return invitation.status === 'pending' + }) + setInvitationsList(invitationList); + setCurrentPage({ + ...currentPage, + total: totalPages, + }); + } else { + setError(response as string); + } + + setLoading(false); + }; + + useEffect(() => { + let getData: NodeJS.Timeout; + getAllOrganizationsForEcosystem(); + if (searchText.length >= 1) { + getData = setTimeout(() => { + getAllInvitations(); + }, 1000); + } else { + getAllInvitations(); + } + + return () => clearTimeout(getData); + }, [searchText, openModal, currentPage.pageNumber]); + + const searchInputChange = (e: ChangeEvent) => { + setSearchText(e.target.value); + }; + + const respondToEcosystemInvitations = async ( + invite: Invitation, + status: string, + ) => { + setLoading(true); + const response = await acceptRejectEcosystemInvitations( + invite.id, + Number(selectedId), + status, + ); + const { data } = response as AxiosResponse; + if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) { + setMessage(data?.message); + setLoading(false); + window.location.href = pathRoutes.organizations.root; + } else { + setError(response as string); + setLoading(false); + } + }; + + const handleDropdownChange = (e: { target: { value: any } }) => { + const value = e.target.value; + setSelectedId(value); + }; + + const getOrgId = async () => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + if (orgId) { + setSelectedId(Number(orgId)); + } + }; + + useEffect(() => { + getOrgId(); + }, []); + + return ( +
+
+ +

+ Received Invitations +

+
+
+
+ setMessage(data)} + setOpenModal={props.setOpenModal} + /> + + { + setMessage(null); + setError(null); + }} + /> + + {loading ? ( +
+ +
+ ) : invitationsList && invitationsList?.length > 0 ? ( +
+
+
    + {invitationsList.map((invitation) => ( +
  • +
    +
    +
    + + + + + + + + + + + + + + + +
    +

    + {invitation.email} +

    + +
    +
      +
    • +
      +
      + Roles:{' '} + + Ecosystem Member + {/* {role.name + .charAt(0) + .toUpperCase() + + role.name.slice(1)} */} + + {invitation.orgRoles && + invitation.orgRoles.length > 0 && + invitation.orgRoles.map( + (role: OrgRole, index: number) => { + return ( + + {/* {role.name + .charAt(0) + .toUpperCase() + + role.name.slice(1)} */} + + ); + }, + )} +
      +
      +
    • +
    +
    +
    +
    + +
    + + +
    +
    + +
    + +
    +
    +
  • + ))} +
+
+
+ ) : ( + invitationsList && ( + + ) + )} + +
+ +
+
+
+
+ ); +}; + +export default ReceivedInvitations; diff --git a/src/components/EcosystemInvite/SentInvitations.tsx b/src/components/EcosystemInvite/SentInvitations.tsx index cede3854b..27d4b8e1b 100644 --- a/src/components/EcosystemInvite/SentInvitations.tsx +++ b/src/components/EcosystemInvite/SentInvitations.tsx @@ -1,11 +1,13 @@ import { Button, Pagination } from 'flowbite-react'; -import { ChangeEvent, useEffect, useState } from 'react'; -import { getEcosystemInvitations } from '../../api/invitations'; +import { useEffect, useState } from 'react'; +import { + getEcosystemInvitations, + deleteEcosystemInvitations, +} from '../../api/invitations'; import { AlertComponent } from '../AlertComponent'; import type { AxiosResponse } from 'axios'; import BreadCrumbs from '../BreadCrumbs'; import type { Invitation } from '../organization/interfaces/invitations'; -import type { OrgRole } from '../organization/interfaces'; import { apiStatusCodes } from '../../config/CommonConstant'; import { EmptyListMessage } from '../EmptyListComponent'; import CustomSpinner from '../CustomSpinner'; @@ -23,8 +25,9 @@ const SentInvitations = () => { const [error, setError] = useState(null); const [currentPage, setCurrentPage] = useState(initialPageState); const [searchText, setSearchText] = useState(''); + const [invitationsList, setInvitationsList] = + useState | null>(null); - const timestamp = Date.now(); const onPageChange = (page: number) => { setCurrentPage({ ...currentPage, @@ -32,10 +35,6 @@ const SentInvitations = () => { }); }; - const [invitationsList, setInvitationsList] = - useState | null>(null); - const props = { openModal, setOpenModal }; - const getAllSentInvitations = async () => { setLoading(true); const response = await getEcosystemInvitations( @@ -47,7 +46,6 @@ const SentInvitations = () => { if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { const totalPages = data?.data?.totalPages; - const invitationList = data?.data?.invitations; setInvitationsList(invitationList); @@ -58,7 +56,19 @@ const SentInvitations = () => { } else { setError(response as string); } + setLoading(false); + }; + + const deletInvitations = async (invitationId: number) => { + const response = await deleteEcosystemInvitations(invitationId); + const { data } = response as AxiosResponse; + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + setLoading(true); + await getAllSentInvitations(); + } else { + setError(response as string); + } setLoading(false); }; @@ -75,10 +85,6 @@ const SentInvitations = () => { return () => clearTimeout(getData); }, [searchText, openModal, currentPage.pageNumber]); - const searchInputChange = (e: ChangeEvent) => { - setSearchText(e.target.value); - }; - return (
@@ -99,11 +105,7 @@ const SentInvitations = () => { }} /> - {loading ? ( -
- -
- ) : invitationsList && invitationsList?.length > 0 ? ( + {invitationsList && invitationsList?.length > 0 ? (
    @@ -165,24 +167,10 @@ const SentInvitations = () => { Roles:{' '} Ecosystem Member - {invitation.orgRoles && - invitation.orgRoles.length > 0 && - invitation.orgRoles.map( - (_role: OrgRole, index: number) => { - return ( - - Ecosystem Member - - ); - }, - )}
@@ -193,10 +181,7 @@ const SentInvitations = () => {
) : ( - invitationsList && ( - - ) +
+ {!(invitationsList && invitationsList?.length > 0) && !loading ? ( + + ) : ( +
+ +
+ )} +
)}
diff --git a/src/components/User/UserDashBoard.tsx b/src/components/User/UserDashBoard.tsx index 98ffbaeb5..1f838e049 100644 --- a/src/components/User/UserDashBoard.tsx +++ b/src/components/User/UserDashBoard.tsx @@ -1,19 +1,22 @@ -import { useEffect, useState } from "react"; - -import { AlertComponent } from "../AlertComponent"; -import type { AxiosResponse } from "axios"; -import CustomAvatar from '../Avatar' -import { EmptyListMessage } from "../EmptyListComponent"; -import type { Organisation } from "../organization/interfaces"; -import type { UserActivity } from "./interfaces"; -import { apiStatusCodes, storageKeys } from "../../config/CommonConstant"; -import { getOrganizations } from "../../api/organization"; -import { getUserActivity } from "../../api/users"; -import { getUserInvitations } from "../../api/invitations"; -import { pathRoutes } from "../../config/pathRoutes"; -import { setToLocalStorage } from "../../api/Auth"; -import { dateConversion } from "../../utils/DateConversion"; -import DateTooltip from "../Tooltip"; +import { useEffect, useState } from 'react'; + +import { AlertComponent } from '../AlertComponent'; +import type { AxiosResponse } from 'axios'; +import CustomAvatar from '../Avatar'; +import { EmptyListMessage } from '../EmptyListComponent'; +import type { Organisation } from '../organization/interfaces'; +import type { UserActivity } from './interfaces'; +import { apiStatusCodes, storageKeys } from '../../config/CommonConstant'; +import { getOrganizations } from '../../api/organization'; +import { getUserActivity } from '../../api/users'; +import { + getEcosytemReceivedInvitations, + getUserInvitations, +} from '../../api/invitations'; +import { pathRoutes } from '../../config/pathRoutes'; +import { setToLocalStorage } from '../../api/Auth'; +import { dateConversion } from '../../utils/DateConversion'; +import DateTooltip from '../Tooltip'; const initialPageState = { pageNumber: 1, @@ -22,124 +25,142 @@ const initialPageState = { }; const UserDashBoard = () => { - - const [message, setMessage] = useState(null) - const [viewButton, setViewButton] = useState(false) - const [error, setError] = useState(null) + const [message, setMessage] = useState(null); + const [ecoMessage, setEcoMessage] = useState(null); + const [viewButton, setViewButton] = useState(false); + const [error, setError] = useState(null); const [currentPage, setCurrentPage] = useState(initialPageState); - const [loading, setLoading] = useState(false) - const [organizationsList, setOrganizationList] = useState | null>(null) - const [activityList, setActivityList] = useState | null>(null) + const [loading, setLoading] = useState(false); + const [organizationsList, setOrganizationList] = + useState | null>(null); + const [activityList, setActivityList] = useState | null>( + null, + ); const getAllInvitations = async () => { - - setLoading(true) - const response = await getUserInvitations(currentPage.pageNumber, currentPage.pageSize, ''); - const { data } = response as AxiosResponse + setLoading(true); + const response = await getUserInvitations( + currentPage.pageNumber, + currentPage.pageSize, + '', + ); + const { data } = response as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - const totalPages = data?.data?.totalPages; - - const invitationList = data?.data?.invitations + const invitationList = data?.data?.invitations; + const orgName = invitationList.map( + (invitations: { organisation: { name: string } }) => { + return invitations.organisation.name; + }, + ); if (invitationList.length > 0) { - setMessage('You have some pending received invitations') - setViewButton(true) + setMessage( + `You have received invitations to join ${orgName} organisation`, + ); + setViewButton(true); } - setCurrentPage({ ...currentPage, - total: totalPages - }) + total: totalPages, + }); } else { - setError(response as string) + setError(response as string); } - - setLoading(false) - } + setLoading(false); + }; const getAllEcosystemInvitations = async () => { - - setLoading(true) - const response = await getEcosytemReceivedInvitations(currentPage.pageNumber, currentPage.pageSize, ''); - const { data } = response as AxiosResponse + setLoading(true); + const response = await getEcosytemReceivedInvitations( + currentPage.pageNumber, + currentPage.pageSize, + '', + ); + const { data } = response as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - const totalPages = data?.data?.totalPages; - - const invitationList = data?.data?.invitations - - if (invitationList.length > 0) { - setMessage('You have some pending received invitations') - setViewButton(true) + const invitationList = data?.data; + const ecoSystemName = invitationList.map( + (invitations: { name: string }) => { + return invitations.name; + }, + ); + const invitationPendingList = data?.data?.invitations.filter( + (invitation: { status: string }) => { + return invitation.status === 'pending'; + }, + ); + if (invitationPendingList.length > 0) { + setEcoMessage( + `You have received invitation to join ${ecoSystemName} ecosystem `, + ); + setViewButton(true); } - setCurrentPage({ ...currentPage, - total: totalPages - }) + total: totalPages, + }); } else { - setError(response as string) + setError(response as string); } - setLoading(false) - } + setLoading(false); + }; //Fetch the user organization list const getAllOrganizations = async () => { - - setLoading(true) - const response = await getOrganizations(currentPage.pageNumber, currentPage.pageSize, ''); - const { data } = response as AxiosResponse + setLoading(true); + const response = await getOrganizations( + currentPage.pageNumber, + currentPage.pageSize, + '', + ); + const { data } = response as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - const totalPages = data?.data?.totalPages; - const orgList = data?.data?.organizations.filter((userOrg: Organisation, index: number) => index < 3) + const orgList = data?.data?.organizations.filter( + (userOrg: Organisation, index: number) => index < 3, + ); - setOrganizationList(orgList) + setOrganizationList(orgList); setCurrentPage({ ...currentPage, - total: totalPages - }) + total: totalPages, + }); } else { - setError(response as string) + setError(response as string); } - setLoading(false) - } - + setLoading(false); + }; //Fetch the user recent activity const getUserRecentActivity = async () => { - - setLoading(true) + setLoading(true); const response = await getUserActivity(5); - const { data } = response as AxiosResponse + const { data } = response as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - const activityList = data?.data; setActivityList(activityList); - } else { - setError(response as string) + setError(response as string); } - setLoading(false) - } - - + setLoading(false); + }; useEffect(() => { - getAllInvitations() - getAllOrganizations() - getUserRecentActivity() - getAllEcosystemInvitations() - }, []) + getAllInvitations(); + getAllOrganizations(); + getUserRecentActivity(); + getAllEcosystemInvitations(); + }, []); const goToOrgDashboard = async (orgId: number, roles: string[]) => { await setToLocalStorage(storageKeys.ORG_ID, orgId.toString()); @@ -149,80 +170,86 @@ const UserDashBoard = () => { return (
- { - setMessage(null) - setError(null) + setMessage(null); + setError(null); }} />
-
+
+ { + setEcoMessage(null); + setError(null); + }} + /> + {/* } */} +
-
-
+
+
+

Organizations

- - {/* { - organizationsList - && organizationsList.map(org => { - return
- - {(org.logoUrl) ? : } - -

- {org.name} -

- -
- }) - } */} - - {organizationsList?.map((org) => { - const roles: string[] = org.userOrgRoles.map(role => role.orgRole.name) - org.roles = roles + {organizationsList?.map((org) => { + const roles: string[] = org.userOrgRoles.map( + (role) => role.orgRole.name, + ); + org.roles = roles; return ( -
goToOrgDashboard(org?.id, org?.roles)}> + - ) - }) - } - - { - organizationsList && organizationsList?.length > 0 && ( - - View More.. - - )} + ); + })} + + {organizationsList && organizationsList?.length > 0 && ( + + View More.. + + )}
-
{/*
{
-
+

Recent Activity - { - activityList && activityList?.length===0 && ( -
- Looks like there are no activities to display at the moment. -
- ) - } -

+ {activityList && activityList?.length === 0 && ( +
+ Looks like there are no activities to display at the moment. +
+ )} +
- { - activityList - ?
    - { - activityList - && activityList.map(activity => { - return
  1. -
    -
    -
-
-
- - ) -} + ); +}; export default UserDashBoard; diff --git a/src/config/pathRoutes.ts b/src/config/pathRoutes.ts index cc61a0acf..91015076a 100644 --- a/src/config/pathRoutes.ts +++ b/src/config/pathRoutes.ts @@ -35,7 +35,8 @@ export const pathRoutes = { }, ecosystem: { profile: "/ecosystem/profile", - endorsements: "/ecosystem/endorsements" + endorsements: "/ecosystem/endorsements", + invitation:"/ecosystem/invitation" }, documentation: { root: 'https://docs.credebl.id' diff --git a/src/pages/ecosystem/invitation.astro b/src/pages/ecosystem/invitation.astro index 4a1b743d8..ab1fc836f 100644 --- a/src/pages/ecosystem/invitation.astro +++ b/src/pages/ecosystem/invitation.astro @@ -2,7 +2,7 @@ import LayoutSidebar from '../../app/LayoutSidebar.astro'; import { checkUserSession } from '../../utils/check-session'; import { pathRoutes } from '../../config/pathRoutes'; -// import EcoSystemReceivedInvitations from '../../components/EcosystemInvite/EcoSystemReceivedInvitations' +import EcoSystemReceivedInvitations from '../../components/EcosystemInvite/EcoSystemReceivedInvitations' const response = await checkUserSession(Astro.cookies); const route = pathRoutes.auth.sinIn @@ -12,7 +12,7 @@ if (!response) { --- - +