Skip to content

Commit

Permalink
Merge pull request #348 from credebl/fix-minor-issues
Browse files Browse the repository at this point in the history
fix: pagination issues in invitation and member list
  • Loading branch information
sanjay-k1910 authored Oct 16, 2023
2 parents b7d5302 + fd8de7d commit 53383df
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 32 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
27 changes: 14 additions & 13 deletions src/components/Ecosystem/MemberList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,23 @@ const MemberList = () => {
const { data } = response as AxiosResponse;
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
const totalPages = data?.data?.totalPages;

const compareMembers=(
firstMember: { 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 membersData = sortedMemberList?.map(
(member: {
Expand All @@ -58,7 +59,7 @@ const MemberList = () => {
return {
data: [
{
data: member.orgName || 'Not avilable',
data: member.orgName || 'Not available',
},
{
data: <DateTooltip date={member?.createDateTime}>
Expand Down Expand Up @@ -176,7 +177,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
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,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
17 changes: 1 addition & 16 deletions src/components/Resources/Schema/SchemasList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,7 @@ const SchemaList = (props: { schemaSelectionCallback: (schemaId: string, schemaD
</div>)
:
(
<div>
{walletStatus ?
<EmptyListMessage
<EmptyListMessage
message={emptyListTitle}
description={emptyListDesc}
buttonContent={emptyListBtn}
Expand All @@ -284,19 +282,6 @@ const SchemaList = (props: { schemaSelectionCallback: (schemaId: string, schemaD
window.location.href = `${pathRoutes.organizations.createSchema}?OrgId=${orgId}`
}}
/>
:
<EmptyListMessage
message={'No Wallet'}
description={'Get started by creating a Wallet'}
buttonContent={'Create Wallet'}
svgComponent={<svg className='pr-2 mr-1' xmlns="http://www.w3.org/2000/svg" width="24" height="15" fill="none" viewBox="0 0 24 24">
<path fill="#fff" d="M21.89 9.89h-7.78V2.11a2.11 2.11 0 1 0-4.22 0v7.78H2.11a2.11 2.11 0 1 0 0 4.22h7.78v7.78a2.11 2.11 0 1 0 4.22 0v-7.78h7.78a2.11 2.11 0 1 0 0-4.22Z" />
</svg>}
onClick={() => {
window.location.href = `${pathRoutes.organizations.dashboard}?OrgId=${orgId}`
}}
/>}
</div>
)
}
</div>
Expand Down

0 comments on commit 53383df

Please sign in to comment.