From d43e5167cbeb1c5934f0a871bf8366183c7ed755 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 11 Aug 2024 13:09:14 +0000 Subject: [PATCH 1/4] Remove conflicting app directory files --- app/attestation/[uid]/page.tsx | 251 --------------------------------- 1 file changed, 251 deletions(-) delete mode 100644 app/attestation/[uid]/page.tsx diff --git a/app/attestation/[uid]/page.tsx b/app/attestation/[uid]/page.tsx deleted file mode 100644 index 8eed48b34..000000000 --- a/app/attestation/[uid]/page.tsx +++ /dev/null @@ -1,251 +0,0 @@ -"use client"; - -import React, { useEffect, useState } from "react"; -import { Attestation } from "../../../types/attestation"; -import { SchemaEncoder } from "@ethereum-attestation-service/eas-sdk"; -// import Lottie from "lottie-react"; -import tw from "tailwind-styled-components"; -import { AttestationCard } from "~~/components/AttestationCard"; - -interface AttestationPageProps { - params: { uid: string }; -} - -const Container = tw.div` - min-h-screen - w-full - relative - overflow-hidden -`; - -const AnimationWrapper = tw.div` - absolute - inset-0 - w-full - h-full -`; - -const Overlay = tw.div` - absolute - inset-0 - bg-black - bg-opacity-50 -`; - -const ContentWrapper = tw.div` - relative - z-10 - min-h-screen - w-full - flex - justify-center - items-center - p-4 -`; - -const Card = tw.div` - bg-gray-800 - bg-opacity-95 - rounded-2xl - shadow-2xl - p-8 - w-11/12 - max-w-md - backdrop-blur-sm -`; - -const Title = tw.h2` - text-3xl - font-extrabold - mb-6 - text-center - text-white -`; - -const TitleSpan = tw.span` - text-indigo-400 -`; - -const StatementWrapper = tw.div` - mb-6 - p-4 - bg-gray-700 - rounded-lg - text-white -`; - -const SectionTitle = tw.h3` - font-bold - mb-2 - text-xl - text-indigo-300 -`; - -const StatementText = tw.p` - text-gray-300 -`; - -const Disclaimer = tw.p` - text-xs - text-gray-400 - mt-6 - text-center -`; - -const LoadingWrapper = tw.div` - min-h-screen - w-full - flex - justify-center - items-center -`; - -const LoadingText = tw.div` - text-white - text-2xl -`; - -export default function AttestationPage({ params }: AttestationPageProps) { - const [attestation, setAttestation] = useState(null); - const [isLoading, setIsLoading] = useState(true); - const [error, setError] = useState(null); - const { uid } = params; - - useEffect(() => { - async function fetchAttestation() { - try { - setIsLoading(true); - const data = await fetchAttestationBasedOnUID(uid); - if (data) { - setAttestation(JSON.parse(data.data)); - } else { - setError("Attestation not found"); - } - } catch (err) { - setError("Error fetching attestation"); - console.error(err); - } finally { - setIsLoading(false); - } - } - fetchAttestation(); - }, [uid]); - - if (isLoading) { - return ( - - Loading... - - ); - } - - if (error || !attestation) { - return ( - - {error || "Attestation not found"} - - ); - } - - const schemaEncoder = new SchemaEncoder("string requestedTextToVerify"); - const decoded = schemaEncoder.decodeData(attestation.data); - - return ( - - - {/* Lottie animation commented out to address build issues - - */} - - - - - - Attested <TitleSpan>Statement</TitleSpan> - -
- - Attested Statement: - {decoded[0].value.value as string} - -
- -
- -
- - - *This is an example open-source repo using EAS. -
- Attestations are for demonstration purposes only. -
-
-
-
- ); -} - -async function fetchAttestationBasedOnUID(uid: string): Promise { - const query = ` - query ExampleQuery($where: AttestationWhereUniqueInput!) { - attestation(where: $where) { - id - data - attester - recipient - refUID - revocable - revocationTime - expirationTime - } - } - `; - - const variables = { - where: { - id: uid, - }, - }; - - try { - const response = await fetch("https://sepolia.easscan.org/graphql", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - query, - variables, - }), - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - const result = await response.json(); - - if (result.errors) { - throw new Error(result.errors[0].message); - } - - if (!result.data || !result.data.attestation) { - throw new Error("Attestation not found"); - } - - return result.data.attestation as Attestation; - } catch (error) { - console.error("Error fetching attestation:", error); - throw error; - } -} From dd404cbadd69b2e14790179eb16a6d666684c81f Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 11 Aug 2024 13:15:05 +0000 Subject: [PATCH 2/4] Trigger GitHub Actions build From 95fb0e6c4b19dd1d551c4a40deeeac269e50bad7 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 11 Aug 2024 13:20:35 +0000 Subject: [PATCH 3/4] Fix ESLint warnings and errors --- pages/attestation/[uid].tsx | 8 ++++---- pages/index.tsx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pages/attestation/[uid].tsx b/pages/attestation/[uid].tsx index 5ce8be8ba..284557ee1 100644 --- a/pages/attestation/[uid].tsx +++ b/pages/attestation/[uid].tsx @@ -1,12 +1,12 @@ -import { GetStaticProps, GetStaticPaths } from 'next'; -import { useRouter } from 'next/router'; +import { GetStaticProps } from "next"; +import { useRouter } from "next/router"; export const generateStaticParams = async () => { // In a real-world scenario, you would fetch the list of UIDs from an API or database // For this example, we'll generate a few static paths - const uids = ['1', '2', '3']; + const uids = ["1", "2", "3"]; - return uids.map((uid) => ({ + return uids.map(uid => ({ uid: uid, })); }; diff --git a/pages/index.tsx b/pages/index.tsx index 451dacac9..1c23d33f0 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -34,7 +34,7 @@ const Home: React.FC = () => { const handleStageCompletion = (stage: Stage) => { setCompletedStages(prev => { const newCompletedStages = [...prev, stage]; - localStorage.setItem('completedStages', JSON.stringify(newCompletedStages)); + localStorage.setItem("completedStages", JSON.stringify(newCompletedStages)); return newCompletedStages; }); @@ -42,7 +42,7 @@ const Home: React.FC = () => { if (currentIndex < stages.length - 1) { const nextStage = stages[currentIndex + 1]; setCurrentStage(nextStage); - localStorage.setItem('currentStage', nextStage); + localStorage.setItem("currentStage", nextStage); } }; From 0b407c45c4ddffbb98aa15fd93cb221645c08a73 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 11 Aug 2024 13:28:07 +0000 Subject: [PATCH 4/4] Fix import statement for EventAttendanceProof and resolve merge conflicts --- pages/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/index.tsx b/pages/index.tsx index 1c23d33f0..7b55c19e6 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from "react"; import IdentityVerification from "../components/IdentityVerification"; import OnchainAttestation from "../components/OnchainAttestation"; +import EventAttendanceProof from "../components/EventAttendanceVerification"; const stages = ["identity", "attendance", "attestation", "complete"] as const; type Stage = (typeof stages)[number];