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

[JR-875] 투표 qa 작업 #186

Merged
merged 4 commits into from
Oct 16, 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
5 changes: 3 additions & 2 deletions apps/jurumarble/src/app/search/components/ChipContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ interface Props {
region: string;
mutateBookMark: UseMutateFunction;
isBookmark: boolean;
votedCount: number;
}

const ChipContainer = ({ date, title, region, mutateBookMark, isBookmark }: Props) => {
const ChipContainer = ({ date, title, region, mutateBookMark, isBookmark, votedCount }: Props) => {
return (
<>
<TagRow>
<FlexRow>
{region && <Chip variant="region">{region}</Chip>}
<Chip variant="numberOfParticipants">122명이 즐겼어요</Chip>
<Chip variant="numberOfParticipants">{votedCount}명이 즐겼어요</Chip>
</FlexRow>
<FlexRow>
{isBookmark ? (
Expand Down
3 changes: 2 additions & 1 deletion apps/jurumarble/src/app/search/components/DrinkVoteItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface Props {
* @Todo 타입 더 깔끔하게 정의 필요
*/
function DrinkVoteItem({ voteDrink }: Props) {
const { voteId, region, title, imageA, imageB } = voteDrink;
const { voteId, region, title, imageA, imageB, votedCount } = voteDrink;

const { isBookmark, mutateBookMark } = useBookmarkService(voteId);

Expand All @@ -31,6 +31,7 @@ function DrinkVoteItem({ voteDrink }: Props) {
region={region}
mutateBookMark={mutateBookMark}
isBookmark={isBookmark}
votedCount={votedCount}
/>
<VoteDescription imageA={imageA} imageB={imageB} />
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { formatDate } from "lib/utils/formatDate";
import NonWriterBox from "app/vote/components/NonWriterBox";
import { toast } from "react-toastify";
import useVoteReportService from "../services/useVoteReportService";
import { AorB } from "lib/apis/vote";

interface Props {
title: string;
Expand All @@ -25,6 +26,7 @@ interface Props {
isBookmark: boolean;
postedUserId: number;
voteId: number;
select: AorB | null;
}

const ChipContainer = ({
Expand All @@ -36,6 +38,7 @@ const ChipContainer = ({
mutateBookMark,
isBookmark,
postedUserId,
select,
}: Props) => {
const { userInfo } = useGetUserInfo();
const { onDelete } = useVoteDeleteService(voteId);
Expand All @@ -53,7 +56,7 @@ const ChipContainer = ({
<TagRow>
<FlexRow>
{region && <Chip variant="region">{region}</Chip>}
{/* <Chip variant="numberOfParticipants">122명이 즐겼어요</Chip> */}
{select && <Chip variant="isVote">참여중</Chip>}
</FlexRow>
<FlexRow>
{isBookmark ? (
Expand Down
41 changes: 22 additions & 19 deletions apps/jurumarble/src/app/vote/[id]/components/VoteDescription.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import AorBMark from "components/AorBMark";
import { postExecuteVote } from "lib/apis/vote";
import Path from "lib/Path";
import { media } from "lib/styles";
import depths from "lib/styles/depths";
import Image, { StaticImageData } from "next/image";
import { useParams, useRouter } from "next/navigation";
import Image from "next/image";
import { useRouter } from "next/navigation";
import { ExImg1 } from "public/images";
import React from "react";
import useGetUserInfo from "services/useGetUserInfo";
import SvgIcPrev from "src/assets/icons/components/IcPrev";
import { SvgIcCheck } from "src/assets/icons/components";
import styled, { css } from "styled-components";
import useExecuteVoteService from "../services/useExecuteVoteService";

type AorB = "A" | "B";
type ActiveType = "active" | "inactive" | null;
Expand Down Expand Up @@ -58,7 +55,6 @@ function VoteDescription({
drinkAId,
drinkBId,
}: Props) {
const { userInfo } = useGetUserInfo();
const router = useRouter();

const getAB = (direction: Direction) => {
Expand Down Expand Up @@ -131,9 +127,14 @@ function VoteDescription({
</RightVote>
</ImageWrapper>
<FlexRow>
<SmallTitle>{titleA}</SmallTitle>

<SmallTitle>{titleB}</SmallTitle>
<SmallTitle isSelect={select === "A"}>
{select === "A" && <SvgIcCheck width={20} height={20} />}
{titleA}
</SmallTitle>
<SmallTitle isSelect={select === "B"}>
{select === "B" && <SvgIcCheck width={20} height={20} />}
{titleB}
</SmallTitle>
</FlexRow>
</Container>
);
Expand All @@ -151,16 +152,17 @@ const ImageWrapper = styled.div`
gap: 9px;
`;

const SmallTitle = styled.div`
margin-top: 20px;
padding: 4px;
width: 100%;
display: flex;
align-items: center;
gap: 8px;
${({ theme }) => css`
border-bottom: 1px solid ${theme.colors.line_01};
const SmallTitle = styled.div<{ isSelect: boolean }>`
${({ theme, isSelect }) => css`
${theme.typography.body_long03}
color: ${isSelect ? theme.colors.main_01 : theme.colors.black_01};
border-bottom: 1px solid ${theme.colors.line_01};
margin-top: 20px;
padding: 4px;
width: 100%;
display: flex;
align-items: center;
gap: 8px;
`};
`;

Expand Down Expand Up @@ -272,6 +274,7 @@ const VoteImageWrapper = styled.div`
flex-direction: column;
align-items: center;
justify-content: center;
border-radius: 10px;

${media.medium} {
height: 340px;
Expand Down
1 change: 1 addition & 0 deletions apps/jurumarble/src/app/vote/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function Detail() {
mutateBookMark={mutateBookMark}
isBookmark={isBookmark}
postedUserId={data.postedUserId}
select={select.choice}
/>
<VoteDescription
imageA={imageA}
Expand Down
1 change: 1 addition & 0 deletions apps/jurumarble/src/app/vote/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function VoteHomePage() {
description={detail}
mutateBookMark={mutateBookMark}
isBookmark={isBookmark}
select={select.choice}
/>
<VoteDescription
voteType={voteType}
Expand Down
11 changes: 9 additions & 2 deletions apps/jurumarble/src/components/Chip.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled, { css } from "styled-components";

interface Props {
variant: "region" | "numberOfParticipants";
variant: "region" | "numberOfParticipants" | "isVote";
children: React.ReactNode;
}

Expand All @@ -21,7 +21,14 @@ const variantStyles = {
numberOfParticipants: css`
${({ theme }) => css`
background-color: ${theme.colors.bg_01};
color: ${theme.colors.black_02};
color: ${theme.colors.black_01};
`}
`,
isVote: css`
${({ theme }) => css`
background-color: ${theme.colors.bg_01};
color: ${theme.colors.black_01};
line-height: 12px;
`}
`,
};
Expand Down
Loading