From 61ef7f8c0beb50e1cc8ef56d8617df5e3f96c6c7 Mon Sep 17 00:00:00 2001 From: Fernando Daciuk Date: Fri, 28 Jul 2023 14:31:39 -0300 Subject: [PATCH] fix: select everybody by default and show different tstyle for winner --- prisma/seed/seed.ts | 1 + .../events/[event]/participants/[groupId]/page.tsx | 3 ++- src/app/events/[event]/participants/upload.ts | 1 + src/components/rounds-list/participant-image.tsx | 13 ++++++++++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/prisma/seed/seed.ts b/prisma/seed/seed.ts index 519e127..f34e3db 100644 --- a/prisma/seed/seed.ts +++ b/prisma/seed/seed.ts @@ -30,6 +30,7 @@ async function main() { play: { create: { eventSlug: event.slug, + wannaPlay: true, }, }, }, diff --git a/src/app/events/[event]/participants/[groupId]/page.tsx b/src/app/events/[event]/participants/[groupId]/page.tsx index 4033c62..ef0e45c 100644 --- a/src/app/events/[event]/participants/[groupId]/page.tsx +++ b/src/app/events/[event]/participants/[groupId]/page.tsx @@ -6,7 +6,6 @@ import { ParticipantItem, ParticipantName, ParticipantsList, - RoundTitle, } from "@/components" import { Round } from "@/shared/types" import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query" @@ -130,6 +129,8 @@ export default function ParticipantsInGroup({ src={`https://github.com/${participant.github}.png`} alt={`${participant.name} photo`} lined={index !== round.participants.length - 1} + hasWinner={round.participants.some((p) => p.winner)} + winner={participant.winner} /> {params.groupId !== "final" && ( diff --git a/src/app/events/[event]/participants/upload.ts b/src/app/events/[event]/participants/upload.ts index 34ecd6b..567c248 100644 --- a/src/app/events/[event]/participants/upload.ts +++ b/src/app/events/[event]/participants/upload.ts @@ -53,6 +53,7 @@ async function saveInDb({ csv, event }: SaveInDbInput) { play: { create: { eventSlug: event, + wannaPlay: true, }, }, }, diff --git a/src/components/rounds-list/participant-image.tsx b/src/components/rounds-list/participant-image.tsx index fb21afe..3046f2f 100644 --- a/src/components/rounds-list/participant-image.tsx +++ b/src/components/rounds-list/participant-image.tsx @@ -4,15 +4,26 @@ type ParticipantImageProps = { src: string alt: string lined: boolean + hasWinner?: boolean + winner?: boolean } const afterClasses = " after:content-[''] after:h-[1px] after:width-1/2 after:right-1 after:w-full after:bg-primary-100 after:absolute after:top-1/2 relative after:translate-x-1/2 after:left-1/2" -export function ParticipantImage({ src, alt, lined }: ParticipantImageProps) { +export function ParticipantImage({ + src, + alt, + lined, + hasWinner = false, + winner = false, +}: ParticipantImageProps) { return (
+ {hasWinner && !winner && ( +
+ )}