diff --git a/components/vote/ParticipantCard.tsx b/components/vote/ParticipantCard.tsx index 34ff6af..6300eaf 100644 --- a/components/vote/ParticipantCard.tsx +++ b/components/vote/ParticipantCard.tsx @@ -1,14 +1,15 @@ -'use client'; +"use client"; -import Image from 'next/image'; -import placeholder from '@/public/person placeholder.svg'; -import clsx from 'clsx'; -import { motion, usePresence, Variant, Transition } from 'framer-motion'; -import RollingCounter from 'react-slot-counter'; +import Image from "next/image"; +import placeholder from "@/public/person placeholder.svg"; +import clsx from "clsx"; +import { motion, usePresence, Variant, Transition } from "framer-motion"; +import RollingCounter from "react-slot-counter"; interface IProps { number: number; name: string | null; + description: string | null; photo: string | null; votes: number; progress: number; @@ -24,6 +25,7 @@ interface IProps { const ParticipantCard = ({ number, name, + description, photo, votes, progress, @@ -37,7 +39,7 @@ const ParticipantCard = ({ const substractedProgress = progress > 99 ? progress - 2 : progress; const transition: Transition = { - type: 'spring', + type: "spring", stiffness: 500, damping: 50, mass: 1, @@ -48,11 +50,11 @@ const ParticipantCard = ({ const animations = { layout: true, - initial: 'out', + initial: "out", style: { - position: (isPresent ? 'static' : 'absolute') as 'static' | 'absolute', // Corrected cast + position: (isPresent ? "static" : "absolute") as "static" | "absolute", // Corrected cast }, - animate: isPresent ? 'in' : 'out', + animate: isPresent ? "in" : "out", variants: { in: { scaleY: 1, opacity: 1 }, out: { scaleY: 0, opacity: 0, zIndex: -1 }, @@ -66,7 +68,8 @@ const ParticipantCard = ({ ////////////////////////////////////////////// Winner card + className="flex flex-col overflow-hidden bg-fillNavyBlue max-w-[940px] w-full group" + >

{number} @@ -78,8 +81,9 @@ const ParticipantCard = ({ fill src={photo} alt={name} - className={clsx(' object-cover', { - 'group-hover:scale-110 transition-all duration-300 ease-out': hasUrl, + className={clsx(" object-cover", { + "group-hover:scale-110 transition-all duration-300 ease-out": + hasUrl, })} unoptimized unselectable="off" @@ -91,9 +95,10 @@ const ParticipantCard = ({ {'placeholder'} + } + )} + > {name}

) : null} + {description ? ( +

+ {description} +

+ ) : null} + {/* If we have voteCode and voting not closed, then show badge with code. Else dont show */} - {voteCode && voteStatus !== 'closed' ? ( + {voteCode && voteStatus !== "closed" ? ( // Desktop version

Ses bermek üçin @@ -146,13 +165,13 @@ const ParticipantCard = ({

{/* If we have voteCode and voting not closed, then show badge with code. Else dont show */} - {voteCode && voteStatus !== 'closed' ? ( + {voteCode && voteStatus !== "closed" ? ( // Mobile version

- Ses bermek üçin{' '} + Ses bermek üçin{" "} {voteCode} - {' '} + {" "} ugrat

) : null} @@ -164,15 +183,18 @@ const ParticipantCard = ({ // {...animations} >
-

{number}

+

+ {number} +

{photo && name ? (
{name} + "text-textBlack text-[16px] sm:text-[18px] leading-[100%] font-bold" + )} + > {name} ) : null} + + {description ? ( +

+ {description} +

+ ) : null} + {/* If we have voteCode and voting not closed, then show badge with code. Else dont show */} - {voteCode && voteStatus !== 'closed' ? ( + {voteCode && voteStatus !== "closed" ? ( // Desktop version

Ses bermek üçin @@ -234,13 +272,13 @@ const ParticipantCard = ({

{/* If we have voteCode and voting not closed, then show badge with code. Else dont show */} - {voteCode && voteStatus !== 'closed' ? ( + {voteCode && voteStatus !== "closed" ? ( // Mobile version

- Ses bermek üçin{' '} + Ses bermek üçin{" "} {voteCode} - {' '} + {" "} ugrat

) : null} diff --git a/components/vote/ParticipantsList.tsx b/components/vote/ParticipantsList.tsx index 57e4753..0c59f8b 100644 --- a/components/vote/ParticipantsList.tsx +++ b/components/vote/ParticipantsList.tsx @@ -301,6 +301,7 @@ const ParticipantsList = ({ vote_id, all }: IParams) => { voteStatus={voteStatus ? voteStatus : ""} isFirst={index === 0 ? true : false} name={participant.title} + description={participant.description} progress={participant.votes_percents} votes={participant.votes_count} voteCode={participant.vote_code} @@ -318,6 +319,7 @@ const ParticipantsList = ({ vote_id, all }: IParams) => { voteStatus={voteStatus ? voteStatus : ""} isFirst={index === 0 ? true : false} name={participant.title} + description={participant.description} progress={participant.votes_percents} votes={participant.votes_count} voteCode={participant.vote_code} @@ -354,6 +356,7 @@ const ParticipantsList = ({ vote_id, all }: IParams) => { voteStatus={voteStatus ? voteStatus : ""} isFirst={index === 0 ? true : false} name={participant.title} + description={participant.description} progress={participant.votes_percents} votes={participant.votes_count} voteCode={participant.vote_code} @@ -371,6 +374,7 @@ const ParticipantsList = ({ vote_id, all }: IParams) => { voteStatus={voteStatus ? voteStatus : ""} isFirst={index === 0 ? true : false} name={participant.title} + description={participant.description} progress={participant.votes_percents} votes={participant.votes_count} voteCode={participant.vote_code} @@ -396,6 +400,7 @@ const ParticipantsList = ({ vote_id, all }: IParams) => { voteStatus={voteStatus ? voteStatus : ""} isFirst={index === 0 ? true : false} name={participant.title} + description={participant.description} progress={participant.votes_percents} votes={participant.votes_count} voteCode={participant.vote_code} @@ -413,6 +418,7 @@ const ParticipantsList = ({ vote_id, all }: IParams) => { voteStatus={voteStatus ? voteStatus : ""} isFirst={index === 0 ? true : false} name={participant.title} + description={participant.description} progress={participant.votes_percents} votes={participant.votes_count} voteCode={participant.vote_code} diff --git a/models/allVotes.model.ts b/models/allVotes.model.ts index 9c68f13..c5ba4d7 100644 --- a/models/allVotes.model.ts +++ b/models/allVotes.model.ts @@ -20,6 +20,7 @@ export interface VotingItem { votes_count: number; vote_code: string; title: null | string; + description: null | string; photo: null | string; votes_percents: number; url?: string; diff --git a/models/vote.model.ts b/models/vote.model.ts index 3edbde3..92a762f 100644 --- a/models/vote.model.ts +++ b/models/vote.model.ts @@ -20,6 +20,7 @@ export interface VotingItem { votes_count: number; vote_code: string; title: null | string; + description: null | string; photo: null | string; votes_percents: number; }