Skip to content

Commit 6cd9401

Browse files
committed
チャット画面のメッセージも統一
1 parent f03947c commit 6cd9401

File tree

1 file changed

+77
-84
lines changed

1 file changed

+77
-84
lines changed

web/app/chat/components/RoomList.tsx

Lines changed: 77 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { Box, List, Typography } from "@mui/material";
44
import type { RoomOverview } from "common/types";
55
import { useRouter, useSearchParams } from "next/navigation";
6+
import BackgroundText from "~/components/common/BackgroundText";
67
import { HumanListItem } from "~/components/human/humanListItem";
78
import RoomPage from "./RoomPage";
89

@@ -23,93 +24,85 @@ export function RoomList(props: RoomListProps) {
2324
return (
2425
<>
2526
{!friendId ? (
26-
<List disablePadding>
27-
<p
28-
style={{
29-
marginLeft: "40px",
30-
marginRight: "40px",
31-
}}
32-
>
33-
{roomsData && roomsData.length === 0 && (
34-
<>
35-
誰ともマッチングしていません。
36-
<br />
37-
リクエストを送りましょう!
38-
</>
39-
)}
40-
</p>
41-
{roomsData?.map((room) => {
42-
if (room.isDM) {
43-
if (room.matchingStatus === "otherRequest") {
44-
return (
45-
<Box
46-
key={room.friendId}
47-
onClick={(e) => {
48-
e.stopPropagation();
49-
openRoom(room);
50-
}}
51-
>
52-
<HumanListItem
27+
<>
28+
{roomsData && roomsData.length === 0 ? (
29+
<BackgroundText text="まだ誰ともマッチングしていません。リクエストを送りましょう!" />
30+
) : (
31+
<List>
32+
{roomsData?.map((room) => {
33+
if (room.isDM) {
34+
if (room.matchingStatus === "otherRequest") {
35+
return (
36+
<Box
37+
key={room.friendId}
38+
onClick={(e) => {
39+
e.stopPropagation();
40+
openRoom(room);
41+
}}
42+
>
43+
<HumanListItem
44+
key={room.friendId}
45+
id={room.friendId}
46+
name={room.name}
47+
pictureUrl={room.thumbnail}
48+
rollUpName={true}
49+
lastMessage={room.lastMsg?.content}
50+
statusMessage="リクエストを受けました"
51+
unreadCount={room.unreadMessages}
52+
/>
53+
</Box>
54+
);
55+
}
56+
if (room.matchingStatus === "myRequest") {
57+
return (
58+
<Box
59+
key={room.friendId}
60+
onClick={(e) => {
61+
e.stopPropagation();
62+
openRoom(room);
63+
}}
64+
>
65+
<HumanListItem
66+
key={room.friendId}
67+
id={room.friendId}
68+
name={room.name}
69+
pictureUrl={room.thumbnail}
70+
rollUpName={true}
71+
lastMessage={room.lastMsg?.content}
72+
statusMessage="リクエスト中 メッセージを送りましょう!"
73+
unreadCount={room.unreadMessages}
74+
/>
75+
</Box>
76+
);
77+
}
78+
return (
79+
<Box
5380
key={room.friendId}
54-
id={room.friendId}
55-
name={room.name}
56-
pictureUrl={room.thumbnail}
57-
rollUpName={true}
58-
lastMessage={room.lastMsg?.content}
59-
statusMessage="リクエストを受けました"
60-
unreadCount={room.unreadMessages}
61-
/>
62-
</Box>
63-
);
64-
}
65-
if (room.matchingStatus === "myRequest") {
81+
onClick={() => {
82+
openRoom(room);
83+
}}
84+
>
85+
<HumanListItem
86+
key={room.friendId}
87+
id={room.friendId}
88+
name={room.name}
89+
pictureUrl={room.thumbnail}
90+
rollUpName={true}
91+
lastMessage={room.lastMsg?.content}
92+
unreadCount={room.unreadMessages}
93+
/>
94+
</Box>
95+
);
96+
}
6697
return (
67-
<Box
68-
key={room.friendId}
69-
onClick={(e) => {
70-
e.stopPropagation();
71-
openRoom(room);
72-
}}
73-
>
74-
<HumanListItem
75-
key={room.friendId}
76-
id={room.friendId}
77-
name={room.name}
78-
pictureUrl={room.thumbnail}
79-
rollUpName={true}
80-
lastMessage={room.lastMsg?.content}
81-
statusMessage="リクエスト中 メッセージを送りましょう!"
82-
unreadCount={room.unreadMessages}
83-
/>
84-
</Box>
98+
<Typography key={room.roomId} variant="body2" sx={{ mb: 1 }}>
99+
グループチャット: {room.name}
100+
</Typography>
85101
);
86-
}
87-
return (
88-
<Box
89-
key={room.friendId}
90-
onClick={() => {
91-
openRoom(room);
92-
}}
93-
>
94-
<HumanListItem
95-
key={room.friendId}
96-
id={room.friendId}
97-
name={room.name}
98-
pictureUrl={room.thumbnail}
99-
rollUpName={true}
100-
lastMessage={room.lastMsg?.content}
101-
unreadCount={room.unreadMessages}
102-
/>
103-
</Box>
104-
);
105-
}
106-
return (
107-
<Typography key={room.roomId} variant="body2" sx={{ mb: 1 }}>
108-
グループチャット: {room.name}
109-
</Typography>
110-
);
111-
})}
112-
</List>
102+
})}
103+
</List>
104+
)}
105+
</>
113106
) : (
114107
<RoomPage id={Number.parseInt(friendId)} />
115108
)}

0 commit comments

Comments
 (0)