From 59bfdbe7342299f509ee308c1e11165f9f4c5c30 Mon Sep 17 00:00:00 2001 From: Joywin Bennis <107112207+joywin2003@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:51:11 +0530 Subject: [PATCH 1/3] adding superscript X to tedx --- src/components/common/About.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/common/About.tsx b/src/components/common/About.tsx index 97ec72a..1bacb48 100644 --- a/src/components/common/About.tsx +++ b/src/components/common/About.tsx @@ -33,14 +33,17 @@ const AboutSection: React.FC = () => { transition={{ duration: 1, ease: "easeOut" }} >

- About TEDxSJEC + About TEDx + SJEC

- TEDxSJEC is an independently organized event bringing together - innovators, thinkers, and visionaries from around the world. Our goal - is to inspire change, provoke deep discussions, and foster creativity - through groundbreaking ideas. Our goal is to inspire change, provoke - deep discussions, and foster creativity through groundbreaking ideas. + TEDx + SJEC is an independently organized event + bringing together innovators, thinkers, and visionaries from around + the world. Our goal is to inspire change, provoke deep discussions, + and foster creativity through groundbreaking ideas. Our goal is to + inspire change, provoke deep discussions, and foster creativity + through groundbreaking ideas.

{/* Decorative line */} From caa3ee0bc4023192b9ae2fe656d1554635810ea3 Mon Sep 17 00:00:00 2001 From: Joywin Bennis <107112207+joywin2003@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:48:24 +0530 Subject: [PATCH 2/3] fix: remove legacy layout prop from image --- src/components/common/Footer.tsx | 2 +- src/components/navbar/nav-header.tsx | 2 +- src/components/widget/header.tsx | 2 +- src/components/widget/performers.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/common/Footer.tsx b/src/components/common/Footer.tsx index cc09320..7e5daf5 100644 --- a/src/components/common/Footer.tsx +++ b/src/components/common/Footer.tsx @@ -110,7 +110,7 @@ const Footer = (props: Props) => { height={150} width={150} alt="logo" - layout="fixed" + // layout="fixed" priority={true} className="hidden md:block" /> diff --git a/src/components/navbar/nav-header.tsx b/src/components/navbar/nav-header.tsx index 8855624..a3a90ea 100644 --- a/src/components/navbar/nav-header.tsx +++ b/src/components/navbar/nav-header.tsx @@ -34,7 +34,7 @@ const NavHeader: React.FC = ({ handleClick }) => { height={200} width={200} alt="logo" - layout="fixed" + // layout="fixed" priority={true} /> diff --git a/src/components/widget/header.tsx b/src/components/widget/header.tsx index fb9f323..b4da721 100644 --- a/src/components/widget/header.tsx +++ b/src/components/widget/header.tsx @@ -109,7 +109,7 @@ const Nav = () => { height={200} width={200} alt="logo" - layout="fixed" + // layout="fixed" priority={true} /> diff --git a/src/components/widget/performers.tsx b/src/components/widget/performers.tsx index 12bb0f8..cd25d88 100644 --- a/src/components/widget/performers.tsx +++ b/src/components/widget/performers.tsx @@ -156,7 +156,7 @@ export default function Component() { alt={`Performer section ${sectionIndex + 1}, slide ${imageIndex + 1} of ${ section.images.length }`} - className={`absolute inset-0 w-full h-full object-cover transition-opacity duration-1000 ${ + className={`absolute inset-0 w-full h-full object-cover transition-opacity duration-8000 ${ imageIndex === currentImageIndices[sectionIndex] ? "opacity-100" : "opacity-0" From 06ee3a6aa5a4cf92728ee6ae99345d028d281688 Mon Sep 17 00:00:00 2001 From: Joywin Bennis <107112207+joywin2003@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:25:11 +0530 Subject: [PATCH 3/3] refactor: remove unused verification and email API routes; add SpringModal component --- src/app/api/(verification)/send-mail/route.ts | 68 ------ .../api/(verification)/verify-mail/route.ts | 66 ------ src/components/navbar/nav-header.tsx | 3 +- src/components/ui/cursor.js | 198 ------------------ .../ui/{SpringModal.tsx => spring-modal.tsx} | 0 5 files changed, 1 insertion(+), 334 deletions(-) delete mode 100644 src/app/api/(verification)/send-mail/route.ts delete mode 100644 src/app/api/(verification)/verify-mail/route.ts delete mode 100644 src/components/ui/cursor.js rename src/components/ui/{SpringModal.tsx => spring-modal.tsx} (100%) diff --git a/src/app/api/(verification)/send-mail/route.ts b/src/app/api/(verification)/send-mail/route.ts deleted file mode 100644 index e2a7fa5..0000000 --- a/src/app/api/(verification)/send-mail/route.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { MailUsingResend } from "@/lib/resend-mailer"; -import prisma from "@/server/db"; -import getErrorMessage from "@/utils/getErrorMessage"; -import { emailSchema } from "@/utils/zod-schemas"; -import { NextRequest, NextResponse } from "next/server"; -import otpGenerator from "otp-generator"; -import { z } from "zod"; - -export async function POST(req: NextRequest) { - try { - const body = await req.json(); - const parsedBody = emailSchema.parse(body); - - // const otp = otpGenerator.generate(6, { - // upperCaseAlphabets: false, - // lowerCaseAlphabets: false, - // specialChars: false, - // }); - - // const expiresIn = 10; // OTP valid for 10 minutes - // const expiresAt = new Date(Date.now() + expiresIn * 60 * 1000); - - // await prisma.verificationRequest.create({ - // data: { - // identifier: parsedBody.email, - // otp, - // expires: expiresAt, - // }, - // }); - - // const mailResponse = await MailUsingResend({ - // email: parsedBody.email, - // name: parsedBody.name, - // OTP: otp, - // }); - - // const mailResponse1 = await addToQueue({ - // email: parsedBody.email, - // name: parsedBody.name, - // OTP: otp, - // }) - - return NextResponse.json({ - message: "Email sent successfully!", - // mailResponse, - }); - } catch (error: unknown) { - const errorMessage = getErrorMessage(error); - - if (error instanceof z.ZodError) { - return NextResponse.json( - { message: "Validation error", errors: errorMessage }, - { status: 400 }, - ); - } - - // Handle general server errors - return NextResponse.json( - { message: "Internal Server Error", errorMessage }, - { status: 500 }, - ); - } -} - -// Test endpoint -export async function GET() { - return NextResponse.json({ message: "Hello from the Send mail!" }); -} diff --git a/src/app/api/(verification)/verify-mail/route.ts b/src/app/api/(verification)/verify-mail/route.ts deleted file mode 100644 index a75e73b..0000000 --- a/src/app/api/(verification)/verify-mail/route.ts +++ /dev/null @@ -1,66 +0,0 @@ -import prisma from "@/server/db"; -import getErrorMessage from "@/utils/getErrorMessage"; -import { NextRequest, NextResponse } from "next/server"; - -export async function POST(req: NextRequest) { - const body = await req.json(); - console.log(body); - const { identifier, otp } = body; - if (!identifier || !otp) { - return NextResponse.json( - { message: "Identifier and OTP are required", status: 400 }, - { status: 400 }, - ); - } - // try { - // await prisma.$transaction(async (tx) => { - // const request = await tx.verificationRequest.findFirst({ - // where: { - // identifier, - // otp, - // expires: { - // gte: new Date(), - // }, - // }, - // orderBy: { - // created_at: "desc", - // }, - // }); - // if (!request) { - // throw new Error("Verification failed: Invalid or expired OTP"); - // } - // await tx.form.updateMany({ - // where: { - // email: identifier, - // }, - // data: { - // emailVerified: true, - // }, - // }); - // await tx.verificationRequest.deleteMany({ - // where: { - // identifier, - // }, - // }); - // }); - - return NextResponse.json( - { - message: "OTP verified successfully back!", - status: 200, - }, - { status: 200 }, - ); - // catch (error: unknown) { - // const errorMessage = getErrorMessage(error); - // console.error("OTP verification failed:", errorMessage); - // return NextResponse.json( - // { message: errorMessage, status: 400 }, - // { status: 400 }, - // ); - // } -} - -export async function GET() { - return NextResponse.json({ message: "Hello from the Send mail!" }); -} diff --git a/src/components/navbar/nav-header.tsx b/src/components/navbar/nav-header.tsx index a3a90ea..ac26be4 100644 --- a/src/components/navbar/nav-header.tsx +++ b/src/components/navbar/nav-header.tsx @@ -1,9 +1,8 @@ -"use client"; +"use client";; import { tedxsjecAssetsPrefix } from "@/lib/utils"; import Image from "next/image"; import Link from "next/link"; import React, { useRef } from "react"; -import RegisterButton from "./register-button"; interface NavHeaderProps { handleClick: () => void; diff --git a/src/components/ui/cursor.js b/src/components/ui/cursor.js deleted file mode 100644 index 78af5b5..0000000 --- a/src/components/ui/cursor.js +++ /dev/null @@ -1,198 +0,0 @@ -import { useEffect } from "react"; - -const useCanvasCursor = () => { - function n(e) { - this.init(e || {}); - } - n.prototype = { - init: function (e) { - this.phase = e.phase || 0; - this.offset = e.offset || 0; - this.frequency = e.frequency || 0.001; - this.amplitude = e.amplitude || 1; - }, - update: function () { - return ( - (this.phase += this.frequency), - (e = this.offset + Math.sin(this.phase) * this.amplitude) - ); - }, - value: function () { - return e; - }, - }; - - function Line(e) { - this.init(e || {}); - } - - Line.prototype = { - init: function (e) { - this.spring = e.spring + 0.1 * Math.random() - 0.02; - this.friction = E.friction + 0.01 * Math.random() - 0.002; - this.nodes = []; - for (var t, n = 0; n < E.size; n++) { - t = new Node(); - t.x = pos.x; - t.y = pos.y; - this.nodes.push(t); - } - }, - update: function () { - var e = this.spring, - t = this.nodes[0]; - t.vx += (pos.x - t.x) * e; - t.vy += (pos.y - t.y) * e; - for (var n, i = 0, a = this.nodes.length; i < a; i++) - (t = this.nodes[i]), - 0 < i && - ((n = this.nodes[i - 1]), - (t.vx += (n.x - t.x) * e), - (t.vy += (n.y - t.y) * e), - (t.vx += n.vx * E.dampening), - (t.vy += n.vy * E.dampening)), - (t.vx *= this.friction), - (t.vy *= this.friction), - (t.x += t.vx), - (t.y += t.vy), - (e *= E.tension); - }, - draw: function () { - var e, - t, - n = this.nodes[0].x, - i = this.nodes[0].y; - ctx.beginPath(); - ctx.moveTo(n, i); - for (var a = 1, o = this.nodes.length - 2; a < o; a++) { - e = this.nodes[a]; - t = this.nodes[a + 1]; - n = 0.5 * (e.x + t.x); - i = 0.5 * (e.y + t.y); - ctx.quadraticCurveTo(e.x, e.y, n, i); - } - e = this.nodes[a]; - t = this.nodes[a + 1]; - ctx.quadraticCurveTo(e.x, e.y, t.x, t.y); - ctx.stroke(); - ctx.closePath(); - }, - }; - - function onMousemove(e) { - function o() { - lines = []; - for (var e = 0; e < E.trails; e++) - lines.push(new Line({ spring: 0.4 + (e / E.trails) * 0.025 })); - } - function c(e) { - e.touches - ? ((pos.x = e.touches[0].pageX), (pos.y = e.touches[0].pageY)) - : ((pos.x = e.clientX), (pos.y = e.clientY)), - e.preventDefault(); - } - function l(e) { - 1 == e.touches.length && - ((pos.x = e.touches[0].pageX), (pos.y = e.touches[0].pageY)); - } - document.removeEventListener("mousemove", onMousemove), - document.removeEventListener("touchstart", onMousemove), - document.addEventListener("mousemove", c), - document.addEventListener("touchmove", c), - document.addEventListener("touchstart", l), - c(e), - o(), - render(); - } - - function render() { - if (ctx.running) { - ctx.globalCompositeOperation = "source-over"; - ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); - ctx.globalCompositeOperation = "lighter"; - ctx.strokeStyle = "#E62B1E"; // TEDx red color - ctx.lineWidth = 1; - for (let e, t = 0; t < E.trails; t++) { - e = lines[t]; - e.update(); - e.draw(); - } - ctx.frame++; - window.requestAnimationFrame(render); - } - } - - function resizeCanvas() { - ctx.canvas.width = window.innerWidth - 20; - ctx.canvas.height = window.innerHeight; - } - - var ctx, - f, - e = 0, - pos = {}, - lines = [], - E = { - debug: true, - friction: 0.5, - trails: 20, - size: 50, - dampening: 0.25, - tension: 0.98, - }; - function Node() { - this.x = 0; - this.y = 0; - this.vy = 0; - this.vx = 0; - } - - const renderCanvas = function () { - ctx = document.getElementById("canvas").getContext("2d"); - ctx.running = true; - ctx.frame = 1; - f = new n({ - phase: Math.random() * 2 * Math.PI, - amplitude: 85, - frequency: 0.0015, - offset: 285, - }); - document.addEventListener("mousemove", onMousemove); - document.addEventListener("touchstart", onMousemove); - document.body.addEventListener("orientationchange", resizeCanvas); - window.addEventListener("resize", resizeCanvas); - window.addEventListener("focus", () => { - if (!ctx.running) { - ctx.running = true; - render(); - } - }); - window.addEventListener("blur", () => { - ctx.running = true; - }); - resizeCanvas(); - }; - - useEffect(() => { - renderCanvas(); - - return () => { - ctx.running = false; - document.removeEventListener("mousemove", onMousemove); - document.removeEventListener("touchstart", onMousemove); - document.body.removeEventListener("orientationchange", resizeCanvas); - window.removeEventListener("resize", resizeCanvas); - window.removeEventListener("focus", () => { - if (!ctx.running) { - ctx.running = true; - render(); - } - }); - window.removeEventListener("blur", () => { - ctx.running = true; - }); - }; - }, []); -}; - -export default useCanvasCursor; diff --git a/src/components/ui/SpringModal.tsx b/src/components/ui/spring-modal.tsx similarity index 100% rename from src/components/ui/SpringModal.tsx rename to src/components/ui/spring-modal.tsx