From 00af23b0cbe80e733ad19f2ce146f12cc43eac9e Mon Sep 17 00:00:00 2001 From: hkirat Date: Mon, 27 May 2024 20:51:49 +0530 Subject: [PATCH] Fixed cert layout --- src/components/Certificate.tsx | 24 +++++------ src/components/CertificateVerify.tsx | 61 +++++++++++++--------------- src/db/cert.ts | 2 +- 3 files changed, 41 insertions(+), 46 deletions(-) diff --git a/src/components/Certificate.tsx b/src/components/Certificate.tsx index 9e7bbfe27..eb95ed472 100644 --- a/src/components/Certificate.tsx +++ b/src/components/Certificate.tsx @@ -8,7 +8,7 @@ import { CardTitle, } from '@/components/ui/card'; import { Button } from './ui/button'; -import { FaDownload, FaFileImage, FaLinkedin, FaTwitter } from 'react-icons/fa'; +import { FaFileImage, FaLinkedin, FaTwitter } from 'react-icons/fa'; import { useGenerateCertificate } from '@/hooks/useCertGen'; import { OneCertificate } from '@/utiles/certificate'; import { useMemo } from 'react'; //used to fix maximum update depth exceeded err @@ -34,15 +34,15 @@ export const CertificateComponent = ({ userName, }); - const handleDownloadPDF = async () => { - const downloadUrl = certificatePdfUrl; - const a = document.createElement('a'); - a.href = downloadUrl!; - a.download = 'certificate.pdf'; - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - }; + // const handleDownloadPDF = async () => { + // const downloadUrl = certificatePdfUrl; + // const a = document.createElement('a'); + // a.href = downloadUrl!; + // a.download = 'certificate.pdf'; + // document.body.appendChild(a); + // a.click(); + // document.body.removeChild(a); + // }; const handleDownloadPNG = async () => { const downloadUrl = certificateImageUrl; @@ -87,9 +87,9 @@ export const CertificateComponent = ({ {course.description} - + */} diff --git a/src/components/CertificateVerify.tsx b/src/components/CertificateVerify.tsx index cad3297ae..3d39ec0f5 100644 --- a/src/components/CertificateVerify.tsx +++ b/src/components/CertificateVerify.tsx @@ -1,12 +1,6 @@ 'use client'; -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from '@/components/ui/card'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Certificate, Course, User } from '@prisma/client'; import { useGenerateCertificate } from '@/hooks/useCertGen'; @@ -25,33 +19,34 @@ export const CertificateVerify = ({ }); return ( -
-

100x Devs Certificate

- - - {certificateImageUrl ? ( - Generated Certificate - ) : ( - 'Loading...' - )} - +
+

100x Devs Certificate

+
+ + + {certificateImageUrl ? ( + Generated Certificate + ) : ( +
+ Loading... +
+ )} +
-
- - - This Certificate was issued to {certificate.user.name} for - completing {certificate.course.title} - - - Course Description: {certificate.course.description} - - -
-
+
+ + + This Certificate was issued to {certificate.user.name} for + completing {certificate.course.title} + + +
+ +
); }; diff --git a/src/db/cert.ts b/src/db/cert.ts index 9c61412a6..180dd1725 100644 --- a/src/db/cert.ts +++ b/src/db/cert.ts @@ -10,7 +10,7 @@ export const getCertificates = async () => { return []; } const purchases = await getPurchases(session?.user.email || ''); - const courses = purchases.filter((x) => x.certIssued === false); + const courses = purchases.filter((x) => x.certIssued === true); const courseWithCert: { course: Course;