-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feat : 모든 오픈 채팅방 목록 화면에 보여주기
- Loading branch information
Showing
8 changed files
with
103 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { AllOpenChat } from '@/app/search/search.type'; | ||
|
||
const FilterOpenChat = ({ initialData }: { initialData: AllOpenChat }) => { | ||
console.log(initialData); | ||
return ( | ||
<> | ||
<hr /> | ||
<h2>FilterOpenChat</h2> | ||
<hr /> | ||
</> | ||
); | ||
}; | ||
|
||
export default FilterOpenChat; |
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,28 @@ | ||
import React from 'react'; | ||
import { User } from '@/app/search/search.type'; | ||
|
||
const OpenChatPicture = ({ openChatUsers }: { openChatUsers: User[] }) => { | ||
let userCount = 0; | ||
|
||
return ( | ||
<> | ||
<ol> | ||
{openChatUsers.map((user) => { | ||
userCount++; | ||
|
||
if (userCount > 4) { | ||
return null; // 사진이 4개 이상인 경우 렌더링을 하지 않음 | ||
} | ||
|
||
return ( | ||
<li key={user.id}> | ||
<img src={user.picture} alt="user picture" /> | ||
</li> | ||
); | ||
})} | ||
</ol> | ||
</> | ||
); | ||
}; | ||
|
||
export default OpenChatPicture; |
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 React from 'react'; | ||
import { Chat } from '@/app/search/search.type'; | ||
|
||
const OpenChatText = ({ openChat }: { openChat: Chat }) => { | ||
return ( | ||
<> | ||
<h2>{openChat.name}</h2> | ||
<span>{openChat.users.length}</span> | ||
<span>{openChat.updatedAt.toString()}</span> | ||
</> | ||
); | ||
}; | ||
|
||
export default OpenChatText; |
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 React from 'react'; | ||
import { AllOpenChat } from '@/app/search/search.type'; | ||
|
||
const SearchOpenChat = ({ initialData }: { initialData: AllOpenChat }) => { | ||
console.log(initialData); | ||
return ( | ||
<> | ||
<hr /> | ||
<h2>SearchOpenChat</h2> | ||
</> | ||
); | ||
}; | ||
|
||
export default SearchOpenChat; |
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,20 @@ | ||
import React from 'react'; | ||
import { AllOpenChat } from '@/app/search/search.type'; | ||
import OpenChatText from './OpenChatText'; | ||
import OpenChatPicture from './OpenChatPicture'; | ||
|
||
// 채팅방 이름, 채팅방 참여자 수, 최근 대화 시간 | ||
const ShowAllOpenChat = ({ allOpenChat }: { allOpenChat: AllOpenChat }) => { | ||
return ( | ||
<ul> | ||
{allOpenChat.map((openChat) => ( | ||
<li key={openChat.id}> | ||
<OpenChatText openChat={openChat} /> | ||
<OpenChatPicture openChatUsers={openChat.users} /> | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
}; | ||
|
||
export default ShowAllOpenChat; |
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
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