diff --git a/components/ActivityDetails/ActivityDetails.tsx b/components/ActivityDetails/ActivityDetails.tsx index 29e75ef..577b758 100644 --- a/components/ActivityDetails/ActivityDetails.tsx +++ b/components/ActivityDetails/ActivityDetails.tsx @@ -26,10 +26,10 @@ import { ActivityDetailsPageMeta } from '../MetaData/MetaData'; import useDeleteActivity from '@/hooks/myActivity/useDeleteActivity'; import { usePopup } from '@/hooks/usePopup'; import { darkModeState } from '@/states/themeState'; -import SendChat from '../Chat/SendChat'; import { ShareButton } from '../ShareButton/ShareButton'; import { ViewedActivitiesState } from '@/states/ViewedState'; import { ViewedActivityProps } from '../ViewedActivities/ViewedActivities.type'; +import profileThumbnail from '@/public/image/profile-circle-icon-512x512-zxne30hp.png'; export default function ActivityDetails({ id }: ActivityDetailsProps) { const router = useRouter(); @@ -203,22 +203,14 @@ export default function ActivityDetails({ id }: ActivityDetailsProps) { -
@@ -302,7 +294,7 @@ export default function ActivityDetails({ id }: ActivityDetailsProps) { >
diff --git a/components/Chat/SendChat.tsx b/components/Chat/SendChat.tsx index e650447..18346da 100644 --- a/components/Chat/SendChat.tsx +++ b/components/Chat/SendChat.tsx @@ -7,7 +7,12 @@ import { useState } from 'react'; import ChatPopup from '../Popup/ChatPopup'; import { SendChatProps } from './SendChat.types'; -function SendChat({ receiver, activityId }: SendChatProps) { +function SendChat({ + receiver, + activityId, + activityTitle, + activityImage, +}: SendChatProps) { const isDarkMode = useRecoilValue(darkModeState); const { userData } = useUserData(); const [isPopupOpen, setIsPopupOpen] = useState(false); @@ -41,25 +46,21 @@ function SendChat({ receiver, activityId }: SendChatProps) { return ( <> - - {isDarkMode ? ( - - ) : ( - - )} + + {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/Lander/AllActivities.tsx b/components/Lander/AllActivities.tsx index 49564db..5cc966e 100644 --- a/components/Lander/AllActivities.tsx +++ b/components/Lander/AllActivities.tsx @@ -157,7 +157,7 @@ function AllActivities() { return ( - + {Kategories.map((Kategorie, index) => ( 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({ )} diff --git a/components/Popup/ChatPopup.tsx b/components/Popup/ChatPopup.tsx index 5ebea67..31546dd 100644 --- a/components/Popup/ChatPopup.tsx +++ b/components/Popup/ChatPopup.tsx @@ -1,5 +1,4 @@ import { useState, useEffect } from 'react'; -import { CloseButtonBold } from '../Button/Button'; import { ChatListProps, ChatPopupProps, @@ -13,14 +12,27 @@ import Image from 'next/image'; function ChatPopup({ closePopup, activityId, + activityTitle, + activityImage, isAdmin = false, }: ChatPopupProps) { const [message, setMessage] = useState(''); const [senderId, setSenderId] = useState(0); + const [nickname, setNickName] = useState('문의 하기'); + const [profile, setProfile] = useState(activityImage); const [isSendEnabled, setIsSendEnabled] = useState(true); + const [isEnter, setIsEnter] = useState(false); + + const handleClickPrev = () => { + setIsEnter(false); + setIsSendEnabled(false); + setNickName('문의 내역'); + setProfile(activityImage); + }; const sendMessage = (event: any) => { event.preventDefault(); + if (message === '') return; if (isAdmin) { socket.emit( 'sendMessageAdmin', @@ -43,15 +55,50 @@ function ChatPopup({ useEffect(() => { setIsSendEnabled(!isAdmin); + if (isAdmin) { + setNickName('문의 내역'); + } }, []); return ( - - - - 문의 채팅 + + + + + + + + + {activityTitle} + {`@${nickname}`} + + + - + {isEnter && ( + + + + )} + + + @@ -60,6 +107,10 @@ function ChatPopup({ activityId={activityId} handleSenderId={setSenderId} handleSendEnable={setIsSendEnabled} + isEnter={isEnter} + handleIsEnter={setIsEnter} + handleNickName={setNickName} + handleProfile={setProfile} /> ) : ( @@ -91,18 +142,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 +185,8 @@ function ShowChatRoomList({ handleClickRoom(room.user.id)} - className={`flex items-center gap-[15px] p-[15px] h-[75px] bg-var-gray2 w-full max-w-[400px] border-b border-solid border-b-var-gray4`} + onClick={() => handleClickRoom(room.user.id, index)} + className={`flex items-center gap-[15px] p-[15px] h-[75px] bg-var-gray2 w-full max-w-[400px] border-b border-solid border-b-var-gray4 dark:bg-var-dark2`} > - + {room.user.name} @@ -153,7 +209,7 @@ function ShowChatRoomList({ ))} ) : ( - + 아직 문의 채팅이 없습니다. ))} @@ -200,7 +256,7 @@ function ShowChatList({ isAdmin = false }: ChatListProps) { className={`inline-block max-w-max rounded-[10px] p-[8px] pl-[10px] ${ sender[index] === 'user' ? 'bg-var-green2 text-white' - : 'bg-var-gray3' + : 'bg-var-gray3 text-var-dark1' }`} > {message} diff --git a/components/Popup/ChatPopup.types.tsx b/components/Popup/ChatPopup.types.tsx index f28c74e..c14c0ec 100644 --- a/components/Popup/ChatPopup.types.tsx +++ b/components/Popup/ChatPopup.types.tsx @@ -3,6 +3,8 @@ import { Dispatch, SetStateAction } from 'react'; export interface ChatPopupProps { closePopup: () => void; activityId: number; + activityTitle: string; + activityImage: string; isAdmin?: boolean; } @@ -21,6 +23,10 @@ export interface ChatRoomPopupProps { activityId: number; handleSenderId: Dispatch>; handleSendEnable: Dispatch>; + isEnter: boolean; + handleIsEnter: Dispatch>; + handleNickName: Dispatch>; + handleProfile: Dispatch>; } export interface ChatListProps { diff --git a/components/PriceFilterBtn/PriceFilterBtn.tsx b/components/PriceFilterBtn/PriceFilterBtn.tsx index 753ae9a..c865c66 100644 --- a/components/PriceFilterBtn/PriceFilterBtn.tsx +++ b/components/PriceFilterBtn/PriceFilterBtn.tsx @@ -31,10 +31,10 @@ export default function PriceFilterBtn() { return ( setShowMenuList((prev) => !prev)} > - + {isClient && !showMenuList ? sortedName || '정렬' : sortedName} { setAnimationClass('rotate-open'); @@ -29,10 +33,10 @@ function ViewedActivities() { return ( - + {!isOpen ? ( ) : ( {isOpen && ( 최근 방문한 체험 diff --git a/components/ViewedActivities/ViewedActivity.tsx b/components/ViewedActivities/ViewedActivity.tsx index 4513a98..b5529c7 100644 --- a/components/ViewedActivities/ViewedActivity.tsx +++ b/components/ViewedActivities/ViewedActivity.tsx @@ -12,7 +12,7 @@ function ViewedActivity({ id, bannerImage, title }: ViewedActivityProps) { return ( \ No newline at end of file diff --git a/public/icon/History_white.svg b/public/icon/History_white.svg new file mode 100644 index 0000000..9c82aa4 --- /dev/null +++ b/public/icon/History_white.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/icon/chat_close.svg b/public/icon/chat_close.svg new file mode 100644 index 0000000..751b33f --- /dev/null +++ b/public/icon/chat_close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/icon/close_black.svg b/public/icon/close_black.svg new file mode 100644 index 0000000..9fa34c5 --- /dev/null +++ b/public/icon/close_black.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/icon/close_white.svg b/public/icon/close_white.svg new file mode 100644 index 0000000..eeafc65 --- /dev/null +++ b/public/icon/close_white.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/icon/prev_arrow.svg b/public/icon/prev_arrow.svg new file mode 100644 index 0000000..b117403 --- /dev/null +++ b/public/icon/prev_arrow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/mockData/roadActivitiesData.json b/public/mockData/roadActivitiesData.json deleted file mode 100644 index 5e0ac6f..0000000 --- a/public/mockData/roadActivitiesData.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "activities": [ - { - "id": 1591, - "userId": 592, - "title": "함께 배우면 즐거운 스트릿댄스", - "description": "둠칫 둠칫 두둠칫", - "category": "투어", - "price": 10000, - "address": "서울특별시 강남구 테헤란로 427", - "bannerImageUrl": "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/globalnomad/activity_registration_image/a.png", - "rating": 0, - "reviewCount": 0, - "createdAt": "2024-07-09T15:20:05.886Z", - "updatedAt": "2024-07-09T15:20:05.886Z" - }, - { - "id": 1592, - "userId": 593, - "title": "강남 한복 체험", - "description": "전통 한복을 입고 강남을 거닐어요", - "category": "문화 예술", - "price": 20000, - "address": "서울특별시 강남구 봉은사로 102", - "bannerImageUrl": "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/globalnomad/activity_registration_image/b.png", - "rating": 4.5, - "reviewCount": 15, - "createdAt": "2024-07-08T10:15:00.886Z", - "updatedAt": "2024-07-08T10:15:00.886Z" - }, - { - "id": 1593, - "userId": 594, - "title": "강남 쿠킹 클래스", - "description": "강남에서 즐기는 한국 요리 클래스", - "category": "식음료", - "price": 30000, - "address": "서울특별시 강남구 논현로 205", - "bannerImageUrl": "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/globalnomad/activity_registration_image/c.png", - "rating": 4.8, - "reviewCount": 25, - "createdAt": "2024-07-07T14:25:05.886Z", - "updatedAt": "2024-07-07T14:25:05.886Z" - }, - { - "id": 1594, - "userId": 595, - "title": "한강 자전거 투어", - "description": "한강을 따라 자전거로 서울을 둘러보세요", - "category": "관광", - "price": 15000, - "address": "서울특별시 송파구 올림픽로 300", - "bannerImageUrl": "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/globalnomad/activity_registration_image/d.png", - "rating": 4.9, - "reviewCount": 30, - "createdAt": "2024-07-06T16:30:05.886Z", - "updatedAt": "2024-07-06T16:30:05.886Z" - }, - { - "id": 1595, - "userId": 596, - "title": "서울 야경 투어", - "description": "서울의 아름다운 야경을 감상해보세요", - "category": "투어", - "price": 20000, - "address": "서울특별시 중구 명동길 14", - "bannerImageUrl": "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/globalnomad/activity_registration_image/e.png", - "rating": 4.7, - "reviewCount": 20, - "createdAt": "2024-07-05T18:35:05.886Z", - "updatedAt": "2024-07-05T18:35:05.886Z" - }, - { - "id": 1596, - "userId": 597, - "title": "인사동 전통 차 체험", - "description": "인사동에서 전통 차를 즐겨보세요", - "category": "문화 예술", - "price": 12000, - "address": "서울특별시 종로구 인사동길 30", - "bannerImageUrl": "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/globalnomad/activity_registration_image/f.png", - "rating": 4.6, - "reviewCount": 18, - "createdAt": "2024-07-04T12:45:05.886Z", - "updatedAt": "2024-07-04T12:45:05.886Z" - }, - { - "id": 1597, - "userId": 598, - "title": "이태원 글로벌 음식 투어", - "description": "이태원에서 다양한 세계 음식을 맛보세요", - "category": "투어", - "price": 25000, - "address": "서울특별시 용산구 이태원로 177", - "bannerImageUrl": "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/globalnomad/activity_registration_image/g.png", - "rating": 4.8, - "reviewCount": 22, - "createdAt": "2024-07-03T17:50:05.886Z", - "updatedAt": "2024-07-03T17:50:05.886Z" - }, - { - "id": 1598, - "userId": 599, - "title": "한강 낚시 체험", - "description": "한강에서 즐기는 낚시 체험", - "category": "투어", - "price": 20000, - "address": "서울특별시 마포구 마포대로 109", - "bannerImageUrl": "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/globalnomad/activity_registration_image/h.png", - "rating": 4.5, - "reviewCount": 10, - "createdAt": "2024-07-02T08:20:05.886Z", - "updatedAt": "2024-07-02T08:20:05.886Z" - }, - { - "id": 1599, - "userId": 600, - "title": "서울 미술관 투어", - "description": "서울의 대표적인 미술관을 둘러보세요", - "category": "투어", - "price": 18000, - "address": "서울특별시 종로구 삼청로 30", - "bannerImageUrl": "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/globalnomad/activity_registration_image/i.png", - "rating": 4.7, - "reviewCount": 12, - "createdAt": "2024-07-01T11:15:05.886Z", - "updatedAt": "2024-07-01T11:15:05.886Z" - }, - { - "id": 1600, - "userId": 601, - "title": "홍대 스트릿 아트 투어", - "description": "홍대의 다양한 스트릿 아트를 감상해보세요", - "category": "투어", - "price": 15000, - "address": "서울특별시 마포구 양화로 136", - "bannerImageUrl": "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/globalnomad/activity_registration_image/j.png", - "rating": 4.9, - "reviewCount": 28, - "createdAt": "2024-06-30T14:40:05.886Z", - "updatedAt": "2024-06-30T14:40:05.886Z" - }, - { - "id": 1601, - "userId": 602, - "title": "강남 요가 클래스", - "description": "강남에서의 힐링 요가 클래스", - "category": "스포츠", - "price": 22000, - "address": "서울특별시 강남구 도산대로 54", - "bannerImageUrl": "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/globalnomad/activity_registration_image/k.png", - "rating": 4.6, - "reviewCount": 19, - "createdAt": "2024-06-29T09:55:05.886Z", - "updatedAt": "2024-06-29T09:55:05.886Z" - } - ], - "totalCount": 11, - "cursorId": null -} diff --git a/server/server.js b/server/server.js index 3b2cbc3..9497359 100644 --- a/server/server.js +++ b/server/server.js @@ -1,4 +1,5 @@ import io from 'socket.io-client'; const socket = io('https://rear-ninnetta-codeitsprinter-6a0e09e4.koyeb.app/'); +// const socket = io('http://localhost:5001'); export default socket; diff --git a/states/mainPageState.tsx b/states/mainPageState.tsx index 671bb9c..c21df97 100644 --- a/states/mainPageState.tsx +++ b/states/mainPageState.tsx @@ -20,7 +20,7 @@ export const mainPageState = atom({ itemsPerPage: 8, selectedKategorie: '', selectedSorted: '', - sortedName: '', + sortedName: '정렬', }, effects_UNSTABLE: [persistAtom], });
문의 채팅
{activityTitle}
{`@${nickname}`}
아직 문의 채팅이 없습니다.
+
{isClient && !showMenuList ? sortedName || '정렬' : sortedName}