Skip to content

Commit

Permalink
🐛 적합하지 않은 best 투표 API 응답 결과로 클라이언트 정적 데이터 활용하여 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyMan0 committed Mar 27, 2024
1 parent 4dd5097 commit 3da8701
Showing 1 changed file with 27 additions and 70 deletions.
97 changes: 27 additions & 70 deletions src/app/test/result/[id]/_components/ResultContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ import { Typography } from '@/components/common/typography';
import { VoteCard, VoteItem } from '@/components/features/vote';
import { Header } from '@/components/layout/header';
import { useGetTestResultById } from '@/hooks/test';
import { useGetBestVote } from '@/hooks/vote/useGetBestVote';

import ImageBox from './ImageBox';
import ShareBox from './ShareBox';
import TempertaureBox from './TempertaureBox';

const ResultContents = ({ id }: { id: number }) => {
const { data: resultData } = useGetTestResultById(id);
const { data: bestVoteContents } = useGetBestVote();

return (
<>
Expand Down Expand Up @@ -72,74 +70,33 @@ const ResultContents = ({ id }: { id: number }) => {
</>
)}

{bestVoteContents ? (
<article className="w-full px-2xs pt-lg">
<div className="flex flex-col items-center gap-3xs">
<Typography type="heading3">투표로 더 많은 논쟁을 해결해봐요</Typography>
<VoteCard className="w-full border-b-0">
<VoteCard.Header
categories={bestVoteContents.category}
closeDate={bestVoteContents.closeDate}
/>
<VoteCard.Description
title={bestVoteContents.title}
content={bestVoteContents.content}
/>
<VoteCard.VoteItemGroup withBlur>
<VoteItem mode="read">
<VoteItem.Radio />
<VoteItem.Text>{bestVoteContents.selections[0].content}</VoteItem.Text>
<VoteItem.Img
src={bestVoteContents.selections[0].imagePath}
alt="vote_item_image"
/>
</VoteItem>
<VoteItem mode="read">
<VoteItem.Radio />
<VoteItem.Text>{bestVoteContents.selections[1].content}</VoteItem.Text>
<VoteItem.Img
src={bestVoteContents.selections[1].imagePath}
alt="vote_item_image"
/>
</VoteItem>
</VoteCard.VoteItemGroup>
</VoteCard>
</div>
<Link href="/vote">
<Button variant="primary" width="full">
투표하고 축의금 논쟁 종결짓기
</Button>
</Link>
</article>
) : (
<article className="w-full px-2xs pt-lg">
<div className="flex flex-col items-center gap-3xs">
<Typography type="heading3">투표로 더 많은 논쟁을 해결해봐요</Typography>
<VoteCard className="w-full border-b-0">
<VoteCard.Header categories="축의금" closeDate="2024-04-15" />
<VoteCard.Description
title="Q. 갑자기 연락온 동창 축의금 얼마할까요?"
content="제목 그대로 학창시절 조금 친했던 친구였는데요. 지내다가 최근에 연락이 되었어요. 옛날 생각이 나네요... 그런데 얼마하는게 맞을까요?!"
/>
<VoteCard.VoteItemGroup withBlur>
<VoteItem mode="read">
<VoteItem.Radio />
<VoteItem.Text>5만원</VoteItem.Text>
</VoteItem>
<VoteItem mode="read">
<VoteItem.Radio />
<VoteItem.Text>10만원</VoteItem.Text>
</VoteItem>
</VoteCard.VoteItemGroup>
</VoteCard>
</div>
<Link href="/vote">
<Button variant="primary" width="full">
투표하고 축의금 논쟁 종결짓기
</Button>
</Link>
</article>
)}
<article className="w-full px-2xs pt-lg">
<div className="flex flex-col items-center gap-3xs">
<Typography type="heading3">투표로 더 많은 논쟁을 해결해봐요</Typography>
<VoteCard className="w-full border-b-0">
<VoteCard.Header categories="축의금" closeDate="2024-04-29" />
<VoteCard.Description
title="갑자기 연락온 동창 축의금 얼마할까요?"
content="제목 그대로 학창시절 조금 친했던 친구였는데요. 지내다가 최근에 연락이 되었어요. 옛날 생각이 나네요... 그런데 얼마하는게 맞을까요?!"
/>
<VoteCard.VoteItemGroup withBlur>
<VoteItem mode="read">
<VoteItem.Radio />
<VoteItem.Text>5만원</VoteItem.Text>
</VoteItem>
<VoteItem mode="read">
<VoteItem.Radio />
<VoteItem.Text>10만원</VoteItem.Text>
</VoteItem>
</VoteCard.VoteItemGroup>
</VoteCard>
</div>
<Link href="/vote">
<Button variant="primary" width="full">
투표하고 축의금 논쟁 종결짓기
</Button>
</Link>
</article>
</section>
</main>
</>
Expand Down

0 comments on commit 3da8701

Please sign in to comment.