From bfbf657ad7c8eb7c541610fcbda6ef0d6b46043c Mon Sep 17 00:00:00 2001 From: YOOJS1205 Date: Mon, 3 Mar 2025 11:43:54 +0000 Subject: [PATCH] =?UTF-8?q?=ED=88=AC=ED=91=9C=20=ED=98=84=ED=99=A9?= =?UTF-8?q?=EC=9D=B4=20=EC=9E=98=20=EB=B3=B4=EC=9D=B4=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8A=94=20=EC=9D=B4=EC=8A=88=EB=A5=BC=20=ED=95=B4=EA=B2=B0?= =?UTF-8?q?=ED=95=9C=EB=8B=A4.=20(#194)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vote-detail/Vote/VoteResult/VoteResultList.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/vote-detail/Vote/VoteResult/VoteResultList.tsx b/src/components/vote-detail/Vote/VoteResult/VoteResultList.tsx index 733e62a..7ac3777 100644 --- a/src/components/vote-detail/Vote/VoteResult/VoteResultList.tsx +++ b/src/components/vote-detail/Vote/VoteResult/VoteResultList.tsx @@ -1,6 +1,7 @@ import { useParams } from 'react-router-dom'; import useGetMyInfo from '@/api/useGetMyInfo'; import BlurImage from '@/assets/images/vote-detail/voteBlur.png'; +import { getRole } from '@/components/login/Auth/token'; import useVoteStatus from '@/components/vote-detail/Vote/VoteResult/hooks'; import VoteResultItem from '@/components/vote-detail/Vote/VoteResult/VoteResultItem'; @@ -12,21 +13,15 @@ export default function VoteResultList() { }); const { data: myInfo } = useGetMyInfo(); - // 유저가 해당 게시글에 투표 했는지에 대한 유무 - - // 전체 투표 수 계산 const totalVoted = voteStatus?.reduce( (sum, status) => sum + status.voteCount, 0, ); - // 가장 높은 투표 수 계산 const highestVoted = Math.max( ...(voteStatus?.map((status) => status.voteCount) ?? []), ); - // - return (
{!userHasVoted && ( @@ -39,7 +34,7 @@ export default function VoteResultList() {

투표하고, 뽀또들과 함께 결과를 실시간으로 확인해보세요! 🎉

)} - {userHasVoted && !myInfo && ( + {userHasVoted && myInfo && getRole() === 'GUEST' && (
{ const calculatedVoteRatio = totalVoted ? ((status.voteCount / totalVoted) * 100).toFixed(1)