Skip to content

Commit

Permalink
Merge pull request #48 from TEDx-SJEC/cta
Browse files Browse the repository at this point in the history
Cta
  • Loading branch information
joywin2003 authored Oct 24, 2024
2 parents 261d43b + 56956d9 commit 131f088
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 68 deletions.
108 changes: 54 additions & 54 deletions src/app/api/(verification)/verify-mail/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,64 @@ 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,
// },
// });
});
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 },
{
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!" });
return NextResponse.json({ message: "Hello from the Send mail!" });
}
2 changes: 2 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import StackedCards from "@/components/stacking-cards/stacked";
import { PreviousEdition } from "@/components/common/Container-Scroll";
import About from "@/components/common/About";
import Team from "@/components/common/Team-Section";
import { CtaSection } from "@/components/common/cta-section";
import Performers from "@/components/widget/performers";

export default function Home() {
Expand Down Expand Up @@ -35,6 +36,7 @@ export default function Home() {
The Team
</h1>
<Team />
<CtaSection />
</div>
</div>
<ParallaxFooter />
Expand Down
29 changes: 29 additions & 0 deletions src/components/common/cta-section.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"use client";

import { Button } from "@/components/ui/button";

export function CtaSection() {
return (
<div className="relative min-h-screen flex items-center justify-center overflow-hidden bg-black">
<div
className="absolute inset-0 bg-gradient-to-b from-black via-black to-redTheme"
style={{
maskImage: "radial-gradient(ellipse 100% 80% at 50% 100%, black, transparent)",
WebkitMaskImage: "radial-gradient(ellipse 100% 80% at 50% 100%, black, transparent)",
}}
></div>
<div className="relative z-10 max-w-3xl mx-auto text-center px-6">
<h1 className="text-4xl sm:text-5xl md:text-6xl font-bold mb-6 text-white">
Live What&apos;s Worth Living
</h1>
<p className="text-lg sm:text-xl md:text-2xl mb-8 text-white/80">
Celebrate the joy of accomplishment with an app designed to track your progress and
motivate your efforts.
</p>
<Button className="bg-orange-600 hover:bg-orange-700 text-white font-semibold py-3 px-8 text-lg rounded-md">
Register Now
</Button>
</div>
</div>
);
}
28 changes: 14 additions & 14 deletions src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"

import { cn } from "@/lib/utils";
import { cn } from "@/lib/utils"

const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
{
variants: {
variant: {
Expand All @@ -31,27 +31,27 @@ const buttonVariants = cva(
variant: "default",
size: "default",
},
},
);
}
)

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
asChild?: boolean
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
const Comp = asChild ? Slot : "button"
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
);
},
);
Button.displayName = "Button";
)
}
)
Button.displayName = "Button"

export { Button, buttonVariants };
export { Button, buttonVariants }

0 comments on commit 131f088

Please sign in to comment.