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

[GGFE-39] 게임 결과 입력 #809

Merged
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
19 changes: 9 additions & 10 deletions components/modal/afterGame/Guide.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import { MatchMode } from 'types/mainType';
import styles from 'styles/modal/afterGame/AfterGameModal.module.scss';

type ModalMode = MatchMode | 'confirm';
interface GuideProps {
condition: boolean;
modalMode: ModalMode;
modalMode: 'NORMAL' | 'RANK';
}

export default function Guide({ condition, modalMode }: GuideProps) {
const content = {
normal: {
NORMAL: {
before: '즐거운 경기 하셨나요?',
after: '즐거운 경기 하셨나요?',
explains: '다음에도 사용해 주실거죠? 😉',
},
rank: {
RANK: {
before: '경기 후 점수를 입력해주세요',
after: '경기 결과 확인',
explains: '💡 3판 2선승제!\n💡 동점은 1점 내기로 승부를 결정!',
},
confirm: {
before: '경기 결과!',
after: '경기 결과!',
explains: '이미 입력된 경기입니다. 점수를 확인하세요!\n',
},
// NOTE : 이전부터 사용이 안되던 부분인 것 같아서 일단 주석으로 남겨두었습니다.
// CONFIRM: {
// before: '경기 결과!',
// after: '경기 결과!',
// explains: '이미 입력된 경기입니다. 점수를 확인하세요!\n',
// },
Comment on lines +20 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분은 상대방이 먼저 점수 입력했을 때 뜨는 메세지 아닌가요?
본적이 있는 문구인 것 같은데 다시 확인해봐야겠네요

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'confirm' 을 검색했을 때 이 단어 자체가 사용되는 부분이 이 부분밖에 없긴 한데요... 🤔
제가 알기론 상대방이 점수를 입력했을 때에는 isScoreExist 값을 확인해서 다시입력 , 제출하기 버튼이 뜨는게 아니라 게임 종료 버튼이 바로 뜨는 방식이라 따로 confirm modal(?)을 띄우는 부분이 없을 것 같기도 해요.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다시 확인해보니까 기존과는 달리 현재 변경된 api로는 한명이라도 점수를 입력하면 경기에 참여한 모든 사람들의 상태가 게임 종료로 떠서 confirm modal을 아예 띄울 수가 없네요,,, 🥹 이부분은 users/live api에서 다시 로직을 확인해봐야 할 것 같습니다...😵‍💫

};

return (
Expand Down
2 changes: 1 addition & 1 deletion components/modal/afterGame/NormalGame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function NormalGame({ currentGame, onSubmit }: NormalGameProps) {

return (
<div className={styles.container}>
<Guide condition={true} modalMode='normal' />
<Guide condition={true} modalMode='NORMAL' />
<div className={styles.resultContainer}>
<MatchTeams matchTeams={matchTeamsInfo} />
</div>
Expand Down
4 changes: 2 additions & 2 deletions components/modal/statChange/StatChangeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function StatChangeModal({ gameId, mode }: Exp) {
}, []);

const getExpHandler = useAxiosGet({
url: `/pingpong/games/${gameId}/result/${mode}`,
url: `/pingpong/games/${gameId}/result/${mode?.toLowerCase()}`,
setState: setStat,
err: 'KP03',
type: 'setError',
Expand All @@ -39,7 +39,7 @@ export default function StatChangeModal({ gameId, mode }: Exp) {
/>
<div className={styles.container}>
<div className={styles.emoji}>🏓</div>
{mode === 'rank' && <PppStat stat={stat} />}
{mode === 'RANK' && <PppStat stat={stat} />}
<ExpStat stat={stat} />
<div className={styles.guide}>화면을 클릭해주세요!</div>
</div>
Expand Down
8 changes: 3 additions & 5 deletions hooks/modal/aftergame/useSubmitModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const useSubmitModal = (currentGame: AfterGame) => {
enemyTeamId: enemyTeam.teamId,
};
try {
await instance.post(`/pingpong/games/result/normal`, requestBody);
await instance.post(`/pingpong/games/normal`, requestBody);
} catch (e) {
setError('KP04');
return;
Expand All @@ -67,10 +67,8 @@ const useSubmitModal = (currentGame: AfterGame) => {
setModal({
modalName: 'FIXED-STAT',
exp: {
gameId: currentGame.gameId,
mode: currentGame.mode?.toLowerCase() as Lowercase<
Uppercase<MatchMode>
>,
gameId: gameId,
mode: mode,
},
});
};
Expand Down
11 changes: 11 additions & 0 deletions types/gameTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,14 @@ export type GameListData = {
games: Game[];
isLast: boolean;
};

export type GameResult = {
beforeExp: number;
beforeMaxExp: number;
beforeLevel: number;
increasedExp: number;
increasedLevel: number;
afterMaxExp: number;
changedPpp?: number;
beforePpp?: number;
};