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

fix: select everybody by default and show different tstyle for winner #70

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions prisma/seed/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ async function main() {
play: {
create: {
eventSlug: event.slug,
wannaPlay: true,
},
},
},
Expand Down
3 changes: 2 additions & 1 deletion src/app/events/[event]/participants/[groupId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
ParticipantItem,
ParticipantName,
ParticipantsList,
RoundTitle,
} from "@/components"
import { Round } from "@/shared/types"
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
Expand Down Expand Up @@ -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" && (
Expand Down
1 change: 1 addition & 0 deletions src/app/events/[event]/participants/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async function saveInDb({ csv, event }: SaveInDbInput) {
play: {
create: {
eventSlug: event,
wannaPlay: true,
},
},
},
Expand Down
13 changes: 12 additions & 1 deletion src/components/rounds-list/participant-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className={`relative h-[69px] w-[69px] ${lined && afterClasses}`}>
<div className="relative overflow-hidden rounded-full border-2 border-primary-100">
{hasWinner && !winner && (
<div className="absolute h-[69px] w-[69px] bg-primary-100 opacity-40" />
)}
<Image
src={src}
alt={alt}
Expand Down
Loading