diff --git a/src/App.js b/src/App.js index 0c9bb9a5..5e46acd0 100755 --- a/src/App.js +++ b/src/App.js @@ -4,79 +4,76 @@ import React, { useEffect } from "react"; import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; // fs imports -import Login from "./pages/admin/Login"; -import Dashboard from "./pages/admin/Dashboard/Dashboard"; -import ContactUs from "./pages/ContactUs/ContactUs"; +// import Login from "./pages/admin/Login"; +// import Dashboard from "./pages/admin/Dashboard/Dashboard"; +// import ContactUs from "./pages/ContactUs/ContactUs"; import Home from "./pages/Homepage/Home"; -import NotFound from "./pages/NotFound"; -import PrivateRoute from "./routes/PrivateRoute"; +// import NotFound from "./pages/NotFound"; +// import PrivateRoute from "./routes/PrivateRoute"; import Contacts from "./pages/Contacts/Contacts"; -import Awards from "./pages/Awards/Awards"; -import Societies from "./pages/Societies/Societies"; +// import Awards from "./pages/Awards/Awards"; +// import Societies from "./pages/Societies/Societies"; import Events from "./pages/Events/Events"; -import ScrollToTop from "./components/ScrollToTop"; -import Gallery from "./pages/Gallery/Gallery"; -import FAQ from "./pages/FAQ/FAQ"; -import Tech from "./pages/Committees/2021/Tech"; -import Sports from "./pages/Committees/2021/Sports"; -import Welfare from "./pages/Committees/2021/Welfare"; -import Socult from "./pages/Committees/2021/Socult"; -import AOS from "aos"; +// import ScrollToTop from "./components/ScrollToTop"; +// import Gallery from "./pages/Gallery/Gallery"; +// import FAQ from "./pages/FAQ/FAQ"; +// import Tech from "./pages/Committees/2021/Tech"; +// import Sports from "./pages/Committees/2021/Sports"; +// import Welfare from "./pages/Committees/2021/Welfare"; +// import Socult from "./pages/Committees/2021/Socult"; +// import AOS from "aos"; import "aos/dist/aos.css"; -import Elections from "./pages/Elections/Elections"; -import ElectionCandidates from "./pages/Elections/ElectionCandidates"; -import CertifGen from "./pages/admin/CertificateGenerator/CertifGen"; -import EventsUpdatePage from "./pages/admin/DataUpdate/EventsUpdatePage"; -import Nominations from "./pages/Nominations/Nominations"; -import LiveScoreboard from "./pages/LiveScoreboard/LiveScoreboard"; -import Results from "./pages/Results/Results"; +// import Elections from "./pages/Elections/Elections"; +// import ElectionCandidates from "./pages/Elections/ElectionCandidates"; +// import CertifGen from "./pages/admin/CertificateGenerator/CertifGen"; +// import EventsUpdatePage from "./pages/admin/DataUpdate/EventsUpdatePage"; +// import Nominations from "./pages/Nominations/Nominations"; +// import LiveScoreboard from "./pages/LiveScoreboard/LiveScoreboard"; +// import Results from "./pages/Results/Results"; import ViewCertificate from "./pages/certifgen/ViewCertificate"; function App() { - useEffect(() => { - AOS.init(); - }, []); + // useEffect(() => { + // AOS.init(); + // }, []); return ( - + {/* */} {/* Admin Routes */} - + {/* + /> */} {/* Homepage Routes */} - + {/* - + */} {/* Events Route */} - + {/* */} {/* Results Routes */} - - + {/* + */} {/* Awards Route */} - + {/* */} {/* Contacts Routes */} - + {/* */} {/* ContactUs Route */} - + {/* */} {/* Election Routes */} - {/* - */} + {/* */} + {/* */} - {/* Nominations Route */} - - {/* FAQ Route */} - + {/* */} {/* Certifgen2.0 Route */} @@ -84,13 +81,19 @@ function App() { {/* 404 - Not Found Route */} {/* */} - {/* Live Scoreboard Route */} - {/* */} + {/* Live Scoreboard Route */} + {/* */} + + {/* */} {/* Other Routes */} {/* */} - + {/* */} ); } diff --git a/src/pages/Homepage/Home.js b/src/pages/Homepage/Home.js index 32445287..d64d95dc 100755 --- a/src/pages/Homepage/Home.js +++ b/src/pages/Homepage/Home.js @@ -5,35 +5,50 @@ import AboutUs from "./AboutUs/AboutUs"; import CommitteesHome from "./Committee/CommitteesHome"; import Societies from "./Societies/Societies"; import Greet from "./Greet"; +import { BorderWidth } from "react-bootstrap-icons"; export default function Home() { - document.title = "Home | TSG"; + // document.title = "Home | TSG"; + document.title = "502 Bad Gateway"; + + return ( + // + //
+ //
+ //
+ // KGP Logo + //
+ //
+ // + //
+ //
+ //
+ //
+ // {/* About Us Section */} + // - return ( - -
-
-
- KGP Logo -
-
- -
-
-
-
- {/* About Us Section */} - - - {/* Committees Section */} - + // {/* Committees Section */} + // - {/* Socities Section */} - -
-
- ); + // {/* Socities Section */} + // + //
+ //
+
+
+

502 Bad Gateway

+
+
+
nginx
+
+ ); } diff --git a/src/pages/certifgen/ViewCertificate.css b/src/pages/certifgen/ViewCertificate.css index ab4648f6..c68f6370 100644 --- a/src/pages/certifgen/ViewCertificate.css +++ b/src/pages/certifgen/ViewCertificate.css @@ -1,3 +1,7 @@ +h1 { + color: #f1c40f; +} + @media only screen and (min-width:725px){ .certificateimage { text-align: center; diff --git a/src/pages/certifgen/ViewCertificate.js b/src/pages/certifgen/ViewCertificate.js index c4909db8..8bcf6fd1 100644 --- a/src/pages/certifgen/ViewCertificate.js +++ b/src/pages/certifgen/ViewCertificate.js @@ -11,188 +11,219 @@ import html2pdf from "html2pdf.js"; //https://gymkhana.iitkgp.ac.in/certifgen/view/NjYxYWFlOGM4ZjU0NTJjZmNlM2IxZjIx const ViewCertificate = () => { - document.title = "Certificate | TSG"; + document.title = "Certificate | TSG"; - const params = useParams(); - // console.log(params.id); - const [certificateImage, setCertificateImage] = useState(undefined); - const [certifData, setCertifData] = useState({}); - const [certifState, setCertifState] = useState(0); + const params = useParams(); + // console.log(params.id); + const [certificateImage, setCertificateImage] = useState(undefined); + const [certifData, setCertifData] = useState({}); + const [certifState, setCertifState] = useState(0); - useEffect(() => { - const getCertifData = async () => { - try { - const response = await axios.get( - `https://adminbackend-3r4e.onrender.com/api/certifgen/generateCertif/${params.id}` - // `http://localhost:5050/api/certifgen/generateCertif/${params.id}` - ); - // console.log(response.data); - setCertifState(200); - setCertifData(response.data); - setCertificateImage(response.data.certificate); - // console.log(certifState); - } catch (error) { - console.error("Error fetching certificate data:", error); - setCertifState(404); - } - }; + useEffect(() => { + const getCertifData = async () => { + try { + const response = await axios.get( + `https://adminbackend-3r4e.onrender.com/api/certifgen/generateCertif/${params.id}` + // `http://localhost:5050/api/certifgen/generateCertif/${params.id}` + ); + // console.log(response.data); + setCertifState(200); + setCertifData(response.data); + setCertificateImage(response.data.certificate); + // console.log(certifState); + } catch (error) { + console.error("Error fetching certificate data:", error); + setCertifState(404); + } + }; - getCertifData(); - // eslint-disable-next-line - }, []); + getCertifData(); + // eslint-disable-next-line + }, []); - const downloadImage = () => { - // Create a Blob from the base64 encoded image - const byteCharacters = atob(certificateImage.split(",")[1]); - const byteNumbers = new Array(byteCharacters.length); - for (let i = 0; i < byteCharacters.length; i++) { - byteNumbers[i] = byteCharacters.charCodeAt(i); - } - const byteArray = new Uint8Array(byteNumbers); - const blob = new Blob([byteArray], { type: "image/png" }); + const downloadImage = () => { + // Create a Blob from the base64 encoded image + const byteCharacters = atob(certificateImage.split(",")[1]); + const byteNumbers = new Array(byteCharacters.length); + for (let i = 0; i < byteCharacters.length; i++) { + byteNumbers[i] = byteCharacters.charCodeAt(i); + } + const byteArray = new Uint8Array(byteNumbers); + const blob = new Blob([byteArray], { type: "image/png" }); - // Create a download link and trigger the download - const url = window.URL.createObjectURL(blob); - const link = document.createElement("a"); - link.href = url; - link.setAttribute("download", "certificate.png"); - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - }; + // Create a download link and trigger the download + const url = window.URL.createObjectURL(blob); + const link = document.createElement("a"); + link.href = url; + link.setAttribute("download", "certificate.png"); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }; - const downloadPdf = () => { - // Create an HTML element with the image - const imageElement = document.createElement("img"); - imageElement.src = certificateImage; + const downloadPdf = () => { + // Create an HTML element with the image + const imageElement = document.createElement("img"); + imageElement.src = certificateImage; - // Set the image dimensions - imageElement.style.width = `${certifData.certifSize.width}px`; - imageElement.style.height = `${certifData.certifSize.height}px`; + // Set the image dimensions + imageElement.style.width = `${certifData.certifSize.width}px`; + imageElement.style.height = `${certifData.certifSize.height}px`; - // Create a container div and append the image to it - const container = document.createElement("div"); - container.appendChild(imageElement); + // Create a container div and append the image to it + const container = document.createElement("div"); + container.appendChild(imageElement); - // Convert the container to a PDF - html2pdf(container, { - filename: "image.pdf", // Set the filename - margin: 0, // Set the margin - jsPDF: { - unit: "px", // Set the measurement unit - format: [certifData.certifSize.width, certifData.certifSize.height], // Set the page dimensions - orientation: "landscape", // Set the orientation to landscape - }, - html2canvas: { - scale: 2, // Set the scale factor - }, - }); - }; + // Convert the container to a PDF + html2pdf(container, { + filename: "image.pdf", // Set the filename + margin: 0, // Set the margin + jsPDF: { + unit: "px", // Set the measurement unit + format: [ + certifData.certifSize.width, + certifData.certifSize.height, + ], // Set the page dimensions + orientation: "landscape", // Set the orientation to landscape + }, + html2canvas: { + scale: 2, // Set the scale factor + }, + }); + }; - return ( -
- - gymk_logo -
-

Technology Students' Gymkhana

-

- Indian Institute of Technology Kharagpur -

-
-
-
-

CERTIFICATE

- {certifState === 404 && ( - <> - <> -

- CERTIFICATE NOT FOUND! -

- - - )} - {certifState === 200 && ( - <> -

+ - {certifData.eventName} -

-
-
+
+

+ TECHNOLOGY STUDENTS' GYMKHANA +

+

+ INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR +

+
+
+
- - -
-
- Certificate - - - )} - - {certifState === 0 && ( - <> -

- Certificate is loading... -

- - )} - {/*
+

+ CERTIFICATE +

+ {certifState === 404 && ( + <> + <> +

+ CERTIFICATE NOT FOUND! +

+ + + )} + {certifState === 200 && ( + <> +

+ {certifData.eventName} +

+
+
+ + +
+
+ Certificate + + + )} + + {certifState === 0 && ( + <> +

+ Certificate is loading... +

+ + )} + {/*

Share it on:

@@ -201,9 +232,9 @@ const ViewCertificate = () => {
*/} -
-
- ); +
+
+ ); }; export default ViewCertificate;