diff --git a/src/components/molecules/chat/ChatHeaderInfo.tsx b/src/components/molecules/chat/ChatHeaderInfo.tsx index 07b6644..f2d4531 100644 --- a/src/components/molecules/chat/ChatHeaderInfo.tsx +++ b/src/components/molecules/chat/ChatHeaderInfo.tsx @@ -3,6 +3,7 @@ import Title from '@/components/atoms/Title'; import ToggleButton from '@/components/molecules/ToggleButton'; import SearchMessage from '@/components/organisms/chat/SearchMessage'; import { useChannel } from '@/hooks/chat/useChannel'; +import useAuthStore from '@/store/authStore'; import { useChatStore } from '@/store/chatStore'; import { Channel } from '@/types/channel.type'; import { useEffect, useState } from 'react'; @@ -13,6 +14,11 @@ interface ChatHeaderInfoProps { } const ChannelInfo = ({ channel }: { channel: Channel }) => { + const currentUserId = useAuthStore((state) => state.userInfo.userId); + const channelTitle = + channel.type === 'private' + ? channel.users.find((user) => user.userId !== currentUserId)?.name + : channel.title; return (
{ lineClamp={1} className='text-ellipsis w-[90%] md:text-[25px]' > - {channel.title} + {channelTitle ?? '채팅방'}
{channel.users.length}명의 맴버가 있습니다.