Skip to content

Commit

Permalink
Merge pull request #345 from credebl/fix-ecosystem-flow-issues
Browse files Browse the repository at this point in the history
Fix ecosystem flow issues
  • Loading branch information
nishad-ayanworks authored Oct 14, 2023
2 parents d6e1b12 + c749af5 commit b7d5302
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 74 deletions.
82 changes: 37 additions & 45 deletions src/components/Ecosystem/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ const initialPageState = {
};

export const RoleTablet = ({ role }: IRoleTablet) => (
<div className="text-[#467FFF] bg-[#C8DCFF] w-fit py-1.5 px-3 rounded-full ml-3">
{role}
</div>
);
<div className='bg-primary-100 text-primary-800 dark:bg-gray-900 dark:text-primary-400 border border-primary-100 dark:border-primary-500 mr-2 px-2.5 py-1 rounded-md m-1'>{role}</div>
)

const Dashboard = () => {
const [ecosystemDetails, setEcosystemDetails] = useState<IEcosystem | null>();
Expand Down Expand Up @@ -248,33 +246,39 @@ const Dashboard = () => {
setMessage(null);
setError(null);
}}
/>
}
</div>
/>}
</div>

{(success || failure) && (
<AlertComponent
message={success ?? failure}
type={success ? 'success' : 'failure'}
onAlertClose={() => {
setSuccess(null);
setFailure(null);
}}
/>
)}
</>
{(success || failure) && (
<AlertComponent
message={success ?? failure}
type={success ? 'success' : 'failure'}
onAlertClose={() => {
setSuccess(null);
setFailure(null);
}}
/>
)}
</>
)}

{
ecosystemDetailsNotFound && (
<AlertComponent
message="Ecosystem details not found."
type="failure"
onAlertClose={() => {
setEcosystemDetailsNotFound(false);
setFailure(null);
}}
/>
)
}

{ecosystemDetails ? (
<div>
<div
className={`mt-4 flex-wrap items-center justify-between p-4 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 sm:p-6 dark:bg-gray-800 ${isEcosystemLead ? 'w-full block' : 'flex'
}`}
>
<div
className={`flex flex-wrap ${!isEcosystemLead ? 'w-full items-start' : 'items-center'
}`}
>
<div className={`mt-4 flex-wrap items-center justify-between p-4 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 sm:p-6 dark:bg-gray-800 ${isEcosystemLead ? "w-full block" : "flex"}`}>
<div className={`flex flex-wrap ${!isEcosystemLead ? "w-full items-start" : "items-center"}`}>
<div className="mr-4">
{ecosystemDetails?.logoUrl ? (
<CustomAvatar size="80" src={ecosystemDetails?.logoUrl} />
Expand Down Expand Up @@ -484,12 +488,10 @@ const Dashboard = () => {
isorgModal={isOrgModal}
/>
<EmptyListMessage
feature={!orgId ? Features.CRETAE_ORG : ''}
feature={!orgId ? Features.CRETAE_ORG : ""}
message={'No Ecosystem found'}
description={`Get started by creating an ${!orgId ? 'Organization' : 'Ecosystem'
}`}
buttonContent={`Create ${!orgId ? 'Organization' : 'Ecosystem'
}`}
description={`Get started by creating ${!orgId ? "a new Organization to set up your Ecosystem" : "an Ecosystem"}`}
buttonContent={`${!orgId ? '' : 'Create Ecosystem'}`}
svgComponent={
<svg
className="pr-2 mr-1"
Expand All @@ -514,20 +516,10 @@ const Dashboard = () => {
</div>
)}
</div>
)}

{ecosystemDetailsNotFound && (
<AlertComponent
message="Ecosystem details not found."
type="failure"
onAlertClose={() => {
setEcosystemDetailsNotFound(false);
setFailure(null);
}}
/>
)}
</div>
)
}
</div >
);
};

export default Dashboard;
export default Dashboard;
25 changes: 14 additions & 11 deletions src/components/Ecosystem/MemberList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ const MemberList = () => {
<span
className={`${
member.ecosystemRole.name === 'Ecosystem Lead'
? 'bg-primary-100 text-primary-800 rounded dark:bg-gray-900 dark:text-primary-400 border border-primary-100 dark:border-primary-500'
: 'bg-green-100 text-green-800 rounded 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'`}
? 'bg-primary-100 text-primary-800 dark:bg-gray-900 dark:text-primary-400 border border-primary-100 dark:border-primary-500'
: '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}
</span>
Expand All @@ -88,7 +88,7 @@ const MemberList = () => {
member.status === 'SUSPENDED'
? 'bg-red-100 text-red-800 rounded dark:bg-gray-900 dark:text-red-300 border-red-100 dark:border-red-500 border'
: 'bg-green-100 text-green-700 dark:bg-gray-700 dark:text-green-400 rounded border border-green-100 dark:border-green-500'
}'text-sm font-medium mr-2 px-2.5 py-1 rounded'`}
} text-sm font-medium mr-2 px-2.5 py-1 rounded-md`}
>
{member.status}
</span>
Expand Down Expand Up @@ -175,13 +175,16 @@ const MemberList = () => {
data={memberList}
loading={loading}
></DataTable>
<div className="flex items-center justify-end mb-4">
<Pagination
currentPage={currentPage.pageNumber}
onPageChange={onPageChange}
totalPages={currentPage.total}
/>
</div>

{currentPage.pageNumber > 1 && (
<div className="flex items-center justify-end mb-4">
<Pagination
currentPage={currentPage.pageNumber}
onPageChange={onPageChange}
totalPages={currentPage.total}
/>
</div>
)}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type { AxiosResponse } from 'axios';
import BreadCrumbs from '../BreadCrumbs';
import type { Invitation } from '../organization/interfaces/invitations';
import type { Organisation } from '../organization/interfaces';
import SendInvitationModal from '../organization/invitations/SendInvitationModal';
import { apiStatusCodes, storageKeys } from '../../config/CommonConstant';
import { pathRoutes } from '../../config/pathRoutes';
import { EmptyListMessage } from '../EmptyListComponent';
Expand Down Expand Up @@ -223,7 +222,7 @@ const ReceivedInvitations = () => {
<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>
<span className="min-[320px]:hidden sm:block">Back</span>
</Button>
</div>
<h1 className="ml-1 text-xl font-semibold text-gray-900 sm:text-2xl dark:text-white">
Expand Down Expand Up @@ -320,13 +319,13 @@ const ReceivedInvitations = () => {
)
)}

<div className="flex items-center justify-end mb-4">
{currentPage.pageNumber > 1 && <div className="flex items-center justify-end mb-4">
<Pagination
currentPage={currentPage.pageNumber}
onPageChange={onPageChange}
totalPages={currentPage.total}
/>
</div>
</div>}
</div>
</div>
</div>
Expand Down
26 changes: 16 additions & 10 deletions src/components/EcosystemInvite/SentInvitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ const SentInvitations = () => {
<div className="flow-root">
<ul className="divide-y divide-gray-200 dark:divide-gray-700">
{invitationsList.map((invitation) => (
<li key={invitation.id} className="p-4 min-[320px]:h-52 sm:h-48 md:h-[150px] items-center">
<li
key={invitation.id}
className="p-4 min-[320px]:h-52 sm:h-48 md:h-[150px] items-center"
>
<div className="flex flex-wrap justify-between align-middle 2xl:flex items-center 2xl:space-x-4">
<div className=" xl:mb-4 2xl:mb-0">
<div className="flex space-x-4">
Expand Down Expand Up @@ -190,9 +193,10 @@ const SentInvitations = () => {
: invitation.status === 'accepted'
? 'bg-green-100 text-green-700 dark:bg-gray-700 dark:text-green-400 rounded border border-green-100 dark:border-green-500'
: 'bg-red-100 text-red-800 rounded dark:bg-gray-900 dark:text-red-300 border-red-100 dark:border-red-500 border'
} m-1 text-sm font-medium px-2.5 py-0.5 rounded`}
} m-1 text-sm font-medium px-2.5 py-0.5 rounded-md`}
>
{invitation?.status?.charAt(0).toUpperCase() + invitation?.status?.slice(1)}
{invitation?.status?.charAt(0).toUpperCase() +
invitation?.status?.slice(1)}
</span>
</div>
{invitation.status === 'pending' && (
Expand Down Expand Up @@ -245,13 +249,15 @@ const SentInvitations = () => {
</div>
)}

<div className="flex items-center justify-end mb-4">
<Pagination
currentPage={currentPage.pageNumber}
onPageChange={onPageChange}
totalPages={currentPage.total}
/>
</div>
{currentPage.pageNumber >1 && (
<div className="flex items-center justify-end mb-4">
<Pagination
currentPage={currentPage.pageNumber}
onPageChange={onPageChange}
totalPages={currentPage.total}
/>
</div>
)}
</div>
</div>
</div>
Expand Down
6 changes: 2 additions & 4 deletions src/components/User/UserDashBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,10 @@ const UserDashBoard = () => {
}}
/>
</div>

<div className="cursor-pointer">
<AlertComponent
message={ecoMessage ? ecoMessage : error}
type={ecoMessage ? 'warning' : 'failure'}
message={ecoMessage}
type={'warning'}
viewButton={viewButton}
path={pathRoutes.ecosystem.invitation}
onAlertClose={() => {
Expand All @@ -184,7 +183,6 @@ const UserDashBoard = () => {
}}
/>
</div>

<div className="grid w-full grid-cols-1 gap-4 mt-0 mb-4 xl:grid-cols-2 2xl:grid-cols-3">
<div className=" justify-between p-4 bg-white border border-gray-200 rounded-lg shadow-sm sm:flex dark:border-gray-700 sm:p-6 dark:bg-gray-800">
<div className="w-full">
Expand Down

0 comments on commit b7d5302

Please sign in to comment.