Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/credebl/studio into feat…
Browse files Browse the repository at this point in the history
…-endorsement

Signed-off-by: sanjay-k1910 <[email protected]>
  • Loading branch information
sanjay-k1910 committed Oct 10, 2023
2 parents a5272f8 + 4e4796c commit 78acca8
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 45 deletions.
4 changes: 3 additions & 1 deletion src/components/EcosystemInvite/EcoInvitationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import React from 'react';
interface InvitationProps{
invitationId:string;
invitationEmail:string
ecosytem:[]
}

const EcoInvitationList = (props: InvitationProps ) => {

const {invitationId, invitationEmail} = props
const {invitationId, invitationEmail,ecosytem} = props

return (
<>
<div className="flex space-x-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const initialPageState = {


export interface EcosystemInvitation {
ecosystem: any
ecosystem: []
id: string
createDateTime: string
createdBy: number
Expand Down Expand Up @@ -146,7 +146,7 @@ const ReceivedInvitations = () => {
if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) {
setMessage(data?.message);
setLoading(false);
window.location.href = pathRoutes.ecosystem.profile
window.location.href = pathRoutes.ecosystem.root
} else {
setError(response as string);
setLoading(false);
Expand Down Expand Up @@ -239,6 +239,7 @@ stroke-linejoin="round"
<EcoInvitationList
invitationId={invitation.id}
invitationEmail={invitation.email}
ecosytem={invitation.ecosystem}
/>

<div id={invitation.email} className="flex">
Expand Down
1 change: 1 addition & 0 deletions src/components/EcosystemInvite/SentInvitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const SentInvitations = () => {
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
setLoading(true);
await getAllSentInvitations();
setMessage('Invitation deleted successfully')
} else {
setError(response as string);
}
Expand Down
39 changes: 14 additions & 25 deletions src/components/User/UserDashBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { apiStatusCodes, storageKeys } from '../../config/CommonConstant';
import { getOrganizations } from '../../api/organization';
import { getUserActivity } from '../../api/users';
import {
getEcosytemReceivedInvitations,
getUserEcosystemInvitations,
getUserInvitations,
} from '../../api/invitations';
import { pathRoutes } from '../../config/pathRoutes';
import { setToLocalStorage } from '../../api/Auth';
import { getFromLocalStorage, setToLocalStorage } from '../../api/Auth';
import { dateConversion } from '../../utils/DateConversion';
import DateTooltip from '../Tooltip';

Expand Down Expand Up @@ -49,16 +49,8 @@ const UserDashBoard = () => {
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
const totalPages = data?.data?.totalPages;
const invitationList = data?.data?.invitations;
const orgName = invitationList.map(
(invitations: { organisation: { name: string } }) => {
return invitations.organisation.name;
},
);

if (invitationList.length > 0) {
setMessage(
`You have received invitations to join ${orgName} organisation`,
);
setMessage(`You have received invitations to join organisation`);
setViewButton(true);
}
setCurrentPage({
Expand All @@ -73,7 +65,7 @@ const UserDashBoard = () => {

const getAllEcosystemInvitations = async () => {
setLoading(true);
const response = await getEcosytemReceivedInvitations(
const response = await getUserEcosystemInvitations(
currentPage.pageNumber,
currentPage.pageSize,
'',
Expand All @@ -82,21 +74,14 @@ const UserDashBoard = () => {

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) {
setEcoMessage(
`You have received invitation to join ${ecoSystemName} ecosystem `,
);
setEcoMessage(`You have received invitation to join ecosystem `);
setViewButton(true);
}
setCurrentPage({
Expand Down Expand Up @@ -154,12 +139,17 @@ const UserDashBoard = () => {

setLoading(false);
};

const checkOrgId = async () => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
if (orgId) {
await getAllEcosystemInvitations();
}
};
useEffect(() => {
getAllInvitations();
getAllOrganizations();
getUserRecentActivity();
getAllEcosystemInvitations();
checkOrgId();
}, []);

const goToOrgDashboard = async (orgId: number, roles: string[]) => {
Expand Down Expand Up @@ -193,7 +183,6 @@ const UserDashBoard = () => {
setError(null);
}}
/>
{/* } */}
</div>

<div className="grid w-full grid-cols-1 gap-4 mt-0 mb-4 xl:grid-cols-2 2xl:grid-cols-3">
Expand All @@ -202,7 +191,7 @@ const UserDashBoard = () => {
<h2 className="text-base font-bold text-gray-500 dark:text-white mb-2">
Organizations
</h2>

{organizationsList?.map((org) => {
const roles: string[] = org.userOrgRoles.map(
(role) => role.orgRole.name,
Expand Down
10 changes: 9 additions & 1 deletion src/pages/ecosystem/index.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
---
import LayoutSidebar from '../../app/LayoutSidebar.astro';
import Dashboard from '../../components/Ecosystem/Dashboard';
import { checkUserSession } from '../../utils/check-session';
import { pathRoutes } from '../../config/pathRoutes';
const response = await checkUserSession(Astro.cookies);
const route: string = pathRoutes.auth.sinIn
if (!response) {
return Astro.redirect(route);
}
---

<LayoutSidebar>
<Dashboard client:visible/>
</LayoutSidebar>
</LayoutSidebar>
16 changes: 0 additions & 16 deletions src/pages/ecosystems/index.astro

This file was deleted.

0 comments on commit 78acca8

Please sign in to comment.