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
…ecosystem-issues

Signed-off-by: sanjay-k1910 <[email protected]>
  • Loading branch information
sanjay-k1910 committed Oct 16, 2023
2 parents a79714d + e7279f4 commit d49b3d5
Show file tree
Hide file tree
Showing 22 changed files with 145 additions and 213 deletions.
2 changes: 1 addition & 1 deletion src/api/invitations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export const getEcosystemInvitations = async (pageNumber: number, pageSize: numb
const ecosystemId = await getFromLocalStorage(storageKeys.ECOSYSTEM_ID);

const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
const url = `${apiRoutes.Ecosystem.root}/${ecosystemId}/${orgId}${apiRoutes.Ecosystem.invitations}`
const url = `${apiRoutes.Ecosystem.root}/${ecosystemId}/${orgId}${apiRoutes.Ecosystem.invitations}?pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}`

const token = await getFromLocalStorage(storageKeys.TOKEN)

Expand Down
34 changes: 34 additions & 0 deletions src/commonComponents/backbutton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Button } from 'flowbite-react';

const index = ({ path }: { path: string }) => {
return (
<div>
<Button
type="submit"
color="bg-primary-800"
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"
style={{ height: '2.5rem', width: '5rem', minWidth: '2rem' }}
>
<svg
className="mr-1"
xmlns="http://www.w3.org/2000/svg"
width="22"
height="12"
fill="none"
viewBox="0 0 30 20"
>
<path
fill="#1F4EAD"
d="M.163 9.237a1.867 1.867 0 0 0-.122 1.153c.083.387.287.742.587 1.021l8.572 7.98c.198.19.434.343.696.447a2.279 2.279 0 0 0 1.657.013c.263-.1.503-.248.704-.435.201-.188.36-.41.468-.655a1.877 1.877 0 0 0-.014-1.543 1.999 1.999 0 0 0-.48-.648l-4.917-4.576h20.543c.568 0 1.113-.21 1.515-.584.402-.374.628-.882.628-1.411 0-.53-.226-1.036-.628-1.41a2.226 2.226 0 0 0-1.515-.585H7.314l4.914-4.574c.205-.184.368-.404.48-.648a1.878 1.878 0 0 0 .015-1.542 1.99 1.99 0 0 0-.468-.656A2.161 2.161 0 0 0 11.55.15a2.283 2.283 0 0 0-1.657.013 2.154 2.154 0 0 0-.696.447L.626 8.589a1.991 1.991 0 0 0-.463.648Z"
/>
</svg>
<span className="hidden sm:block">Back</span>
</Button>
</div>
);
};

export default index;
5 changes: 3 additions & 2 deletions src/commonComponents/datatable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const DataTable: React.FC<DataTableProps> = ({ header,displaySelect, data, loadi
{header && header.length > 0 &&
header.map(ele => (
<th
key={ele.columnName}
scope="col"
className={`p-4 text-xs font-medium tracking-wider text-left text-gray-500 uppercase dark:text-white ${ele.width && ele.width}`}
>
Expand All @@ -44,10 +45,10 @@ const DataTable: React.FC<DataTableProps> = ({ header,displaySelect, data, loadi
<tbody className="bg-white dark:bg-gray-800">
{data.length ? data.map((ele, index) => (

<tr className={`${index % 2 !== 0 ? 'bg-gray-50 dark:bg-gray-700' : ''}`} >
<tr key={index+1} className={`${index % 2 !== 0 ? 'bg-gray-50 dark:bg-gray-700' : ''}`} >

{ele.data.map(subEle => (
<td className={` p-4 text-sm font-normal text-gray-900 whitespace-nowrap dark:text-white align-middle `}>
<td key={index+1} className={` p-4 text-sm font-normal text-gray-900 whitespace-nowrap dark:text-white align-middle `}>
<div>{subEle.data}</div>
{subEle.subData && subEle.subData}
</td>
Expand Down
13 changes: 8 additions & 5 deletions src/components/CreateEcosystemOrgModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,14 @@ const CreateEcosystemOrgModal = (props: IProps) => {
return (
<Modal show={props.openModal} onClose={() => {
setLogoImage({
logoFile: "",
imagePreviewUrl: "",
fileName: ''
logoFile: " ",
imagePreviewUrl: " ",
fileName: ' '
})
setFormData({
name:" ",
description:" "
})
setFormData(initialFormData)
props.setOpenModal(false)
}
}>
Expand Down Expand Up @@ -267,8 +270,8 @@ const CreateEcosystemOrgModal = (props: IProps) => {
values: Values,
{ resetForm }: FormikHelpers<Values>
) => {

submit(values)
resetForm();

}}
>
Expand Down
8 changes: 4 additions & 4 deletions src/components/Ecosystem/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,12 @@ const Dashboard = () => {
>
<div>Edit Ecosystem</div>
</Dropdown.Item>
<Dropdown.Item>
{/* <Dropdown.Item>
<div>Enable/Disable Ecosystem</div>
</Dropdown.Item>
<Dropdown.Item>
</Dropdown.Item> */}
{/* <Dropdown.Item>
<div>Manual Registration</div>
</Dropdown.Item>
</Dropdown.Item> */}
</Dropdown>
) : (
<svg
Expand Down
10 changes: 6 additions & 4 deletions src/components/Ecosystem/Endorsement/EndorsementPopup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Modal, Spinner } from 'flowbite-react';
import { EndorsementStatus } from '../../../common/enums';
import { EndorsementStatus, EndorsementType } from '../../../common/enums';
import {
ICheckEcosystem,
checkEcosystem,
Expand Down Expand Up @@ -114,15 +114,17 @@ const EndorsementPopup = (props: {
};

return (
<Modal show={props.openModal} onClose={() => {
<Modal
className='h-full'
show={props.openModal} onClose={() => {
props.closeModal()
setErrMsg(null)
}} size="xl">
<Modal.Header>
{isEcosystemData?.isEcosystemLead ? (
<div>Requested {props.endorsementData?.type}</div>
<div>Requested {props.endorsementData?.type === EndorsementType.credDef ? "Credential Definition" : "Schema" }</div>
) : (
<div>View {props.endorsementData?.type}</div>
<div>View {props.endorsementData?.type === EndorsementType.credDef ? "Credential Definition" : "Schema"}</div>
)}
</Modal.Header>
<div className="mt-3 mx-3 -mb-3">
Expand Down
83 changes: 54 additions & 29 deletions src/components/Ecosystem/MemberList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import type { TableData } from '../../commonComponents/datatable/interface';
import DateTooltip from '../Tooltip';
import { dateConversion } from '../../utils/DateConversion';
import { AlertComponent } from '../AlertComponent';
import { Pagination } from 'flowbite-react';
import { Button, Pagination } from 'flowbite-react';
import { pathRoutes } from '../../config/pathRoutes';

const initialPageState = {
pageNumber: 1,
Expand All @@ -31,22 +32,23 @@ const MemberList = () => {
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
const totalPages = data?.data?.totalPages;

const compareMembers=(
firstMember: { ecosystemRole: { name: string; }; },
secondMember: { ecosystemRole: { name: string; }; }
)=> {
const compareMembers = (
firstMember: { ecosystemRole: { name: string } },
secondMember: { ecosystemRole: { name: string } },
) => {
const firstName = firstMember?.ecosystemRole?.name;
const secondName = secondMember?.ecosystemRole?.name;

if (firstName > secondName) {
return 1;
} else if (secondName > firstName) {
return -1;
} else {
return 0;

switch (true) {
case firstName > secondName:
return 1;
case secondName > firstName:
return -1;
default:
return 0;
}
}
const sortedMemberList = data?.data?.members?.sort(compareMembers)
};
const sortedMemberList = data?.data?.members?.sort(compareMembers);
const membersData = sortedMemberList?.map(
(member: {
ecosystemRole: { name: string };
Expand All @@ -58,13 +60,15 @@ const MemberList = () => {
return {
data: [
{
data: member.orgName || 'Not avilable',
data: member.orgName || 'Not available',
},
{
data: <DateTooltip date={member?.createDateTime}>
{dateConversion(member?.createDateTime)}{' '}

</DateTooltip> || 'Not available'
data:
(
<DateTooltip date={member?.createDateTime}>
{dateConversion(member?.createDateTime)}{' '}
</DateTooltip>
) || 'Not available',
},
{
data: member.ecosystemRole.name ? (
Expand All @@ -78,7 +82,7 @@ const MemberList = () => {
{member.ecosystemRole.name}
</span>
) : (
'Not avilable'
'Not available'
),
},
{
Expand All @@ -93,7 +97,7 @@ const MemberList = () => {
{member.status}
</span>
) : (
'Not avilable'
'Not available'
),
},
{
Expand Down Expand Up @@ -126,8 +130,6 @@ const MemberList = () => {
setLoading(false);
};



const onPageChange = (page: number) => {
setCurrentPage({
...currentPage,
Expand Down Expand Up @@ -156,12 +158,35 @@ const MemberList = () => {
<h2 className="text-xl dark:text-white font-medium font-body">
Ecosystem Members
</h2>
<a
href={`/ecosystem/sent-invitations`}
className="text-lg text-primary-700 dark:text-primary-600 hover:text-primary-800"

<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"
>
Sent Invitations
</a>
<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 All @@ -176,7 +201,7 @@ const MemberList = () => {
loading={loading}
></DataTable>

{currentPage.pageNumber > 1 && (
{currentPage.total > 1 && (
<div className="flex items-center justify-end mb-4">
<Pagination
currentPage={currentPage.pageNumber}
Expand Down
22 changes: 4 additions & 18 deletions src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import CustomSpinner from '../CustomSpinner';
import { getFromLocalStorage } from '../../api/Auth';
import { getOrganizationById, getOrganizations } from '../../api/organization';
import EcoInvitationList from './EcoInvitationList';
import { getOrgDetails } from '../../config/ecosystem';
import BackButton from '../../commonComponents/backbutton'

const initialPageState = {
pageNumber: 1,
Expand Down Expand Up @@ -256,23 +258,7 @@ const ReceivedInvitations = () => {
<div className="mb-4 col-span-full xl:mb-2">
<div className="flex justify-between items-center">
<BreadCrumbs />
<Button
type="submit"
color='bg-primary-800'
onClick={() => {
window.location.href = `${pathRoutes.ecosystem.root}`
}}
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 mr-2 ml-auto dark:text-white dark:hover:text-black
dark:hover:bg-primary-50'
style={{ height: '2.5rem', width: '5rem', minWidth: '2rem' }}
>
<svg className='mr-1' xmlns="http://www.w3.org/2000/svg" width="22" height="12" fill="none" viewBox="0 0 30 20">
<path fill="#1F4EAD" d="M.163 9.237a1.867 1.867 0 0 0-.122 1.153c.083.387.287.742.587 1.021l8.572 7.98c.198.19.434.343.696.447a2.279 2.279 0 0 0 1.657.013c.263-.1.503-.248.704-.435.201-.188.36-.41.468-.655a1.877 1.877 0 0 0-.014-1.543 1.999 1.999 0 0 0-.48-.648l-4.917-4.576h20.543c.568 0 1.113-.21 1.515-.584.402-.374.628-.882.628-1.411 0-.53-.226-1.036-.628-1.41a2.226 2.226 0 0 0-1.515-.585H7.314l4.914-4.574c.205-.184.368-.404.48-.648a1.878 1.878 0 0 0 .015-1.542 1.99 1.99 0 0 0-.468-.656A2.161 2.161 0 0 0 11.55.15a2.283 2.283 0 0 0-1.657.013 2.154 2.154 0 0 0-.696.447L.626 8.589a1.991 1.991 0 0 0-.463.648Z" />
</svg>
<span className="min-[320px]:hidden sm:block">Back</span>
</Button>
<BackButton path={pathRoutes.ecosystem.root} />
</div>
<h1 className="ml-1 text-xl font-semibold text-gray-900 sm:text-2xl dark:text-white">
Received Ecosystem Invitations
Expand Down Expand Up @@ -379,7 +365,7 @@ const ReceivedInvitations = () => {
)
)}

{currentPage.pageNumber > 1 && <div className="flex items-center justify-end mb-4">
{currentPage.total > 1 && <div className="flex items-center justify-end mb-4">
<Pagination
currentPage={currentPage.pageNumber}
onPageChange={onPageChange}
Expand Down
2 changes: 1 addition & 1 deletion src/components/EcosystemInvite/SentInvitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ const SentInvitations = () => {
</div>
)}

{currentPage.pageNumber >1 && (
{currentPage.total > 1 && (
<div className="flex items-center justify-end mb-4">
<Pagination
currentPage={currentPage.pageNumber}
Expand Down
20 changes: 3 additions & 17 deletions src/components/Issuance/Connections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { pathRoutes } from "../../config/pathRoutes";
import BreadCrumbs from "../BreadCrumbs";
import ConnectionList from "./ConnectionList";
import EmailList from "./EmailList";
import BackButton from '../../commonComponents/backbutton'


const Connections = () => {
const [selectedConnectionList, setSelectedConnectionList] = useState<TableData[]>([])
Expand All @@ -36,23 +38,7 @@ const Connections = () => {
<div className="mb-4 col-span-full xl:mb-2">
<div className="flex justify-between items-center">
<BreadCrumbs />
<Button
type="submit"
color='bg-primary-800'
onClick={() => {
window.location.href = `${pathRoutes.back.issuance.credDef}`
}}
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 mr-2 ml-auto dark:text-white dark:hover:text-black
dark:hover:bg-primary-50'
style={{ height: '2.5rem', width: '5rem', minWidth: '2rem' }}
>
<svg className='mr-1' xmlns="http://www.w3.org/2000/svg" width="22" height="12" fill="none" viewBox="0 0 30 20">
<path fill="#1F4EAD" d="M.163 9.237a1.867 1.867 0 0 0-.122 1.153c.083.387.287.742.587 1.021l8.572 7.98c.198.19.434.343.696.447a2.279 2.279 0 0 0 1.657.013c.263-.1.503-.248.704-.435.201-.188.36-.41.468-.655a1.877 1.877 0 0 0-.014-1.543 1.999 1.999 0 0 0-.48-.648l-4.917-4.576h20.543c.568 0 1.113-.21 1.515-.584.402-.374.628-.882.628-1.411 0-.53-.226-1.036-.628-1.41a2.226 2.226 0 0 0-1.515-.585H7.314l4.914-4.574c.205-.184.368-.404.48-.648a1.878 1.878 0 0 0 .015-1.542 1.99 1.99 0 0 0-.468-.656A2.161 2.161 0 0 0 11.55.15a2.283 2.283 0 0 0-1.657.013 2.154 2.154 0 0 0-.696.447L.626 8.589a1.991 1.991 0 0 0-.463.648Z" />
</svg>
<span className="min-[320px]:hidden sm:block"> Back</span>
</Button>
<BackButton path={pathRoutes?.back?.issuance?.credDef}/>
</div>
</div>

Expand Down
Loading

0 comments on commit d49b3d5

Please sign in to comment.