Skip to content

Commit 67ef14f

Browse files
committed
fix: 채팅방이 없을 때 UI 제거 & 오딩이 프로필 이미지 기본 프로필로 설정
1 parent 1f26638 commit 67ef14f

6 files changed

Lines changed: 25 additions & 38 deletions

File tree

src/pages/Chats/MatchingRoom/MatchingMessage/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import dayjs from 'dayjs';
22

33
import RcvdMessage from '@pages/Chats/RcvdMessage';
44

5+
import defaultProfile from '@assets/default/defaultProfile.svg';
6+
57
import type { MatchingData } from '@apis/matching/dto';
68
import type { RcvdMessageProps } from '@pages/Chats/RcvdMessage/dto';
79

@@ -14,7 +16,7 @@ const MatchingMessage: React.FC<MatchingData> = ({ id, message, createdAt, chatR
1416

1517
const firstMessageProps: RcvdMessageProps = {
1618
fromUserNickname: '오딩이',
17-
profilePictureUrl: '',
19+
profilePictureUrl: defaultProfile,
1820
content: '얘가 너 소개받고 싶대',
1921
isSenderChanged: false,
2022
isProfileImageVisible: true,
@@ -24,7 +26,7 @@ const MatchingMessage: React.FC<MatchingData> = ({ id, message, createdAt, chatR
2426

2527
const matchingMessageProps: RcvdMessageProps = {
2628
fromUserNickname: '오딩이',
27-
profilePictureUrl: '',
29+
profilePictureUrl: defaultProfile,
2830
content: message,
2931
isSenderChanged: false,
3032
isProfileImageVisible: false,

src/pages/Chats/MatchingRoom/NoMatchingMessage/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ import dayjs from 'dayjs';
22

33
import RcvdMessage from '@pages/Chats/RcvdMessage';
44

5+
import defaultProfile from '@assets/default/defaultProfile.svg';
6+
57
import type { RcvdMessageProps } from '@pages/Chats/RcvdMessage/dto';
68

79
const NoMatchingMessage: React.FC = () => {
810
const formattedTime = dayjs(new Date()).format('HH:mm');
911

1012
const messageProps: RcvdMessageProps = {
1113
fromUserNickname: '오딩이',
12-
profilePictureUrl: '',
14+
profilePictureUrl: defaultProfile,
1315
content: '매칭이 들어오면 오딩이가 알려줄게!',
1416
isSenderChanged: true,
1517
isProfileImageVisible: true,

src/pages/Chats/MatchingRoom/index.tsx

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,19 @@ const MatchingRoom: React.FC = () => {
9494
$withBorder={true}
9595
/>
9696
<MessagesContainer $isLoading={isLoading}>
97-
{allMatchings.length === 0 ? (
98-
<NoMatchingMessage />
99-
) : (
100-
allMatchings.map((matching: MatchingData) => {
101-
console.log(matching);
102-
return (
103-
<div key={matching.id}>
104-
<MatchingMessage {...matching} />
105-
<ResponseMessage
106-
matchingId={matching.id}
107-
chatRoomId={matching.chatRoomId}
108-
requestStatus={matching.requestStatus}
109-
/>
110-
</div>
111-
);
112-
})
113-
)}
97+
{allMatchings.map((matching: MatchingData) => {
98+
console.log(matching);
99+
return (
100+
<div key={matching.id}>
101+
<MatchingMessage {...matching} />
102+
<ResponseMessage
103+
matchingId={matching.id}
104+
chatRoomId={matching.chatRoomId}
105+
requestStatus={matching.requestStatus}
106+
/>
107+
</div>
108+
);
109+
})}
114110
{!hasNewMatching && <NoMatchingMessage />}
115111
<div ref={chatWindowRef} />
116112
</MessagesContainer>

src/pages/Chats/RecentChat/MatchingRoomItem/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import theme from '@styles/theme';
88

99
import { LatestMatchingData } from '@apis/matching/dto';
1010

11+
import defaultProfile from '@assets/default/defaultProfile.svg';
12+
1113
import { StyledText } from '@components/Text/StyledText';
1214

1315
import { UserImage, MatchingRoomLayout, LeftBox, RightBox, LatestMessage } from './styles';
@@ -40,7 +42,7 @@ const MatchingRoomItem: React.FC<Partial<LatestMatchingData>> = ({ requestStatus
4042

4143
return (
4244
<MatchingRoomLayout onClick={handleMatchingRoomClick}>
43-
<UserImage src={'오딩이 프로필 이미지'} alt="user" />
45+
<UserImage src={defaultProfile} alt="user" />
4446
<LeftBox>
4547
<StyledText $textTheme={{ style: 'body2-medium' }} color={theme.colors.text.primary}>
4648
오딩이

src/pages/Chats/RecentChat/index.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ import { useSocket } from '@context/SocketProvider';
77
import { getCurrentUserId } from '@utils/getCurrentUserId';
88

99
import Loading from '@components/Loading';
10-
import { StyledText } from '@components/Text/StyledText';
1110

1211
import type { ChatRoomData } from '@apis/chatting/dto';
1312

1413
import ChatRoomItem from './ChatRoomItem/index';
1514
import MatchingRoomItem from './MatchingRoomItem/index';
1615

17-
import { ChatRoomList, NoChatRoomWrapper, RecentChatInfo } from './styles';
16+
import { ChatRoomList, RecentChatInfo } from './styles';
1817

1918
const RecentChat: React.FC = () => {
2019
const [chatRoomList, setChatRoomList] = useState<ChatRoomData[]>([]);
@@ -72,7 +71,7 @@ const RecentChat: React.FC = () => {
7271
<>
7372
{isLoading ? (
7473
<Loading />
75-
) : chatRoomList.length !== 0 ? (
74+
) : (
7675
<>
7776
<RecentChatInfo $textTheme={{ style: 'body2-regular' }} color={theme.colors.text.primary}>
7877
최근 채팅방
@@ -84,12 +83,6 @@ const RecentChat: React.FC = () => {
8483
))}
8584
</ChatRoomList>
8685
</>
87-
) : (
88-
<NoChatRoomWrapper>
89-
<StyledText $textTheme={{ style: 'headline1-medium' }} color={theme.colors.text.tertiary}>
90-
개설된 채팅방이 없어요.
91-
</StyledText>
92-
</NoChatRoomWrapper>
9386
)}
9487
</>
9588
);

src/pages/Chats/RecentChat/styles.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,3 @@ export const ChatRoomList = styled.ul`
1313
gap: 1rem;
1414
padding: 0.62rem 1.25rem;
1515
`;
16-
17-
export const NoChatRoomWrapper = styled.div`
18-
width: 100%;
19-
height: 100%;
20-
display: flex;
21-
justify-content: center;
22-
align-items: center;
23-
`;

0 commit comments

Comments
 (0)