diff --git a/public/blob-para-qrcode.png b/public/blob-para-qrcode.png deleted file mode 100644 index 796f1b7..0000000 Binary files a/public/blob-para-qrcode.png and /dev/null differ diff --git a/public/fender-lego-tv.png b/public/fender-lego-tv.png new file mode 100644 index 0000000..962e504 Binary files /dev/null and b/public/fender-lego-tv.png differ diff --git a/src/app/api/webhooks/newsletter/route.ts b/src/app/api/webhooks/newsletter/route.ts new file mode 100644 index 0000000..0d83486 --- /dev/null +++ b/src/app/api/webhooks/newsletter/route.ts @@ -0,0 +1,56 @@ +import { NextRequest, NextResponse } from "next/server"; +import { db } from '@/lib/prisma' +import { ActivationType } from "@/global/global.types"; + +export async function POST(request: NextRequest): Promise { + try { + const body = await request.text() + const parsed = JSON.parse(body) + + const field = parsed.form_response.definition.fields.find((field: any) => field.type === 'email') + const anwser = parsed.form_response.answers.find((anwser: any) => anwser.field.ref === field.ref) + + if(!anwser.email) { + return NextResponse.json({}, { status: 400 }) + } + + const user = await db.user.findFirst({ + where: { + email: anwser.email + } + }) + + if(!user) { + return NextResponse.json({message: 'User Doesn\'t exists '}, { status: 404 }) + } + + const activation = await db.activation.findFirst({ + where: { + name: ActivationType.NEWSLETTER, + userId: user.id + } + }) + + if(!activation) { + return NextResponse.json({message: 'Activation Doesn\'t exists '}, { status: 404 }) + } + + await db.activation.update({ + data: { + completed: true + }, + where: { + id: activation.id + } + }) + + return NextResponse.json({ message: 'Success' }, { status: 200 }) + } catch (error) { + console.log(error) + + return NextResponse.json({}, { + status: 500, + statusText: 'Internal Server Error' + }) + } +} \ No newline at end of file diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index 3b1ec82..2245998 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -2,7 +2,7 @@ import React from 'react'; import Image from "next/image"; -import fenderImg from '../../../public/fender-lego.png' +import fenderImg from '../../../public/fender-lego-tv.png' import qrcode from '../../../public/qrcode_events.superviz.com.png' import Activations from "@/components/Activations"; import OnlineNow from "@/components/OnlineNow"; @@ -13,45 +13,49 @@ export default function Dashboard() { return ( -
-
+
+
- Logo Superviz -

- Ganhe um LEGO® - da Fender® + Logo Superviz +

+ Ganhe um LEGO® + da Fender®

-
+

Participe de qualquer ativação e ganhe pontos para concorrer.

Quanto mais ativações, mais chances de ganhar.

🕹️ Boa sorte!

- Imagem de um Lego da Fender -
+ Imagem de um Lego da Fender +
-

Veja quem já garantiu pontos e está concorrendo

-

Aponte a câmera para o QR code pra participar

+

Veja quem já garantiu pontos e está concorrendo

+

Aponte a câmera para o QR code pra participar

QR Code para ativação
- - +
+ +
+
+ +
-
- Online agora: +
+ Online agora: user.isOnline)} />
- ícone de sincronização - Sincronização de dados por - Superviz + ícone de sincronização + Sincronização de dados por + Superviz
diff --git a/src/app/globals.css b/src/app/globals.css index 383364e..9e6d399 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -15,8 +15,8 @@ html, body { @layer components { .activations { .pinpoint{ - width: 40px; - height: 40px; + width: 70px; + height: 70px; position: relative; .content{ @@ -39,7 +39,7 @@ html, body { .circle{ stroke-dashoffset: 0; stroke-dasharray:300; - stroke-width: 3.5; + stroke-width: 7; } } } diff --git a/src/components/Activations/index.tsx b/src/components/Activations/index.tsx index 2be8a7d..1168f3b 100644 --- a/src/components/Activations/index.tsx +++ b/src/components/Activations/index.tsx @@ -8,9 +8,9 @@ interface IActivationsProps { export default function Activations({ activations }: IActivationsProps) { function Activation({activation}: { activation: IActivation }) { return ( -
+
- + {`${activation.description} `} {activation.subtext && } @@ -21,12 +21,12 @@ export default function Activations({ activations }: IActivationsProps) { function Circle({ color }: { color: string}) { return ( - +
- - + +
@@ -38,7 +38,7 @@ export default function Activations({ activations }: IActivationsProps) { return ( <>
- {`${subtext.description} `} + {`${subtext.description} `} @@ -52,8 +52,8 @@ export default function Activations({ activations }: IActivationsProps) { } return ( -
-

Ativações

+
+

Ativações

{activations.map((act) => ( ))} diff --git a/src/components/OnlineNow/index.tsx b/src/components/OnlineNow/index.tsx index 68dee03..679530e 100644 --- a/src/components/OnlineNow/index.tsx +++ b/src/components/OnlineNow/index.tsx @@ -19,7 +19,7 @@ export default function OnlineNow({ users }: IOnlineNowProps) { function OtherUsers() { return (
+ className="ml-3 bg-white/40 h-9 w-9 tv:h-[4.5rem] tv:w-[4.5rem] rounded-full text-white text-lg font-black flex items-center justify-center"> diff --git a/src/components/User/index.tsx b/src/components/User/index.tsx index 8d40b96..8674e17 100644 --- a/src/components/User/index.tsx +++ b/src/components/User/index.tsx @@ -12,7 +12,7 @@ interface IUserProps { export default function User({ user, withActivations, withUsername, withStar = false }: IUserProps) { const firstLetter = user.name.at(0) ?? 'U' const activationsNumber = user.activations.length - const usernameMargin = 8 - (4 - activationsNumber) * 7 + const usernameMargin = 8 - (4 - activationsNumber) * 15 const userHasStar = activationsNumber === Object.keys(ActivationEnum).length && user.activations.every(activation => activation.isCompleted) if (!withActivations) { @@ -28,13 +28,13 @@ export default function User({ user, withActivations, withUsername, withStar = f return (
{userHasStar && withStar &&

⭐️

} -
+
- {withUsername &&

{user.name}

} + {withUsername &&

{user.name}

}
) } @@ -42,8 +42,8 @@ export default function User({ user, withActivations, withUsername, withStar = f function UserBase({letter}: { letter: string }) { return (
- {letter} + className="bg-white h-[4.5rem] w-[4.5rem] rounded-full flex items-center justify-center"> + {letter}
) } @@ -51,7 +51,7 @@ function UserBase({letter}: { letter: string }) { function UserActivations({ user }: { user: IUser}) { return (
- + {Object.keys(ActivationEnum).map((activation) => ( @@ -61,7 +61,7 @@ function UserActivations({ user }: { user: IUser}) { ))} {user.activations.map((activation, index) => { - const radius = 21 + index * 7 + const radius = 45 + index * 15 return ( ) @@ -73,7 +73,7 @@ function UserActivations({ user }: { user: IUser}) { function ActivationsRings({username, activation, radius}: {username: string, activation: IUserActivation, radius: number}) { return ( - + ) } \ No newline at end of file diff --git a/src/components/UsersDashboard/index.tsx b/src/components/UsersDashboard/index.tsx index 5ef85f0..bf0bcdb 100644 --- a/src/components/UsersDashboard/index.tsx +++ b/src/components/UsersDashboard/index.tsx @@ -27,7 +27,7 @@ export default function UsersDashboard({ users }: IUsersDashboardProps) { const containerWidth = containerRef.current!.clientWidth; const containerHeight = containerRef.current!.clientHeight; - const size = 16 + user.activations.length * 9.5; + const size = 36 + user.activations.length * 15; const ball = Matter.Bodies.circle( (Math.random() * (containerWidth - BALL_MARGIN)) + (BALL_MARGIN / 2), (Math.random() * (containerHeight - BALL_MARGIN)) + (BALL_MARGIN / 2), @@ -150,7 +150,7 @@ export default function UsersDashboard({ users }: IUsersDashboardProps) { }, []); return ( -
+
{balls.map((ball) => (