Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Footer #66

Merged
merged 10 commits into from
Nov 11, 2024
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
echo "TURSO_AUTH_TOKEN is set: ${{ env.TURSO_AUTH_TOKEN != '' }}"
echo "TURSO_DATABASE_URL is set: ${{ env.TURSO_DATABASE_URL != '' }}"
echo "RESEND_API_KEY" is set ${{ env.RESEND_API_KEY != '' }}
echo
echo
env:
NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
Expand Down
159 changes: 83 additions & 76 deletions emails/user-registration-email-template.tsx
Original file line number Diff line number Diff line change
@@ -1,88 +1,95 @@
import { tedxsjecAssetsPrefix } from "@/lib/utils";
import {
Body,
Button,
Container,
Head,
Heading,
Hr,
Html,
Img,
Preview,
Section,
Text,
Body,
Button,
Container,
Head,
Heading,
Hr,
Html,
Img,
Preview,
Section,
Text,
} from "@react-email/components";
import { Tailwind } from "@react-email/tailwind";

interface TedxRegistrationEmailProps {
name?: string;
registrationLink: string;
name?: string;
registrationLink: string;
}

export const TedxRegistrationEmail = ({ name, registrationLink }: TedxRegistrationEmailProps) => {
const previewText = `TEDxSJEC Talk Registration Successful!`;
export const TedxRegistrationEmail = ({
name,
registrationLink,
}: TedxRegistrationEmailProps) => {
const previewText = `TEDxSJEC Talk Registration Successful!`;

return (
<Html>
<Head />
<Preview>{previewText}</Preview>
<Tailwind>
<Body className="bg-white my-auto mx-auto font-sans px-4">
<Container className="border border-solid border-[#eaeaea] rounded my-[40px] mx-auto p-[20px] max-w-[465px]">
{/* Logo Section */}
<Section className="text-center">
<Img
src={`${tedxsjecAssetsPrefix}/logo/tedxsjec-logo.avif`}
alt="TEDxSJEC Logo"
className="mx-auto w-[150px] h-auto mb-[20px]"
/>
</Section>
{/* Heading Section */}
<Section className="mt-[32px] items-center">
<Heading className="text-black text-[24px] font-bold text-center p-0 my-[30px] mx-0">
<strong>TEDxSJEC Talk Registration Confirmed!</strong>
</Heading>
</Section>
<Text className="text-black text-[14px] leading-[24px]">
Dear {name ?? "Participant"},
</Text>
<Text className="text-black text-[14px] leading-[24px]">
We are excited to confirm your registration for TEDxSJEC Talk. <br />
You are all set to join us for an inspiring day filled with ideas worth sharing.
Please bring this email on the event day for a smooth entry process.
</Text>
{/* QR Code Section */}
<Section className="text-center mt-[32px] mb-[32px]">
<Text className="text-center">
Below is your unique QR code for registration. Kindly keep it accessible on
event day for quick check-in:
</Text>
<Img
className="mx-auto flex items-center justify-center py-4"
src={`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${registrationLink}`}
alt="QR Code"
/>
</Section>
<Text className="text-black text-[14px] leading-[24px]">
We look forward to seeing you at TEDxSJEC! <br />
</Text>
<Hr className="border border-solid border-[#eaeaea] my-[26px] mx-0 w-full" />
<Text className="text-[#666666] text-[12px] leading-[24px]">
Thanks & Regards, <br /> TEDxSJEC Team <br />
For any queries, feel free to contact us at: [email protected]
</Text>
<div className="flex flex-col items-center justify-center text-[12px] space-x-4">
<Button href="https://tedxsjec.in/privacy">Privacy Policy</Button>
&nbsp;|&nbsp;
<Button href="https://tedxsjec.in/refund">Refund Policy</Button>
&nbsp;|&nbsp;
<Button href="https://tedxsjec.in/terms">Terms and Conditions</Button>
</div>
</Container>
</Body>
</Tailwind>
</Html>
);
return (
<Html>
<Head />
<Preview>{previewText}</Preview>
<Tailwind>
<Body className="bg-white my-auto mx-auto font-sans px-4">
<Container className="border border-solid border-[#eaeaea] rounded my-[40px] mx-auto p-[20px] max-w-[465px]">
{/* Logo Section */}
<Section className="text-center">
<Img
src={`${tedxsjecAssetsPrefix}/logo/tedxsjec-logo.avif`}
alt="TEDxSJEC Logo"
className="mx-auto w-[150px] h-auto mb-[20px]"
/>
</Section>
{/* Heading Section */}
<Section className="mt-[32px] items-center">
<Heading className="text-black text-[24px] font-bold text-center p-0 my-[30px] mx-0">
<strong>TEDxSJEC Talk Registration Confirmed!</strong>
</Heading>
</Section>
<Text className="text-black text-[14px] leading-[24px]">
Dear {name ?? "Participant"},
</Text>
<Text className="text-black text-[14px] leading-[24px]">
We are excited to confirm your registration for TEDxSJEC Talk.{" "}
<br />
You are all set to join us for an inspiring day filled with ideas
worth sharing. Please bring this email on the event day for a
smooth entry process.
</Text>
{/* QR Code Section */}
<Section className="text-center mt-[32px] mb-[32px]">
<Text className="text-center">
Below is your unique QR code for registration. Kindly keep it
accessible on event day for quick check-in:
</Text>
<Img
className="mx-auto flex items-center justify-center py-4"
src={`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${registrationLink}`}
alt="QR Code"
/>
</Section>
<Text className="text-black text-[14px] leading-[24px]">
We look forward to seeing you at TEDxSJEC! <br />
</Text>
<Hr className="border border-solid border-[#eaeaea] my-[26px] mx-0 w-full" />
<Text className="text-[#666666] text-[12px] leading-[24px]">
Thanks & Regards, <br /> TEDxSJEC Team <br />
For any queries, feel free to contact us at: [email protected]
</Text>
<div className="flex flex-col items-center justify-center text-[12px] space-x-4">
<Button href="https://tedxsjec.in/privacy">Privacy Policy</Button>
&nbsp;|&nbsp;
<Button href="https://tedxsjec.in/refund">Refund Policy</Button>
&nbsp;|&nbsp;
<Button href="https://tedxsjec.in/terms">
Terms and Conditions
</Button>
</div>
</Container>
</Body>
</Tailwind>
</Html>
);
};

export default TedxRegistrationEmail;
30 changes: 15 additions & 15 deletions src/app/actions/invalidate-coupon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

import prisma from "@/server/db";
import { type Session as NextAuthSession } from "next-auth";
export async function invalidateCouponCode(couponCode: string, session: NextAuthSession) {
console.log("coupon code = "+couponCode , "session = " + session.user.id)
if (!couponCode) return;
return await prisma.referral.update({
where:{
code:couponCode,
},
data:{
isUsed:true,
usedById:session.user.id
}

})


export async function invalidateCouponCode(
couponCode: string,
session: NextAuthSession,
) {
console.log("coupon code = " + couponCode, "session = " + session.user.id);
if (!couponCode) return;
return await prisma.referral.update({
where: {
code: couponCode,
},
data: {
isUsed: true,
usedById: session.user.id,
},
});
}
38 changes: 19 additions & 19 deletions src/app/actions/submit-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ import prisma from "@/server/db";
import { FormDataInterface } from "@/types";

export async function submitForm(data: FormDataInterface, amount: number) {
const session = await getServerSideSession();
if (!session) {
return;
}
const session = await getServerSideSession();
if (!session) {
return;
}

return await prisma.form.create({
data: {
name: data.name,
usn: data.usn,
email: data.email,
foodPreference:data.foodPreference,
contact: data.phone,
designation: data.designation,
paidAmount: amount,
photo: data.photo,
collegeIdCard: data.idCard,
createdById: session.user.id,
entityName: data.entityName,
},
});
return await prisma.form.create({
data: {
name: data.name,
usn: data.usn,
email: data.email,
foodPreference: data.foodPreference,
contact: data.phone,
designation: data.designation,
paidAmount: amount,
photo: data.photo,
collegeIdCard: data.idCard,
createdById: session.user.id,
entityName: data.entityName,
},
});
}
54 changes: 32 additions & 22 deletions src/app/admin/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,42 @@ import { useSession } from "next-auth/react";
const inter = Inter({ subsets: ["latin"] });

export default function RootLayout({
children,
children,
}: Readonly<{
children: React.ReactNode;
children: React.ReactNode;
}>) {
const { data: session } = useSession({
required: true,
});
const { data: session } = useSession({
required: true,
});

if (!session) {
return <div className="w-screen h-screen flex justify-center items-center">Unauthorized</div>;
}

if (session.user.role !== "ADMIN") {
return <div className="w-screen h-screen flex justify-center items-center">Forbidden</div>;
}
if (!session) {
return (
<div className="w-screen h-screen flex justify-center items-center">
Unauthorized
</div>
);
}

if (session.user.role !== "ADMIN") {
return (
<html lang="en">
<body className={inter.className}>
<Providers>
<div className="flex h-screen overflow-hidden">
<AdminNavbar />
<main className="flex-1 overflow-auto bg-indigo-50">{children}</main>
</div>
</Providers>
</body>
</html>
<div className="w-screen h-screen flex justify-center items-center">
Forbidden
</div>
);
}

return (
<html lang="en">
<body className={inter.className}>
<Providers>
<div className="flex h-screen overflow-hidden">
<AdminNavbar />
<main className="flex-1 overflow-auto bg-indigo-50">
{children}
</main>
</div>
</Providers>
</body>
</html>
);
}
Loading
Loading