Skip to content

Commit

Permalink
Merge pull request #422 from credebl/fix-prod-dev-merge-9nov
Browse files Browse the repository at this point in the history
prod to dev merge
  • Loading branch information
nishad-ayanworks authored Nov 9, 2023
2 parents 393fff7 + 197ad7a commit 1100702
Show file tree
Hide file tree
Showing 64 changed files with 9,430 additions and 3,334 deletions.
317 changes: 124 additions & 193 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"react": "^18.2.0",
"react-avatar": "^5.0.3",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"react-icons": "^4.10.1",
"react-qr-code": "^2.0.11",
"react-toastify": "^9.1.3",
Expand Down
2,130 changes: 2,130 additions & 0 deletions 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 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.
358 changes: 358 additions & 0 deletions public/images/Frame.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/blue_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/half_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/images/person_FILL1_wght400_GRAD0_opsz24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/api/ecosystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface CreateEcosystemPayload {
logo: string;
tags?: string;
userId: number;
autoEndorsement: boolean;
}

export interface GetEndorsementListParameter {
Expand Down Expand Up @@ -62,9 +63,8 @@ export const updateEcosystem = async (dataPayload: CreateEcosystemPayload) => {
}
};

export const getEcosystem = async (orgId: string) => {
export const getEcosystems = async (orgId: string, pageNumber?: number, pageSize?: number, search = '') => {
const url = `${apiRoutes.Ecosystem.root}/${orgId}`;

const axiosPayload = {
url,
config: await getHeaderConfigs(),
Expand Down
24 changes: 11 additions & 13 deletions src/app/LayoutCommon.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import pkg from '../../package.json' assert { type: 'json' };
import HelmetHead from '../components/HelmetHead';
import { url } from '../lib/data.js';
import { SITE_TITLE } from './constants.js';
Expand All @@ -17,18 +18,15 @@ const supabaseKey = process.env.PUBLIC_SUPABASE_KEY || import.meta.env.PUBLIC_SU
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{SITE_TITLE} — v{pkg.version}</title>

<meta name="generator" content={Astro.generator} />
<meta name="description" content={pkg.description} />
<meta name="" content={pkg.description} />
<link rel="icon" type="image/svg+xml" href={url('favicon.svg')} />
<link rel="sitemap" type="application/xml" href={url('sitemap-index.xml')} />

<meta name="author" content="Julian Cataldo, Zoltán Szőgyényi, Robert Tanislav" />
<meta name="copyright" content="MIT" />
<HelmetHead
siteTitle={SITE_TITLE}
version={pkg.version}
generator={Astro.generator}
desc={pkg.description}
icon={url('favicon.svg')}
sitemap={url('sitemap-index.xml')}
client:load
/>

<script is:inline>
if (
Expand All @@ -46,7 +44,7 @@ const supabaseKey = process.env.PUBLIC_SUPABASE_KEY || import.meta.env.PUBLIC_SU
<body class:list={[ // clazz, 'bg-gray-50 dark:bg-gray-800'
, 'scrollbar scrollbar-w-3 scrollbar-thumb-rounded-[0.25rem]'
, 'scrollbar-track-slate-200 scrollbar-thumb-gray-400'
, 'dark:scrollbar-track-gray-900 dark:scrollbar-thumb-gray-700' , ]}>
, 'dark:scrollbar-track-gray-900 dark:scrollbar-thumb-gray-700' , 'dark:bg-[#111827]']}>
<slot />
</body>

Expand Down
287 changes: 166 additions & 121 deletions src/app/SideBar.astro

Large diffs are not rendered by default.

145 changes: 145 additions & 0 deletions src/commonComponents/EcosystemProfileCard.tsx
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
80 changes: 80 additions & 0 deletions src/commonComponents/EndorsementTooltip.tsx
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>
)
}
6 changes: 3 additions & 3 deletions src/commonComponents/SchemaCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ const SchemaCard = (props: IProps) => {
</div>
</div>
<div className="min-w-0 flex-1">
<p className="truncate text-sm font-medium text-gray-900 dark:text-white pb-2">
<p className="truncate text-sm font-regular text-gray-900 dark:text-white pb-2">
<span className="font-semibold">Schema ID:</span> {props.schemaId}
</p>
<p className="truncate text-sm font-medium text-gray-900 dark:text-white pb-2">
<p className="truncate text-sm font-regular text-gray-900 dark:text-white pb-2">
<span className="font-semibold">Issuer DID:</span> {props.issuerDid}
</p>
<p className="truncate text-sm font-medium text-gray-900 dark:text-white">
<p className="truncate text-sm font-regular text-gray-900 dark:text-white">
<span className="font-semibold">Ledger:</span> {props.issuerDid.split(":")[2]}
</p>
</div>
Expand Down
Loading

0 comments on commit 1100702

Please sign in to comment.