Skip to content

Commit

Permalink
refactor: explore organization details (#383)
Browse files Browse the repository at this point in the history
* worked on the fix of explore organizations

Signed-off-by: Nishad <[email protected]>

* trial for the explore org fix

Signed-off-by: Nishad <[email protected]>

* displayed org profile

Signed-off-by: Nishad <[email protected]>

* displayed org data

Signed-off-by: Nishad <[email protected]>

* trial for API call in ssr

Signed-off-by: Nishad <[email protected]>

* Included headers in the fetch api call

Signed-off-by: Nishad <[email protected]>

* Created a public organizations and fetched API

Signed-off-by: Nishad <[email protected]>

* fixed the explore organizations issue

Signed-off-by: Nishad <[email protected]>

* resolved the comments on the PR

Signed-off-by: Nishad <[email protected]>

* explore organization details alignments changes

Signed-off-by: Nishad <[email protected]>

* refactor org wallet

Signed-off-by: Nishad <[email protected]>

* removed unnecessary imports

Signed-off-by: Nishad <[email protected]>

* cosmetic changes

Signed-off-by: Nishad <[email protected]>

---------

Signed-off-by: Nishad <[email protected]>
  • Loading branch information
nishad-ayanworks authored Oct 23, 2023
1 parent ab89e50 commit 393fff7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 43 deletions.
24 changes: 2 additions & 22 deletions src/components/organization/PublicOrganizationDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ import { getPublicOrgDetails } from '../../api/organization'
import { apiStatusCodes } from "../../config/CommonConstant";
import ProfilesDesign from "../publicProfile/ProfilesDesign";
import OrgWalletDetails from "../publicProfile/OrgWalletDetails";
import OrgUserInfo from "../publicProfile/OrgUserInfo";
import { AlertComponent } from "../AlertComponent";
import CustomSpinner from "../CustomSpinner";
import { OrgInterface } from "./interfaces";
import { Roles } from "../../utils/enums/roles";


const PublicOrganizationDetails = ({ orgSlug }: { orgSlug: string }) => {

const [orgData, setOrgData] = useState<OrgInterface | null>(null);
const [orgUsersData, setOrgUsersData] = useState<object | null>(null);
const [loading, setLoading] = useState<boolean>(true);
const [error, setError] = useState<string | null>(null);

Expand All @@ -28,19 +24,6 @@ const PublicOrganizationDetails = ({ orgSlug }: { orgSlug: string }) => {

setOrgData(data?.data);

const orgUsersFilterByRole = data?.data?.userOrgRoles?.filter(
(users: { orgRole: { name: string }; }) => {
return users?.orgRole.name === Roles.OWNER
},
);

const usersData = orgUsersFilterByRole?.map(
(users: { user: { firstName: string } }) => {
return users?.user;
},
);

setOrgUsersData(usersData);
} else {
setError(response as string);
}
Expand Down Expand Up @@ -76,12 +59,9 @@ const PublicOrganizationDetails = ({ orgSlug }: { orgSlug: string }) => {
}

</div>
<div className="col-span-3 grid grid-rows-2 gap-4 bg-gray-100">
<div className="col-span-3 grid gap-4 bg-gray-100">
<OrgWalletDetails orgData={orgData} />
<div className="p-2 rounded bg-white">
<h1 className="font-bold text-2xl p-2">Users</h1>
<OrgUserInfo orgUsersData={orgUsersData} />
</div>

</div>
</div>
}
Expand Down
23 changes: 3 additions & 20 deletions src/components/publicProfile/OrgWalletDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import React, { useEffect, useState } from "react"
import { EmptyListMessage } from "../EmptyListComponent";
import CustomQRCode from "../../commonComponents/QRcode";
import DateTooltip from '../Tooltip';
import { dateConversion } from '../../utils/DateConversion';
import { OrgWalletDetailsObject } from "../organization/interfaces";

const OrgWalletDetails = ({orgData}) => {
Expand Down Expand Up @@ -55,23 +53,8 @@ const OrgWalletDetails = ({orgData}) => {
<span className=" w-40">Network</span>
<span className="mx-2">:</span>
<span className="ml-9 text-gray-600">{agentData?.ledgers?.networkType}</span>
</li><li className="flex items-center text-xl">
<span className=" w-40">WalletName</span>
<span className="mx-2">:</span>
<span className="ml-9 text-gray-600">{agentData?.walletName}</span>
</li><li className="flex items-center text-xl">
<span className=" w-40">CreationDate</span>
<span className="mx-2">:</span>
<p
className="ml-9 text-base font-semibold text-gray-900 truncate dark:text-white w-40 md:w-32 lg:w-80"
>
{
agentData?.createDateTime ?
<DateTooltip date={agentData?.createDateTime}> { dateConversion(agentData?.createDateTime) } </DateTooltip> :
<DateTooltip date={agentData?.createDateTime}> { dateConversion(new Date().toISOString()) } </DateTooltip>
}
</p>
</li></>
</li>
</>
))
:
<ul>
Expand All @@ -92,7 +75,7 @@ const OrgWalletDetails = ({orgData}) => {
</div>
{
connectionInvitation
&& <div className="lg:w-1/3 flex flex-col justify-center text-wrap p-2">
&& <div className="lg:w-1/3 flex flex-col text-wrap p-2">
<div className="h-auto flex-col items-center p-4">
<div
className="bg-white p-4 border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 overflow-hidden">
Expand Down
2 changes: 1 addition & 1 deletion src/components/publicProfile/ProfilesDesign.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ProfilesDesign = ({ orgData }: OrgDataInterface) => {
</svg><a href={orgData?.website} target="_blank"> <span className="text-2xl text-gray-500 dark:text-gray-400 pl-2 ">{orgData?.website}</span></a></>
}
</div>
<p className="pt-2 p-4 flex items-center justify-center flex-wrap">{orgData?.description}</p>
<p className="pt-2 p-4 flex items-center justify-center text-gray-900 dark:text-white flex-wrap">{orgData?.description}</p>
</div>
</div>
</div>
Expand Down

0 comments on commit 393fff7

Please sign in to comment.