-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] 라운드 결과 페이지 버그 개선
- Loading branch information
Showing
37 changed files
with
420 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 24 additions & 39 deletions
63
frontend/src/components/OptionParticipantsContainer/OptionParticipantsContainer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
frontend/src/components/RoundVoteContainer/RoundVoteContainer.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
frontend/src/components/StartButtonContainer/StartButton/StartButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
frontend/src/components/StartButtonContainer/StartButton/StartButton.utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const getStartButtonText = (isMaster: boolean, isPending: boolean) => { | ||
if (isMaster && isPending) return '시작중...'; | ||
if (isMaster) return '시작'; | ||
return '방장이 진행해 주세요'; | ||
}; | ||
|
||
export default getStartButtonText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 2 additions & 8 deletions
10
frontend/src/components/StartButtonContainer/StartButtonContainer.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
frontend/src/components/TabContentContainer/EmptyVoteContent/EmptyVoteContent.styled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
import { Theme } from '@/styles/Theme'; | ||
|
||
export const emptyVoteTextContainer = css` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
`; | ||
|
||
export const emptyVoteText = css` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 8vh; | ||
${Theme.typography.headline3} | ||
`; | ||
|
||
export const angryImage = css` | ||
width: 16rem; | ||
height: 14rem; | ||
`; |
14 changes: 14 additions & 0 deletions
14
frontend/src/components/TabContentContainer/EmptyVoteContent/EmptyVoteContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { angryImage, emptyVoteText, emptyVoteTextContainer } from './EmptyVoteContent.styled'; | ||
|
||
import AngryDdangkong from '@/assets/images/angryDdangkong.webp'; | ||
|
||
const EmptyVoteContent = () => { | ||
return ( | ||
<div css={emptyVoteTextContainer}> | ||
<img src={AngryDdangkong} alt="" css={angryImage} /> | ||
<span css={emptyVoteText}>아무도 투표하지 않으셨네요 :{`)`}</span> | ||
</div> | ||
); | ||
}; | ||
|
||
export default EmptyVoteContent; |
45 changes: 45 additions & 0 deletions
45
frontend/src/components/TabContentContainer/StatisticBar/StatisticBar.styled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
import { Theme } from '@/styles/Theme'; | ||
|
||
export const barContainer = css` | ||
display: flex; | ||
overflow: hidden; | ||
align-items: center; | ||
width: inherit; | ||
border-radius: 1.6rem; | ||
`; | ||
|
||
export const barWrapper = css` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 8vh; | ||
color: black; | ||
font-weight: bold; | ||
font-size: 1.6rem; | ||
transition: all 1s; | ||
`; | ||
|
||
export const firstBar = (percent: number, isBigFirstOption: boolean) => css` | ||
${barWrapper} | ||
overflow: hidden; | ||
width: ${percent}%; | ||
border-radius: 1.6rem 0 0 1.6rem; | ||
background-color: ${isBigFirstOption ? Theme.color.peanut400 : Theme.color.gray}; | ||
transform: translateX(5px); | ||
clip-path: ${percent === 100 ? 'none' : 'polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%)'}; | ||
`; | ||
|
||
export const secondBar = (percent: number, isBigFirstOption: boolean) => css` | ||
${barWrapper} | ||
overflow: hidden; | ||
width: ${percent}%; | ||
border-radius: 0 1.6rem 1.6rem 0; | ||
background-color: ${isBigFirstOption ? Theme.color.gray : Theme.color.peanut400}; | ||
transform: translateX(-5px); | ||
clip-path: ${percent === 100 ? 'none' : 'polygon(10px 0, 100% 0, 100% 100%, 0 100%)'}; | ||
`; |
38 changes: 38 additions & 0 deletions
38
frontend/src/components/TabContentContainer/StatisticBar/StatisticBar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useEffect, useState } from 'react'; | ||
|
||
import { barContainer, firstBar, secondBar } from './StatisticBar.styled'; | ||
|
||
import useTotalCountAnimation from '@/components/RoundVoteContainer/RoundVoteContainer.hook'; | ||
import { Group } from '@/types/roundVoteResult'; | ||
|
||
const INITIAL_OPTION_PERCENT = 50; | ||
|
||
interface StatisticBarProps { | ||
groupRoundResult: Group; | ||
} | ||
const StatisticBar = ({ groupRoundResult }: StatisticBarProps) => { | ||
const { animatedFirstPercent, animatedSecondPercent } = useTotalCountAnimation(groupRoundResult); | ||
const [optionPercent, setOptionPercent] = useState({ | ||
first: INITIAL_OPTION_PERCENT, | ||
second: INITIAL_OPTION_PERCENT, | ||
}); | ||
|
||
const isBigFirstOption = optionPercent.first >= 50; | ||
|
||
useEffect(() => { | ||
setOptionPercent((prev) => ({ | ||
...prev, | ||
first: groupRoundResult.firstOption.percent, | ||
second: groupRoundResult.secondOption.percent, | ||
})); | ||
}, [groupRoundResult]); | ||
|
||
return ( | ||
<div css={barContainer}> | ||
<span css={firstBar(optionPercent.first, isBigFirstOption)}>{animatedFirstPercent}%</span> | ||
<span css={secondBar(optionPercent.second, isBigFirstOption)}>{animatedSecondPercent}%</span> | ||
</div> | ||
); | ||
}; | ||
|
||
export default StatisticBar; |
Oops, something went wrong.