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

QA에서 나온 채팅방 버그 수정 #670

Merged
merged 6 commits into from
Oct 17, 2024
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
10 changes: 8 additions & 2 deletions frontend/src/components/MissingFallback/MissingFallback.style.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { css } from '@emotion/react';
import { SerializedStyles, css } from '@emotion/react';

export const container = css`
export const container = ({
backgroundColor,
}: {
backgroundColor?: string | SerializedStyles;
}) => css`
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;

${backgroundColor ? `background-color: ${backgroundColor};` : ''}

min-width: 30rem;
min-height: 30rem;

Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/MissingFallback/MissingFallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import regretCat from '@_common/assets/regret_cat.webp';
interface MissingFallbackProps {
text: string;
font?: SerializedStyles;
backgroundColor?: string | SerializedStyles;
}

export default function MissingFallback(props: MissingFallbackProps) {
const { text, font } = props;
const { text, font, backgroundColor } = props;
const theme = useTheme();
return (
<div css={S.container}>
<div css={S.container({ backgroundColor })}>
<img src={regretCat} alt="미안해용" css={S.image} />
<span css={font || theme.typography.h5}>{text}</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export const headerCenter = ({ theme }: { theme: Theme }) => css`

export const headerBottom = css`
position: sticky;
top: 5rem;
top: 4.8rem;
left: -2rem;
`;
4 changes: 2 additions & 2 deletions frontend/src/mocks/handler/chatHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const chatRoomDetail: (BetChatRoomDetail | MoimChatRoomDetail)[] = [
isLoser: false,
betId: 22,
loser: {
nickname: '',
nickname: '패배자',
profile: '',
role: 'MOIMER',
},
Expand All @@ -31,7 +31,7 @@ const chatRoomDetail: (BetChatRoomDetail | MoimChatRoomDetail)[] = [
participations: [
{
nickname: '1',
profile: '',
profile: '',
role: 'MOIMER',
},
],
Expand Down
16 changes: 11 additions & 5 deletions frontend/src/pages/Chatting/ChattingRoomPage/ChattingRoomPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export default function ChattingRoomPage() {
return (
<MissingFallback
text={'아직 데이터가 로드되기도 전인데... \n 정말 빨리 누르시는군요'}
backgroundColor={theme.colorPalette.white[100]}
/>
);
}
Expand Down Expand Up @@ -128,23 +129,26 @@ export default function ChattingRoomPage() {
return (
<MissingFallback
text={'모임에 참여한 사람은 \n 아직 할 수 있는 기능이 없어요'}
backgroundColor={theme.colorPalette.white[100]}
/>
);
}

if (isBetChatRoomDetail(chatRoomDetail)) {
return (
<MissingFallback
text={'안내면진다 채팅방에서는 아직 \n 아직 할 수 있는 기능이 없어요'}
text={'안내면진다 채팅방에서는 \n 아직 할 수 있는 기능이 없어요'}
backgroundColor={theme.colorPalette.white[100]}
/>
);
}
return (
<MissingFallback
text={'아직 데이터가 로드되지 않았는데... \n 정말 빨리 누르시는 군요'}
text={'아직 데이터가 로드되지 않았는데... \n 정말 빨리 누르시는군요'}
backgroundColor={theme.colorPalette.white[100]}
/>
);
}, [chatRoomDetail]);
}, [chatRoomDetail, theme]);

return (
<ChattingRoomLayout>
Expand Down Expand Up @@ -197,15 +201,17 @@ export default function ChattingRoomPage() {
]}
/>
)}

{chatRoomDetail && isBetChatRoomDetail(chatRoomDetail) && (
<ChatInfoAccordion
tagTheme={chatRoomDetail.attributes.isLoser ? 'yellow' : 'orange'}
tagValue={chatRoomDetail.attributes.isLoser ? '당첨!' : '미당첨'}
textList={
chatRoomDetail.attributes.isLoser
? ['당첨입니다!', '혹시 안내셨나요?ㅋ']
: ['살아남았습니다!', '당첨된 친구를 놀려보세요~']
: [
'살아남았습니다!',
`당첨된 사람은 ${chatRoomDetail.attributes.loser.nickname}입니다!`,
]
}
/>
)}
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/pages/Moim/MainPage/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {

import Button from '@_components/Button/Button';
import DarakbangNameWrapper from '@_components/DarakbangNameWrapper/DarakbangNameWrapper';
import DefaultPageLayout from '@_layouts/DefaultPageLayout/DefaultPageLayout';
import GET_ROUTES from '@_common/getRoutes';
import HomeMainContent from './components/HomeMainContent/HomeMainContent';
import Modal from '@_components/Modal/Modal';
Expand All @@ -33,7 +34,6 @@ import { useNavigate } from 'react-router-dom';
import useNowDarakbangName from '@_hooks/queries/useNowDarakbangNameById';
import useServeToken from '@_hooks/mutaions/useServeToken';
import { useTheme } from '@emotion/react';
import DefaultPageLayout from '@_layouts/DefaultPageLayout/DefaultPageLayout';

export default function MainPage() {
const navigate = useNavigate();
Expand Down Expand Up @@ -82,6 +82,11 @@ export default function MainPage() {
}) || [];

options.push(
{
onClick: () => navigate(GET_ROUTES.nowDarakbang.darakbangMembers()),
description: '다락방 멤버 보기',
hasTopBorder: true,
},
{
onClick: () => navigate(ROUTES.darakbangEntrance),
description: '코드로 다른 다락방 들어가기',
Expand Down
Loading