Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: verification with email #722

Merged
merged 7 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions src/commonComponents/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import React from 'react';
import { Card } from 'flowbite-react';
import BackButton from '../commonComponents/backbutton';
import BreadCrumbs from '../components/BreadCrumbs'

const Dashboard = ({ title, options, backButtonPath }) => {
return (
<div className="px-4 pt-2 h-full h-[700px]">
<div className="mt-1">
<BreadCrumbs />
</div>
<div className="mb-2 flex justify-between items-center relative">
<h1 className="text-xl font-semibold text-gray-900 sm:text-2xl dark:text-white">
{title}
</h1>
<BackButton path={backButtonPath} />
</div>
<div className="px-6 pt-6 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 dark:bg-gray-800">
<p className="text-gray-900 text-xl text-start font-medium dark:text-white">
Select the appropriate action
</p>
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8 pb-16 pt-12">
{options.map((option) => (
<Card
key={option.heading}
className={`${
option.path
? 'custom-card group transform transition duration-500 ease-in-out overflow-hidden overflow-ellipsis border border-gray-200 shadow-md hover:scale-105 cursor-pointer dark:hover:bg-primary-700 hover:bg-primary-700'
: 'cursor-not-allowed bg-gray-300 text-gray-500 dark:border-gray-600 dark:bg-gray-700'
}`}
style={{
maxHeight: '100%',
overflow: 'auto',
height: '168px',
color: 'inherit',
}}
onClick={() => option.path && (window.location.href = option.path)}
>
<div
className={`flex items-center min-[401px]:flex-nowrap flex-wrap ${
option.path ? 'group-hover:text-white' : ''
}`}
style={{ color: 'inherit' }}
>
<div className="ml-4">
<h5
className={`text-2xl font-semibold ${
option.path
? 'text-primary-700 dark:text-white group-hover:text-white'
: 'text-gray-500'
} pb-2`}
>
{option.heading}
</h5>
<p
className={`text-sm ${
option.path
? 'text-gray-700 dark:text-white group-hover:text-white'
: 'text-gray-500'
}`}
>
{option.description}
</p>
</div>
</div>
</Card>
))}
</div>
</div>
</div>
);
};

export default Dashboard;
60 changes: 9 additions & 51 deletions src/components/Issuance/IssueDashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import '../../common/global.css';
import { Card } from 'flowbite-react';
import BreadCrumbs from '../BreadCrumbs';
import Dashboard from '../../commonComponents/Dashboard';
import { pathRoutes } from '../../config/pathRoutes';
import BackButton from '../../commonComponents/backbutton';

const IssueDashboard = () => {
const IssuanceDashboard = () => {
const options = [
{
heading: 'Connection',
Expand All @@ -23,53 +20,14 @@ const IssueDashboard = () => {
path: pathRoutes.organizations.Issuance.bulkIssuance,
},
];

return (
<div className="px-4 pt-2 h-full h-[700px]">
<div className="mt-1">
<BreadCrumbs />
</div>
<div className="mb-2 flex justify-between items-center relative">
<h1 className="text-xl font-semibold text-gray-900 sm:text-2xl dark:text-white">
Issue Credential
</h1>
<BackButton path={pathRoutes.organizations.issuedCredentials} />
</div>
<div className="px-6 pt-6 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 dark:bg-gray-800">
<p className="text-gray-900 text-xl text-start font-medium dark:text-white">
Select the appropriate action for issuing credential(s){' '}
</p>
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8 pb-16 pt-12">
{options.map((option) => (
<Card
key={option.heading}
className="custom-card group transform transition duration-500 ease-in-out hover:scale-105 cursor-pointer overflow-hidden overflow-ellipsis dark:hover:bg-primary-700 hover:bg-primary-700 border border-gray-200 shadow-md dark:border-gray-600 dark:bg-gray-700"
style={{
maxHeight: '100%',
overflow: 'auto',
height: '168px',
color: 'inherit',
}}
onClick={() => (window.location.href = option?.path)}
>
<div
className="flex items-center min-[401px]:flex-nowrap flex-wrap group-hover:text-white"
style={{ color: 'inherit' }}
>
<div className="ml-4">
<h5 className="text-2xl font-semibold text-primary-700 dark:text-white pb-2">
{option.heading}
</h5>
<p className="text-sm text-gray-700 dark:text-white">
{option.description}
</p>
</div>
</div>
</Card>
))}
</div>
</div>
</div>
<Dashboard
title="Issue Credential"
options={options}
backButtonPath={pathRoutes.organizations.issuedCredentials}
/>
);
};

export default IssueDashboard;
export default IssuanceDashboard;
2 changes: 1 addition & 1 deletion src/components/Verification/Verification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ const VerificationCred = () => {
<div className="mb-4 col-span-full xl:mb-2">
<div className="flex justify-between items-center">
<BreadCrumbs />
<BackButton path={pathRoutes.back.verification.verification} />
<BackButton path={pathRoutes.organizations.verification.schema} />
</div>
<h1 className="ml-1 text-xl font-semibold text-gray-900 sm:text-2xl dark:text-white">
Verification
Expand Down
2 changes: 1 addition & 1 deletion src/components/Verification/VerificationCredentialList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ const VerificationCredentialList = () => {
}, [listAPIParameter]);

const schemeSelection = () => {
window.location.href = pathRoutes.organizations.verification.schema;
window.location.href = pathRoutes.organizations.verification.requestProof;
};

const refreshPage = () => {
Expand Down
33 changes: 33 additions & 0 deletions src/components/Verification/VerificationDashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { pathRoutes } from '../../config/pathRoutes';
import Dashboard from '../../commonComponents/Dashboard';

const VerificationDashboard = () => {
const options = [
{
heading: 'Connection',
description: 'Verify credential(s) by selecting existing connections',
path: pathRoutes.organizations.verification.schema,
},
{
heading: 'Email',
description: 'Verify credential(s) by entering email ID for specific user',
path: null,
},
{
heading: 'Bulk',
description: 'Verify credential(s) in bulk by uploading .csv file records',
path: null,
},
];

return (
<Dashboard
title="Verify Credential"
options={options}
backButtonPath={pathRoutes.organizations.issuedCredentials}
/>
);
};

export default VerificationDashboard;

18 changes: 11 additions & 7 deletions src/config/pathRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ export const pathRoutes = {
emailHistory: '/organizations/credentials/issue/email/history',
},
verification: {
schema: '/organizations/verification/schemas',
credDef: '/organizations/verification/schemas/cred-defs',
connections: '/organizations/verification/schemas/cred-defs/connections',
requestProof: '/organizations/verification/verify-credentials',
email: '/organizations/verification/verify-credentials/email/schemas',
schema: '/organizations/verification/verify-credentials/schemas',
credDef: '/organizations/verification/verify-credentials/schemas/cred-defs',
attributes: '/organizations/verification/verify-credentials/schemas/cred-defs/attributes',
emailCredDef: '/organizations/verification/verify-credentials/email/schemas/cred-defs',
connections: '/organizations/verification/verify-credentials/schemas/cred-defs/connections',
verify:
'/organizations/verification/schemas/cred-defs/connections/verification',
'/organizations/verification/verify-credentials/schemas/cred-defs/connections/verification',
},
},
ecosystem: {
Expand All @@ -78,9 +82,9 @@ export const pathRoutes = {
schemas: '/organizations/schemas',
},
verification: {
credDef: '/organizations/verification/schemas/cred-defs',
schemas: '/organizations/verification/schemas',
verification: '/organizations/verification/schemas/cred-defs/connections',
credDef: '/organizations/verification/verify-credentials/schemas/cred-defs',
schemas: '/organizations/verification/verify-credentials/schemas',
verification: '/organizations/verification/verify-credentials/schemas/cred-defs/connections',
},
issuance: {
credDef: '/organizations/credentials/issue/schemas/cred-defs',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
---
import { useEffect } from 'react';
import { getFromLocalStorage } from '../../../../../api/Auth';
import LayoutSidebar from '../../../../../app/LayoutSidebar.astro';
import CredDefSelection from '../../../../../components/Verification/CredDefSelection';
import { storageKeys } from '../../../../../config/CommonConstant';
import { checkUserSession } from '../../../../../utils/check-session';
// import EmailVerification from '../../../../../components/Verification/EmailVerification';
import { pathRoutes } from '../../../../../config/pathRoutes';
import { checkUserSession } from '../../../../../utils/check-session';

const response = await checkUserSession({cookies: Astro.cookies, currentPath: Astro.url.pathname});
const route: string = pathRoutes.auth.sinIn
Expand All @@ -15,5 +12,5 @@ if (!response.authorized) {
---

<LayoutSidebar notFoundPage={!response.permitted}>
<CredDefSelection client:load />
<!-- <EmailVerification client:visible /> -->
</LayoutSidebar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
import LayoutSidebar from "../../../../../../../../app/LayoutSidebar.astro";
// import EmailCredDefSelection from "../../../../../../../../components/Verification/EmailCredDefSelection";
import { pathRoutes } from "../../../../../../../../config/pathRoutes";
import { checkUserSession } from "../../../../../../../../utils/check-session";

const response = await checkUserSession({cookies: Astro.cookies, currentPath: Astro.url.pathname});
const route: string = pathRoutes.auth.sinIn
if (!response.authorized) {
return Astro.redirect(response.redirect);
}
---

<LayoutSidebar notFoundPage={!response.permitted}>
<!-- <EmailCredDefSelection client:load /> -->
</LayoutSidebar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
import LayoutSidebar from "../../../../../../../app/LayoutSidebar.astro";
import CredDefSelection from "../../../../../../../components/Verification/CredDefSelection";
// import EmailCredDefSelection from "../../../../../../../components/Verification/EmailCredDefSelection";
import { pathRoutes } from "../../../../../../../config/pathRoutes";
import { checkUserSession } from "../../../../../../../utils/check-session";


const response = await checkUserSession({cookies: Astro.cookies, currentPath: Astro.url.pathname});
const route: string = pathRoutes.auth.sinIn
if (!response.authorized) {
return Astro.redirect(response.redirect);
}
---

<LayoutSidebar notFoundPage={!response.permitted}>
<!-- <EmailCredDefSelection client:load /> -->
</LayoutSidebar>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
import LayoutSidebar from "../../../../../../app/LayoutSidebar.astro";
import Connections from "../../../../../../components/Verification/Connections";
// import EmailSchemaSelection from "../../../../../../components/Verification/EmailSchemaSelection";
import SchemaSelection from "../../../../../../components/Verification/SchemaSelection";
import { pathRoutes } from "../../../../../../config/pathRoutes";
import { checkUserSession } from "../../../../../../utils/check-session";

Expand All @@ -12,5 +13,5 @@ if (!response.authorized) {
---

<LayoutSidebar notFoundPage={!response.permitted}>
<Connections client:load/>
<!-- <EmailSchemaSelection client:load/> -->
</LayoutSidebar>
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
import LayoutSidebar from '../../../../app/LayoutSidebar.astro';
import SchemaSelection from '../../../../components/Verification/SchemaSelection'
import { pathRoutes } from '../../../../config/pathRoutes';
import { checkUserSession } from '../../../../utils/check-session';
import IssueDashboard from '../../../../components/Issuance/IssueDashboard'
import VerificationDashboard from '../../../../components/Verification/VerificationDashboard';

const response = await checkUserSession({cookies: Astro.cookies, currentPath: Astro.url.pathname});
const route: string = pathRoutes.auth.sinIn
Expand All @@ -12,5 +13,5 @@ if (!response.authorized) {
---

<LayoutSidebar notFoundPage={!response.permitted}>
<SchemaSelection client:load/>
<VerificationDashboard client:visible />
</LayoutSidebar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
import LayoutSidebar from "../../../../../../../app/LayoutSidebar.astro";
import Connections from "../../../../../../../components/Verification/Connections";
import { pathRoutes } from "../../../../../../../config/pathRoutes";
import { checkUserSession } from "../../../../../../../utils/check-session";


const response = await checkUserSession({cookies: Astro.cookies, currentPath: Astro.url.pathname});
const route: string = pathRoutes.auth.sinIn
if (!response.authorized) {
return Astro.redirect(response.redirect);
}
---

<LayoutSidebar notFoundPage={!response.permitted}>
<Connections client:load/>
</LayoutSidebar>
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
import LayoutSidebar from "../../../../../../app/LayoutSidebar.astro";
import VerificationCred from "../../../../../../components/Verification/Verification";
import { pathRoutes } from "../../../../../../config/pathRoutes";
import { checkUserSession } from "../../../../../../utils/check-session";
import LayoutSidebar from "../../../../../../../app/LayoutSidebar.astro";
import VerificationCred from "../../../../../../../components/Verification/Verification";
import { pathRoutes } from "../../../../../../../config/pathRoutes";
import { checkUserSession } from "../../../../../../../utils/check-session";


const response = await checkUserSession({cookies: Astro.cookies, currentPath: Astro.url.pathname});
const route: string = pathRoutes.auth.sinIn
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
import { checkUserSession } from '../../../../../../utils/check-session';
import { pathRoutes } from '../../../../../../config/pathRoutes';
import LayoutSidebar from '../../../../../../app/LayoutSidebar.astro';
import CredDefSelection from '../../../../../../components/Verification/CredDefSelection';

const response = await checkUserSession({cookies: Astro.cookies, currentPath: Astro.url.pathname});
const route: string = pathRoutes.auth.sinIn
if (!response.authorized) {
return Astro.redirect(response.redirect);
}
---

<LayoutSidebar notFoundPage={!response.permitted}>
<CredDefSelection client:load />
</LayoutSidebar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
import LayoutSidebar from "../../../../../app/LayoutSidebar.astro";
import SchemaSelection from "../../../../../components/Verification/SchemaSelection";
import { pathRoutes } from "../../../../../config/pathRoutes";
import { checkUserSession } from "../../../../../utils/check-session";


const response = await checkUserSession({cookies: Astro.cookies, currentPath: Astro.url.pathname});
const route: string = pathRoutes.auth.sinIn
if (!response.authorized) {
return Astro.redirect(response.redirect);
}
---

<LayoutSidebar notFoundPage={!response.permitted}>
<SchemaSelection client:load/>
</LayoutSidebar>
Loading