diff --git a/components/ActivityDetails/ActivityDetails.tsx b/components/ActivityDetails/ActivityDetails.tsx index 29e75ef..dcbef29 100644 --- a/components/ActivityDetails/ActivityDetails.tsx +++ b/components/ActivityDetails/ActivityDetails.tsx @@ -28,6 +28,7 @@ import { usePopup } from '@/hooks/usePopup'; import { darkModeState } from '@/states/themeState'; import SendChat from '../Chat/SendChat'; import { ShareButton } from '../ShareButton/ShareButton'; +import { loginState } from '@/states/loginState'; import { ViewedActivitiesState } from '@/states/ViewedState'; import { ViewedActivityProps } from '../ViewedActivities/ViewedActivities.type'; @@ -35,6 +36,7 @@ export default function ActivityDetails({ id }: ActivityDetailsProps) { const router = useRouter(); const [isOpen, setIsOpen] = useState(false); const isDarkMode = useRecoilValue(darkModeState); + const isLogined = useRecoilValue(loginState); const [currentPage, setCurrentPage] = useState( router.query.page ? parseInt(router.query.page as string, 10) : 1 ); @@ -203,12 +205,14 @@ export default function ActivityDetails({ id }: ActivityDetailsProps) { -
+
- {!isAuthor && ( + {isLogined && !isAuthor && ( )} - {isPopupOpen && ( - + )} ); diff --git a/components/Chat/SendChat.types.ts b/components/Chat/SendChat.types.ts index e67e308..9db2d2a 100644 --- a/components/Chat/SendChat.types.ts +++ b/components/Chat/SendChat.types.ts @@ -1,4 +1,6 @@ export interface SendChatProps { receiver: number; activityId: number; + activityTitle: string; + activityImage: string; } diff --git a/components/MyActivity/Card/Card.tsx b/components/MyActivity/Card/Card.tsx index 1f2af02..3cdabef 100644 --- a/components/MyActivity/Card/Card.tsx +++ b/components/MyActivity/Card/Card.tsx @@ -12,6 +12,8 @@ import Link from 'next/link'; import ChatPopup from '@/components/Popup/ChatPopup'; import { useUserData } from '@/hooks/useUserData'; import socket from '@/server/server'; +import { useRecoilValue } from 'recoil'; +import { darkModeState } from '@/states/themeState'; function PopoverButton({ children, onClick }: PopoverButtonProps) { return ( @@ -69,7 +71,7 @@ function Card({ }: CardProps) { const [isPopoverOpen, setIsPopoverOpen] = useState(false); const [isPopupOpen, setIsPopupOpen] = useState(false); - const { userData } = useUserData(); + const isDarkMode = useRecoilValue(darkModeState); const handleClickMeatball = () => { setIsPopoverOpen(!isPopoverOpen); @@ -132,7 +134,11 @@ function Card({
+ )} +
@@ -60,6 +106,10 @@ function ChatPopup({ activityId={activityId} handleSenderId={setSenderId} handleSendEnable={setIsSendEnabled} + isEnter={isEnter} + handleIsEnter={setIsEnter} + handleNickName={setNickName} + handleProfile={setProfile} /> ) : ( @@ -91,18 +141,23 @@ function ShowChatRoomList({ activityId, handleSenderId, handleSendEnable, + isEnter, + handleIsEnter, + handleNickName, + handleProfile, }: ChatRoomPopupProps) { const [rooms, setRooms] = useState([]); - const [isEnter, setIsEnter] = useState(false); const { userData } = useUserData(); - const handleClickRoom = (userId: number) => { + const handleClickRoom = (userId: number, index: number) => { socket.emit('inquiryAdmin', userData.id, activityId, userId, (res: any) => { console.log('inquiryAdmin res', res); }); - setIsEnter(true); + handleIsEnter(true); handleSenderId(userId); handleSendEnable(true); + handleNickName(rooms[index].user.name); + handleProfile(rooms[index].user.profile); }; useEffect(() => { @@ -129,8 +184,8 @@ function ShowChatRoomList({