Skip to content

Commit

Permalink
ui improvements and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RojhatToptamus committed Jun 26, 2024
1 parent 99e8ba1 commit 4a59c4c
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 249 deletions.
191 changes: 98 additions & 93 deletions packages/nextjs/app/dashboard/attestation/[uid]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,100 +52,105 @@ export default function AttestationPage({
}
}, [isSuccess, isError, fetchedAttestation]);

if (isLoading) {
return (
<div className="flex justify-center items-center bg-[#E9E9F6] p-6">
<svg
aria-hidden="true"
className="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
viewBox="0 0 100 101"
fill="none"
>
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="rgb(191 219 254)"
/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="rgb(59 130 246)"
/>
</svg>
</div>
);
}
if (!attestation) {
return <div>No attestation data found.</div>;
}

return (
<div className="attestation-container p-6 shadow-md rounded-lg bg-[#E9E9F6]">
<div className="mb-4">
<span className="block text-sm text-gray-600">UID:</span>
<span className="block text-lg font-semibold text-gray-600">
{attestation.uid}
</span>
</div>
<div className="border rounded-md overflow-hidden">
<table className="min-w-full bg-white">
<tbody>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
Schema UID
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.schema_uid}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
Is Revocable
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{!!attestation.revocable ? "True" : "False"}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
Data
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.data.data}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
From
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.attester}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
To
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.recipient}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
Created
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.time}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
Expiration
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.revocation_time}
</td>
</tr>
</tbody>
</table>
<div>
<div className="p-4 bg-[#E9E9F6] min-h-screen">
<div className="p-6 rounded-lg ">
{isLoading || !attestation ? (
<div className="flex justify-center items-center flex-col mt-24">
{" "}
<svg
aria-hidden="true"
className="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
viewBox="0 0 100 101"
fill="none"
>
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="rgb(191 219 254)"
/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="rgb(59 130 246)"
/>
</svg>
<p className="text-[#495FA9]">
Loading the attestation details...
</p>
</div>
) : (
<div className="attestation-container p-6 shadow-md rounded-lg bg-[#E9E9F6]">
<div className="mb-4">
<span className="block text-sm text-gray-600">UID:</span>
<span className="block text-lg font-semibold text-gray-600">
{attestation.uid}
</span>
</div>
<div className="border rounded-md overflow-hidden">
<table className="min-w-full bg-white">
<tbody>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
Schema UID
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.schema_uid}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
Is Revocable
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{!!attestation.revocable ? "True" : "False"}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
Data
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.data.data}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
From
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.attester}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
To
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.recipient}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
Created
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.time}
</td>
</tr>
<tr className="border-b">
<td className="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-50">
Expiration
</td>
<td className="px-4 py-2 text-sm text-gray-900">
{attestation.revocation_time}
</td>
</tr>
</tbody>
</table>
</div>
</div>
)}
</div>
</div>
</div>
);
Expand Down
88 changes: 46 additions & 42 deletions packages/nextjs/app/dashboard/attestations/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const Attestations = () => {
uid: event.args.uid,
schema: event.args.schema_uid,
timestamp: event.args.timestamp,
})),
}))
);
}
}, [eventData]);
Expand All @@ -67,15 +67,15 @@ const Attestations = () => {
<div className="text-3xl font-bold text-[#495FA9]">
{totalAttestations}
</div>
<div className="text-gray-600">Total Schemas</div>
<div className="text-gray-600">Total Attestations</div>
</div>
</div>
);

return (
<div>
<div className="p-4 bg-[#E9E9F6]">
<div className="p-6 rounded-lg shadow-md">
<div className="p-4 bg-[#E9E9F6] min-h-screen">
<div className="p-6 rounded-lg ">
<div className="flex justify-between items-center mb-6">
<div>
<h1 className="text-2xl font-bold text-[#495FA9]">
Expand All @@ -101,7 +101,8 @@ const Attestations = () => {
</div>
<DashboardStats totalAttestations={totalAttestations} />
{isLoading ? (
<div className="flex justify-center items-center">
<div className="flex justify-center items-center flex-col mt-24">
{" "}
<svg
aria-hidden="true"
className="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
Expand All @@ -117,48 +118,51 @@ const Attestations = () => {
fill="rgb(59 130 246)"
/>
</svg>
<p className="text-[#495FA9]">Loading all the attestations...</p>
</div>
) : (
<div className="overflow-x-auto">
<table className="min-w-full bg-white border border-gray-200">
<thead>
<tr className="bg-gray-100 border-b">
<th className="px-4 py-2 text-[#495FA9]">UID</th>
<th className="px-4 py-2 text-[#495FA9]">Attester</th>
<th className="px-4 py-2 text-[#495FA9]">Recipient</th>
<th className="px-4 py-2 text-[#495FA9]">Schema UID</th>
<th className="px-4 py-2 text-[#495FA9]">Timestamp</th>
</tr>
</thead>
<tbody>
{attestations.map((schema, index) => (
<tr key={index} className="border-b">
<td className="px-4 py-2">
<AttestationLink uid={schema.uid} />
</td>
<td className="px-4 py-2 text-[#495FA9]">
{schema.attester}
</td>
<td className="px-4 py-2 text-[#495FA9]">
{schema.recipient}
</td>
<td className="px-4 py-2 text-[#495FA9]">
{schema.schema}
</td>
<td className="px-4 py-2 text-[#495FA9]">
{schema.timestamp}
</td>
<div>
<div className="overflow-x-auto shadow-md rounded-lg">
<table className="min-w-full bg-white border border-gray-200">
<thead>
<tr className="bg-gray-100 border-b">
<th className="px-4 py-2 text-[#495FA9]">UID</th>
<th className="px-4 py-2 text-[#495FA9]">Attester</th>
<th className="px-4 py-2 text-[#495FA9]">Recipient</th>
<th className="px-4 py-2 text-[#495FA9]">Schema UID</th>
<th className="px-4 py-2 text-[#495FA9]">Timestamp</th>
</tr>
))}
</tbody>
</table>
</thead>
<tbody>
{attestations.map((schema, index) => (
<tr key={index} className="border-b">
<td className="px-4 py-2">
<AttestationLink uid={schema.uid} />
</td>
<td className="px-4 py-2 text-[#495FA9]">
{schema.attester}
</td>
<td className="px-4 py-2 text-[#495FA9]">
{schema.recipient}
</td>
<td className="px-4 py-2 text-[#495FA9]">
{schema.schema}
</td>
<td className="px-4 py-2 text-[#495FA9]">
{schema.timestamp}
</td>
</tr>
))}
</tbody>
</table>
</div>
<div className="mt-4 text-center">
<a className="text-[#495FA9]" href="/attestations">
View all attestations
</a>
</div>
</div>
)}
<div className="mt-4 text-center">
<a className="text-blue-600" href="/attestations">
View all attestations
</a>
</div>
</div>
</div>
</div>
Expand Down
34 changes: 27 additions & 7 deletions packages/nextjs/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
"use client";
import Link from "next/link";
import React, { useState, useEffect } from "react";
import type { NextPage } from "next";
import { Bars3Icon, BugAntIcon,CheckBadgeIcon,DocumentTextIcon,CodeBracketIcon } from "@heroicons/react/24/outline";

const Dashboard = () => {
return (
<div>
<div className="p-4">
<p>Welcome to Dashboard!</p>
<Link href="/dashboard/attestations">Attestations</Link>
<br></br>
<br></br>
<Link href="/dashboard/schemas">Schemas</Link>
</div>
<div className="flex-grow w-full mt-16 px-8 py-12 mt-36">
<div className="flex justify-center items-center gap-12 flex-col sm:flex-row ">
<div className="flex flex-col bg-[#475299] px-10 py-10 text-center items-center max-w-xs rounded-3xl">
<CheckBadgeIcon className="h-8 w-8 fill-secondary" />
<p>
Tinker with your smart contract using the{" "}
<Link href="/dashboard/attestations" passHref className="link">
Make Attestations
</Link>{" "}
tab.
</p>
</div>
<div className="flex flex-col bg-[#475299] px-10 py-10 text-center items-center max-w-xs rounded-3xl">
<DocumentTextIcon className="h-8 w-8 fill-secondary" />
<p>
Explore attestation and schemas via the{" "}
<Link href="/dashboard/schemas" passHref className="link">
Create Schemas
</Link>{" "}
tab.
</p>
</div>
</div>
</div>
</div>
);
};
Expand Down
Loading

0 comments on commit 4a59c4c

Please sign in to comment.