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-872] 투표 통계 버그 수정 + 자체 QA #176

Merged
merged 10 commits into from
Oct 15, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function DrinkCommentContainer() {
userId,
restaurant,
alcoholLimitType,
imageUrl,
},
index,
) => (
Expand All @@ -94,6 +95,7 @@ function DrinkCommentContainer() {
userId: userId,
restaurant,
alcoholLimitType,
imageUrl,
}}
mutateLike={() => mutateLike(id)}
mutateHate={() => mutateHate(id)}
Expand Down
1 change: 0 additions & 1 deletion apps/jurumarble/src/app/drink-info/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function DrinkInfoPage() {
<>
<DrinkInfoContainer />
<DrinkCommentContainer />
<BottomBar />
</>
);
}
Expand Down
2 changes: 2 additions & 0 deletions apps/jurumarble/src/app/my/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import BottomBar from "components/BottomBar";
import Header from "components/Header";
import UserInfoContainer from "./components/UseInfoContainer";
import VoteListContainer from "./components/VoteListContainer";
Expand All @@ -8,6 +9,7 @@ function MyPage() {
<Header />
<UserInfoContainer />
<VoteListContainer />
<BottomBar />
</>
);
}
Expand Down
23 changes: 17 additions & 6 deletions apps/jurumarble/src/app/vote/[id]/components/ChipContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,23 @@ const ChipContainer = ({
</FlexRow>
<FlexRow>
{isBookmark ? (
<SvgIcBookmarkActive width={26} height={26} onClick={() => mutateBookMark()} />
<SVGWrapper>
<SvgIcBookmarkActive width={26} height={26} onClick={() => mutateBookMark()} />
</SVGWrapper>
) : (
<SvgIcBookmark width={20} height={20} onClick={() => mutateBookMark()} />
<SVGWrapper>
<SvgIcBookmark width={20} height={20} onClick={() => mutateBookMark()} />
</SVGWrapper>
)}

{userInfo?.userId === postedUserId ? (
<div onClick={onToggleMenu} ref={targetEl}>
<SVGWrapper onClick={onToggleMenu} ref={targetEl}>
<SvgIcMenu width={20} height={20} />
</div>
</SVGWrapper>
) : (
<div onClick={onToggleNonWriterMenu} ref={targetEl2}>
<SVGWrapper onClick={onToggleNonWriterMenu} ref={targetEl2}>
<SvgIcMenu width={20} height={20} />
</div>
</SVGWrapper>
)}
{/*
<div
Expand Down Expand Up @@ -155,4 +159,11 @@ const Description = styled.div`
color: ${({ theme }) => theme.colors.black_02};
`;

const SVGWrapper = styled.div`
width: 26px;
height: 26px;
display: flex;
justify-content: center;
align-items: center;
`;
export default ChipContainer;
4 changes: 3 additions & 1 deletion apps/jurumarble/src/app/vote/[id]/components/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ interface Props {
nickName: string;
userId: number;
alcoholLimitType: string;
imageUrl: string;
restaurant: {
restaurantName: string;
restaurantImage: string;
Expand All @@ -59,6 +60,7 @@ function Comment({ comment, mutateLike, mutateHate, voteType, postId }: Props) {
userId,
restaurant,
alcoholLimitType,
imageUrl,
} = comment;

const [toggleMenu, onToggleMenu] = useToggle(false);
Expand Down Expand Up @@ -88,7 +90,7 @@ function Comment({ comment, mutateLike, mutateHate, voteType, postId }: Props) {
return (
<Container>
<Image
src={ExImg1}
src={imageUrl ? imageUrl : ExImg1}
alt="댓글 프로필"
width={40}
height={40}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function CommentContainer({ postId }: Props) {
userId,
restaurant,
alcoholLimitType,
imageUrl,
},
index,
) => (
Expand All @@ -97,6 +98,7 @@ function CommentContainer({ postId }: Props) {
userId: userId,
restaurant,
alcoholLimitType,
imageUrl,
}}
mutateLike={() => mutateLike(id)}
mutateHate={() => mutateHate(id)}
Expand Down
4 changes: 2 additions & 2 deletions apps/jurumarble/src/app/vote/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ function Detail() {
const { voteStatisticsQuery } = useFilteredStatisticsService(
Number(postId),
filter.gender,
filter.age,
filter.mbti,
filter.age,
filter.alcohol,
);
const {
data: statistics,
Expand Down Expand Up @@ -176,7 +177,6 @@ function Detail() {

<CommentContainer postId={Number(postId)} />
</PageInner>
<BottomBar />
</Container>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ export default function useFilteredStatisticsService(
gender?: string,
mbti?: string,
age?: string,
alcoholLimit?: string,
) {
const voteStatisticsQuery = useQuery(
reactQueryKeys.detailFilterdAnalysis(voteId, gender, mbti, age),
() => getFilterStatisticsById(voteId, gender, mbti, age),
reactQueryKeys.detailFilterdAnalysis(voteId, gender, mbti, age, alcoholLimit),
() => getFilterStatisticsById(voteId, gender, mbti, age, alcoholLimit),
{
enabled: !!voteId,
},
Expand Down
1 change: 1 addition & 0 deletions apps/jurumarble/src/components/BottomBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const BarItem = styled.div<{ isActive: boolean }>`
align-items: center;
justify-content: center;
color: ${({ isActive, theme }) => (isActive ? theme.colors.black_01 : theme.colors.black_05)};
cursor: pointer;
`;

const Padding = styled.div`
Expand Down
2 changes: 2 additions & 0 deletions apps/jurumarble/src/lib/apis/statistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const getFilterStatisticsById = async (
gender?: string,
mbti?: string,
age?: string,
alcoholLimit?: string,
) => {
const response = await baseApi.get<GetVoteStatisticsResponse>(
`api/votes/${voteId}/select-statistics`,
Expand All @@ -22,6 +23,7 @@ export const getFilterStatisticsById = async (
gender,
mbti,
age,
alcoholLimit,
},
},
);
Expand Down
10 changes: 5 additions & 5 deletions apps/jurumarble/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ export const VOTE_GENDER_FILTER_LIST = [

export const VOTE_AGE_FILTER_LIST = [
{ value: "", label: "나이" },
{ value: "10", label: "10대" },
{ value: "20", label: "20대" },
{ value: "30", label: "30대" },
{ value: "40", label: "40대" },
{ value: "50", label: "50대" },
{ value: "teenager", label: "10대" },
{ value: "twenties", label: "20대" },
{ value: "thirties", label: "30대" },
{ value: "fourties", label: "40대" },
{ value: "fifties", label: "50대" },
];

export const VOTE_ALCOHOL_FILTER_LIST = [
Expand Down
9 changes: 7 additions & 2 deletions apps/jurumarble/src/lib/queryKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ export const reactQueryKeys = {
sortBy?: string,
) => [queryKeys.DETAIL_COMMENT_LIST, typeId, commentType, size, page, sortBy] as const,
detailVoteCount: (id: number) => [queryKeys.DETAIL_VOTE_COUNT, id] as const,
detailFilterdAnalysis: (id: number, mbti?: string, gender?: string, age?: string) =>
[queryKeys.DETAIL_FILTERED_ANALYSIS, id, mbti, gender, age] as const,
detailFilterdAnalysis: (
id: number,
mbti?: string,
gender?: string,
age?: string,
alcoholLimit?: string,
) => [queryKeys.DETAIL_FILTERED_ANALYSIS, id, mbti, gender, age, alcoholLimit] as const,
drinksMap: (
startX: number,
startY: number,
Expand Down