Skip to content

Commit

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

Signed-off-by: sanjay-k1910 <[email protected]>
  • Loading branch information
sanjay-k1910 committed Oct 18, 2023
2 parents 4f50823 + 811e048 commit 1efe6bc
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 116 deletions.
2 changes: 1 addition & 1 deletion src/commonComponents/backbutton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const index = ({ path }: { path: string }) => {
onClick={() => {
window.location.href = path;
}}
className="bg-secondary-700 ring-primary-700 bg-white-700 hover:bg-secondary-700 ring-2 text-black font-medium rounded-lg text-sm px-4 lg:px-5 py-2 lg:py-2.5 m-2 ml-2 dark:text-white"
className="bg-secondary-700 ring-primary-700 bg-white-700 hover:bg-secondary-700 ring-2 text-black font-medium rounded-lg text-sm px-4 lg:px-5 py-2 lg:py-2.5 m-2 ml-2 dark:text-white dark:hover:text-black"
style={{ height: '2.5rem', width: '5rem', minWidth: '2rem' }}
>
<svg
Expand Down
158 changes: 88 additions & 70 deletions src/components/Ecosystem/Dashboard.tsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/Ecosystem/Endorsement/EndorsementPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const EndorsementPopup = (props: {
<button
onClick={() => RejectEndorsement(props.endorsementData.id)}
disabled={loadingReject}
className="hover:bg-secondary-700 bg-white !ring-2 dark:text-primary-700 text-primary-700 font-medium rounded-lg text-sm dark:hover:text-primary-700 "
className="hover:bg-secondary-700 !ring-2 dark:text-white text-primary-700 font-medium rounded-lg text-sm dark:hover:text-primary-700 "
>
<span className='flex items-center rounded-md text-sm px-4 py-2'>
{
Expand Down
37 changes: 4 additions & 33 deletions src/components/Ecosystem/MemberList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import type { TableData } from '../../commonComponents/datatable/interface';
import DateTooltip from '../Tooltip';
import { dateConversion } from '../../utils/DateConversion';
import { AlertComponent } from '../AlertComponent';
import { Button, Pagination } from 'flowbite-react';
import { pathRoutes } from '../../config/pathRoutes';
import { Pagination } from 'flowbite-react';

const initialPageState = {
pageNumber: 1,
Expand Down Expand Up @@ -48,9 +47,10 @@ const MemberList = () => {
return 0;
}
};
const sortedMemberList = data?.data?.members?.sort(compareMembers);
const sortedMemberList = data?.data?.members?.sort(compareMembers);
const membersData = sortedMemberList?.map(
(member: {
ecosystem: {createDateTime: string};
ecosystemRole: { name: string };
orgName: string;
role: string;
Expand Down Expand Up @@ -79,7 +79,7 @@ const MemberList = () => {
: 'bg-green-100 text-green-800 dark:bg-gray-700 dark:text-green-400 border border-green-100 dark:border-green-500'
} text-sm font-medium mr-2 px-2.5 py-1 rounded-md`}
>
{member.ecosystemRole.name}
{member?.createDateTime === member?.ecosystem?.createDateTime ? member?.ecosystemRole?.name + (' (You)') : member?.ecosystemRole?.name}
</span>
) : (
'Not available'
Expand Down Expand Up @@ -158,35 +158,6 @@ const MemberList = () => {
<h2 className="text-xl dark:text-white font-medium font-body">
Ecosystem Members
</h2>

<Button
type="submit"
color="bg-primary-800"
onClick={() => {
window.location.href = `${pathRoutes.ecosystem.sentinvitation}`;
}}
className="bg-secondary-700 ring-primary-700 bg-white-700 hover:bg-secondary-700
ring-2 text-black font-medium rounded-lg text-sm
ml-auto dark:text-white dark:hover:text-black
dark:hover:bg-primary-50"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="27"
height="16"
viewBox="0 0 27 16"
fill="none"
>
<path
d="M8.8125 3.29502H4.125M8.8125 7.99999H1M8.8125 12.705H4.125M15.0352 1.12145L26 7.99999L15.0352 14.8785C14.4544 15.243 13.7206 14.7341 13.855 14.0598L15.0625 7.99999L13.855 1.94019C13.7206 1.266 14.4544 0.757051 15.0352 1.12145Z"
stroke="#1F4EAD"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
<span className="hidden sm:block ml-2">Sent Invitations</span>
</Button>
</div>
<AlertComponent
message={error}
Expand Down
52 changes: 48 additions & 4 deletions src/components/EcosystemInvite/SentInvitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ import { AlertComponent } from '../AlertComponent';
import type { AxiosResponse } from 'axios';
import BreadCrumbs from '../BreadCrumbs';
import type { Invitation } from '../organization/interfaces/invitations';
import { apiStatusCodes } from '../../config/CommonConstant';
import { apiStatusCodes, storageKeys } from '../../config/CommonConstant';
import { EmptyListMessage } from '../EmptyListComponent';
import CustomSpinner from '../CustomSpinner';
import RoleViewButton from '../RoleViewButton';
import SendInvitationModal from '../organization/invitations/SendInvitationModal';
import { getFromLocalStorage } from '../../api/Auth';
import { Features } from '../../utils/enums/features';

const initialPageState = {
pageNumber: 1,
Expand All @@ -26,6 +30,8 @@ const SentInvitations = () => {
const [searchText, setSearchText] = useState<string>('');
const [invitationsList, setInvitationsList] =
useState<Array<Invitation> | null>(null);
const [ecosystemId, setEcosystemId] = useState<string>('');
const [openModal, setOpenModal] = useState<boolean>(false);

const onPageChange = (page: number) => {
setCurrentPage({
Expand All @@ -35,6 +41,8 @@ const SentInvitations = () => {
};

const getAllSentInvitations = async () => {
const ecosystemId = await getFromLocalStorage(storageKeys.ECOSYSTEM_ID);
setEcosystemId(ecosystemId);
setLoading(true);
const response = await getEcosystemInvitations(
currentPage.pageNumber,
Expand Down Expand Up @@ -72,6 +80,10 @@ const SentInvitations = () => {
setLoading(false);
};

const createInvitationsModel = () => {
setOpenModal(true);
};

useEffect(() => {
let getData: NodeJS.Timeout;

Expand All @@ -92,9 +104,41 @@ const SentInvitations = () => {
</div>
<div>
<div className="p-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800">
<h1 className="text-xl mb-4 font-semibold text-gray-900 sm:text-2xl dark:text-white">
Sent Ecosystem Invitations
</h1>
<div className="flex justify-between items-center mb-4">
<h1 className="text-xl font-semibold items-center text-gray-900 sm:text-2xl dark:text-white">
Sent Ecosystem Invitations
</h1>
<div className="inline-flex items-center ml-auto">
<SendInvitationModal
getAllSentInvitations={getAllSentInvitations}
flag={true}
ecosystemId={ecosystemId}
openModal={openModal}
setMessage={(data) => setMessage(data)}
setOpenModal={setOpenModal}
/>
<RoleViewButton
buttonTitle="Invite"
feature={Features.SEND_INVITATION}
svgComponent={
<svg
className="pr-2"
xmlns="http://www.w3.org/2000/svg"
width="36"
height="18"
fill="none"
viewBox="0 0 42 24"
>
<path
fill="#fff"
d="M37.846 0H9.231a3.703 3.703 0 0 0-3.693 3.692v1.385c0 .508.416.923.924.923a.926.926 0 0 0 .923-.923V3.692c0-.184.046-.369.092-.554L17.815 12 7.477 20.861a2.317 2.317 0 0 1-.092-.553v-1.385A.926.926 0 0 0 6.462 18a.926.926 0 0 0-.924.923v1.385A3.703 3.703 0 0 0 9.231 24h28.615a3.703 3.703 0 0 0 3.693-3.692V3.692A3.703 3.703 0 0 0 37.846 0ZM8.862 1.892c.092-.046.23-.046.369-.046h28.615c.139 0 .277 0 .37.046L24.137 13.938a.97.97 0 0 1-1.2 0L8.863 1.893Zm28.984 20.262H9.231c-.139 0-.277 0-.37-.046L19.247 13.2l2.492 2.17a2.67 2.67 0 0 0 1.8.691 2.67 2.67 0 0 0 1.8-.692l2.493-2.169 10.384 8.908c-.092.046-.23.046-.369.046Zm1.846-1.846c0 .184-.046.369-.092.553L29.262 12 39.6 3.138c.046.185.092.37.092.554v16.616ZM2.77 9.692c0-.507.416-.923.923-.923h5.539c.507 0 .923.416.923.923a.926.926 0 0 1-.923.923h-5.54a.926.926 0 0 1-.923-.923Zm6.462 5.539H.923A.926.926 0 0 1 0 14.308c0-.508.415-.923.923-.923h8.308c.507 0 .923.415.923.923a.926.926 0 0 1-.923.923Z"
/>
</svg>
}
onClickEvent={createInvitationsModel}
/>
</div>
</div>

<AlertComponent
message={message ? message : error}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Resources/Schema/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ const CreateSchema = () => {
return (
<>
<div className="dark:text-white d-flex justify-content-center align-items-center mb-1">
Attributes <span className="dark:text-white text-red-600">*</span>
Attributes <span className="text-red-600">*</span>

</div>
<div className="flex flex-col">
Expand Down Expand Up @@ -540,7 +540,7 @@ const CreateSchema = () => {
type="reset"
color='bg-primary-800'
disabled={createloader}
className='dark:text-white bg-secondary-700 ring-primary-700 bg-white-700 hover:bg-secondary-700 ring-2 text-black font-medium rounded-lg text-sm px-4 lg:px-5 py-2 lg:py-2.5 mr-2 ml-auto dark:hover:text-primary-700'
className='dark:text-white bg-secondary-700 ring-primary-700 bg-white-700 hover:bg-secondary-700 ring-2 text-black font-medium rounded-lg text-sm px-4 lg:px-5 py-2 lg:py-2.5 mr-2 ml-auto dark:hover:text-black'

style={{ height: '2.6rem', width: '6rem', minWidth: '2rem' }}
>
Expand Down
12 changes: 8 additions & 4 deletions src/components/organization/invitations/SendInvitationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ interface RoleI {
}

const SendInvitationModal = (props: {
ecosystemId?: string;
getAllSentInvitations?: ()=> void;
ecosystemId? : string;
flag?: boolean;
openModal: boolean;
setMessage: (message: string) => void;
Expand Down Expand Up @@ -116,8 +117,8 @@ const SendInvitationModal = (props: {
};

const sendEcoSystemInvitations = async () => {
setLoading(true);

setLoading(true);
const invitationPayload = invitations.map((invitation) => {
return {
email: invitation.email,
Expand All @@ -132,8 +133,11 @@ const SendInvitationModal = (props: {
const { data } = resCreateOrg as AxiosResponse;

if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) {
props.setMessage(data?.message);
props.setOpenModal(false);

props?.setMessage(data?.message);
props?.setOpenModal(false);
props?.getAllSentInvitations()

} else {
setErrMsg(resCreateOrg as string);
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/pathRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const pathRoutes = {
profile: "/ecosystem/profile",
endorsements: "/ecosystem/endorsement",
invitation:"/ecosystem/invitation",
sentinvitation:'/ecosystem/sent-invitations'
sentinvitation:'/ecosystem/invitations'
},
documentation: {
root: 'https://docs.credebl.id'
Expand Down
File renamed without changes.

0 comments on commit 1efe6bc

Please sign in to comment.