-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #422 from credebl/fix-prod-dev-merge-9nov
prod to dev merge
- Loading branch information
Showing
64 changed files
with
9,430 additions
and
3,334 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2,130 changes: 2,130 additions & 0 deletions
2,130
public/images/Endorsement_Infographic_Dark_Mode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,195 changes: 2,195 additions & 0 deletions
2,195
public/images/Endorsement_Infographic_Ligh_Mode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
import { useEffect, useState } from 'react' | ||
import { Card } from 'flowbite-react'; | ||
import type { IEcosystem } from '../components/Ecosystem/interfaces'; | ||
import { getFromLocalStorage, removeFromLocalStorage, setToLocalStorage } from '../api/Auth'; | ||
import { apiStatusCodes, storageKeys } from '../config/CommonConstant'; | ||
import type { AxiosResponse } from 'axios'; | ||
import { getEcosystems } from '../api/ecosystem'; | ||
import CustomAvatar from '../components/Avatar'; | ||
import { RoleTablet } from '../components/Ecosystem/Dashboard' | ||
import CustomSpinner from '../components/CustomSpinner'; | ||
import { pathRoutes } from '../config/pathRoutes'; | ||
import { EmptyListMessage } from '../components/EmptyListComponent'; | ||
|
||
const EcosystemProfileCard = () => { | ||
const [ecosystemDetails, setEcosystemDetails] = useState<IEcosystem | null>(); | ||
const [ecosystemList, setEcosystemList] = useState<IEcosystem[] | null>(); | ||
const [loading, setLoading] = useState<boolean>(); | ||
const [ecosystemId, setEcosystemId] = useState<string>(); | ||
|
||
const fetchEcosystemDetails = async (ecoId?: string) => { | ||
setLoading(true); | ||
try { | ||
const id = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const ecosystemId = ecoId || await getFromLocalStorage(storageKeys.ECOSYSTEM_ID); | ||
console.log(4561, id) | ||
if (id) { | ||
const response = await getEcosystems(id); | ||
setLoading(false) | ||
const { data } = response as AxiosResponse; | ||
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { | ||
setEcosystemList(data?.data) | ||
const ecosystemData = data?.data?.find((item: { id: string }) => item.id === ecosystemId); | ||
console.log(4545, ecosystemData) | ||
if (ecosystemData) { | ||
setEcosystemId(ecosystemData?.id) | ||
const ecosystemOrg = | ||
ecosystemData?.ecosystemOrgs && | ||
ecosystemData?.ecosystemOrgs.length > 0 && | ||
ecosystemData?.ecosystemOrgs[0]; | ||
const role = ecosystemOrg && ecosystemOrg?.ecosystemRole?.name | ||
? ecosystemOrg?.ecosystemRole?.name | ||
: '' | ||
await setToLocalStorage(storageKeys.ECOSYSTEM_ROLE, role) | ||
setEcosystemDetails({ | ||
id: ecosystemData?.id, | ||
logoUrl: ecosystemData?.logoUrl, | ||
name: ecosystemData?.name, | ||
description: ecosystemData?.description, | ||
joinedDate: | ||
ecosystemOrg && ecosystemOrg?.createDateTime | ||
? ecosystemOrg?.createDateTime | ||
: '', | ||
role | ||
}); | ||
} else { | ||
await removeFromLocalStorage(storageKeys.ECOSYSTEM_ID); | ||
} | ||
} else { | ||
await removeFromLocalStorage(storageKeys.ECOSYSTEM_ID); | ||
} | ||
} | ||
} catch (err) { | ||
setLoading(false) | ||
} | ||
setLoading(false); | ||
}; | ||
|
||
const handleSelectEcosystem = async (e: { target: { value: string; }; }) => { | ||
await fetchEcosystemDetails(e.target.value) | ||
await setToLocalStorage(storageKeys.ECOSYSTEM_ID, e.target.value); | ||
window.location.reload() | ||
} | ||
|
||
|
||
useEffect(() => { | ||
fetchEcosystemDetails(); | ||
}, []); | ||
|
||
const ecosystemOptions = ecosystemList && ecosystemList.length > 0 && ecosystemList.filter(item => item.id !== ecosystemId) | ||
|
||
return ( | ||
<Card className="m-0"> | ||
{ecosystemDetails ? ( | ||
<div | ||
className={`flex flex-wrap items-center`} | ||
> | ||
<div className="mr-4"> | ||
{ecosystemDetails?.logoUrl ? ( | ||
<CustomAvatar size="60" src={ecosystemDetails?.logoUrl} /> | ||
) : ( | ||
<CustomAvatar size="70" name={ecosystemDetails?.name} /> | ||
)} | ||
</div> | ||
|
||
<div className="w-full sm:w-100/22rem min-w-[12rem]"> | ||
<h3 className="mb-1 text-xl font-bold text-gray-900 dark:text-white"> | ||
{ecosystemDetails?.name} | ||
</h3> | ||
<div className="flex items-center"> | ||
<span className="dark:text-white">Role: </span>{' '} | ||
<RoleTablet role={ecosystemDetails?.role || ''} /> | ||
</div> | ||
</div> | ||
|
||
|
||
<div className="inline-flex items-end ml-auto flex-col"> | ||
{ | ||
Boolean(ecosystemOptions && ecosystemOptions.length > 0) && | ||
<select | ||
className="mb-4 bg-gray-50 sm:min-w-[244px] border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" | ||
onChange={handleSelectEcosystem} | ||
> | ||
<option selected>Select Ecosystem</option> | ||
{ | ||
ecosystemOptions && ecosystemOptions.length > 0 && ecosystemOptions.map(item => ( | ||
<option key={item.id} value={item.id}>{item.name}</option> | ||
)) | ||
} | ||
</select> | ||
} | ||
<a href={pathRoutes.ecosystem.dashboard} className='flex text-primary-700 dark:text-secondary-700 text-sm font-medium underline-offset-4 hover:underline'> | ||
Go to Dashboard | ||
<svg fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" className='h-4 w-4 text-primary-700 dark:text-secondary-700 ml-1'> | ||
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"></path> | ||
</svg> | ||
</a> | ||
</div> | ||
|
||
</div> | ||
) : !ecosystemDetails && loading ? ( | ||
<CustomSpinner /> | ||
) : | ||
<EmptyListMessage | ||
message={'No Ecosystem'} | ||
description={'Get started by creating a new Ecosystem'} | ||
buttonContent={''} | ||
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>} /> | ||
} | ||
</Card> | ||
) | ||
} | ||
|
||
export default EcosystemProfileCard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { Tooltip } from 'flowbite-react'; | ||
import React from 'react' | ||
|
||
export default function EndorsementTooltip() { | ||
|
||
const tooltipData = [ | ||
{ | ||
outerClass: 'hidden sm:block dark:hidden', | ||
placement: 'top-start', | ||
style: 'light', | ||
content: ( | ||
<img | ||
src="/images/Endorsement_Infographic_Ligh_Mode.svg" | ||
height={600} | ||
width={450} | ||
/> | ||
), | ||
}, | ||
{ | ||
outerClass: 'block sm:hidden dark:hidden', | ||
placement: '', | ||
style: 'light', | ||
content: ( | ||
<img | ||
src="/images/Endorsement_Infographic_Ligh_Mode.svg" | ||
height={600} | ||
width={450} | ||
/> | ||
), | ||
}, | ||
{ | ||
outerClass: 'hidden dark:block', | ||
placement: 'top-start', | ||
style: 'dark', | ||
content: ( | ||
<img | ||
src="/images/Endorsement_Infographic_Dark_Mode.svg" | ||
height={600} | ||
width={450} | ||
/> | ||
), | ||
}, | ||
]; | ||
|
||
return ( | ||
<div> | ||
|
||
{tooltipData.map((item) => ( | ||
<div key={item.outerClass} className={item.outerClass}> | ||
<Tooltip | ||
className="shadow-[0_0_12px_12px_rgba(0,0,0,0.1)]" | ||
placement={item.placement} | ||
style={item.style} | ||
content={item.content} | ||
> | ||
<svg | ||
className="ml-2" | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="12" | ||
height="12" | ||
fill="none" | ||
viewBox="0 0 12 12" | ||
> | ||
<path | ||
fill="#1D4EB5" | ||
fillRule="evenodd" | ||
d="M0 6a6 6 0 1 1 12 0A6 6 0 0 1 0 6ZM6 .837a5.163 5.163 0 1 0 0 10.326A5.163 5.163 0 0 0 6 .837Z" | ||
clipRule="evenodd" | ||
/> | ||
<path | ||
fill="#1D4EB5" | ||
d="M6 9.21a.419.419 0 0 0 .42-.42V5.443a.419.419 0 0 0-.838 0v3.349c0 .231.187.418.419.418Zm0-6a.558.558 0 1 1 0 1.117.558.558 0 0 1 0-1.116Z" | ||
/> | ||
</svg> | ||
</Tooltip> | ||
</div> | ||
))} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.