File tree Expand file tree Collapse file tree 2 files changed +54
-4
lines changed
Expand file tree Collapse file tree 2 files changed +54
-4
lines changed Original file line number Diff line number Diff line change 1+ 'use client'
2+
3+ import { useSearchParams } from 'next/navigation'
4+ import { useEffect , useState } from 'react'
5+ import Image from 'next/image'
6+ import NotFound from '@/app/not-found'
7+
8+ export default function Certificate ( ) {
9+ const searchParams = useSearchParams ( )
10+ const id = searchParams . get ( 'id' )
11+
12+ const [ certificateUrl , setCertificateUrl ] = useState ( null )
13+ const [ error , setError ] = useState ( false )
14+
15+ useEffect ( ( ) => {
16+ async function fetchCertificate ( ) {
17+ try {
18+ const response = await fetch (
19+ `https://gofr.dev/certificate-service/certificate/${ id } ` ,
20+ )
21+ const { data } = await response . json ( )
22+ setCertificateUrl ( data . url )
23+ } catch ( err ) {
24+ setError ( true )
25+ }
26+ }
27+
28+ if ( id ) fetchCertificate ( )
29+ } , [ id ] )
30+
31+ if ( error ) return < NotFound />
32+ if ( ! certificateUrl )
33+ return (
34+ < div className = "flex h-[80vh] items-center justify-center" >
35+ < div className = "h-12 w-12 animate-spin rounded-full border-4 border-gray-300 border-t-[#38bdf9]" />
36+ </ div >
37+ )
38+
39+ return (
40+ < Image
41+ className = "mx-auto w-[90%] max-w-5xl"
42+ src = { certificateUrl }
43+ alt = "certificate"
44+ height = { 600 }
45+ width = { 800 }
46+ unoptimized
47+ priority
48+ />
49+ )
50+ }
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { Search } from '@/components/Search'
1010import { formatNumber } from '@/lib/common'
1111import { ErrorBoundary } from './BugsnagWrapper'
1212import FooterUi from '@/components/Footer'
13- import { HackathonLinkButton } from './goforgofr/HackathonLinkButton'
13+ // import { HackathonLinkButton } from './goforgofr/HackathonLinkButton'
1414
1515export function GitHubIcon ( props ) {
1616 return (
@@ -149,10 +149,10 @@ export function Layout({ children }) {
149149 < div className = "flex w-full flex-col" >
150150 { pathname !== '/hackathon' && (
151151 < >
152- < div className = "relative z-50 sm:fixed sm:left-0 sm:right-0 sm:top-0" >
152+ { /* <div className="relative z-50 sm:fixed sm:left-0 sm:right-0 sm:top-0">
153153 <HackathonLinkButton />
154- </ div >
155- < div className = "sticky left-0 right-0 top-0 z-40 sm:top-8 " >
154+ </div> */ }
155+ < div className = "sticky left-0 right-0 top-0 z-40 sm:top-0 " >
156156 < Header />
157157 </ div >
158158 </ >
You can’t perform that action at this time.
0 commit comments