Skip to content

Commit

Permalink
Merge pull request #99 from modern-agile-team/feature/chatRenewal/#96
Browse files Browse the repository at this point in the history
Fix(DongGun/View) : View 삭제
  • Loading branch information
CBWDG authored Nov 22, 2023
2 parents d4c466a + 956120d commit 701b01d
Show file tree
Hide file tree
Showing 32 changed files with 112 additions and 226 deletions.
44 changes: 0 additions & 44 deletions src/apis/chat-dummy/ChatFriendsDummy.ts

This file was deleted.

15 changes: 15 additions & 0 deletions src/apis/chat-dummy/ChattingDummy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
interface ChatMessage {
chatId: string;
textMessage: string;
createdAt: string;
sender: {
id: string;
name: string;
profileImage: string;
};
}
interface ChatMessageList {
roomId: string;
contents: ChatMessage[];
hasNext: boolean;
}
42 changes: 0 additions & 42 deletions src/apis/chat-dummy/friendsDummy.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/apis/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const USERS = {
path: '/user',

//유저정보조회api
async getUserProfile(): Promise<UserInfo> {
async getMyProfile(): Promise<UserInfo> {
try {
const result: AxiosResponse = await instance.get(`${USERS.path}/my-info`);
return result.data;
Expand Down
4 changes: 2 additions & 2 deletions src/components/molecules/add-friend/AddFriend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const AddFriend = (props: User) => {
const router = useRouter();
const handleMypage = async () => {
try {
const userInfo = await USERS.getUserProfile();
const userInfo = await USERS.getMyProfile();
const id = userInfo.userId;
router.push(`/mypage/${id}`);
} catch (error) {
Expand All @@ -24,7 +24,7 @@ const AddFriend = (props: User) => {
};
const handleAddFriend = async () => {
try {
const userInfo = await USERS.getUserProfile();
const userInfo = await USERS.getMyProfile();
const currentUserId = userInfo.userId;
const friendId = props.id;
if (currentUserId === friendId) {
Expand Down
24 changes: 24 additions & 0 deletions src/components/molecules/chat-icon/ChatIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, { useEffect, useState } from 'react';
import { useRouter } from 'next/router';
import { useRecoilState, useRecoilValue } from 'recoil';
import USERS, { UserInfo } from '@/apis/user';
import { MyProfileAtom } from '@/recoil/atoms/MyProfile';

export const ChatIcon = () => {
const [myProfile, setMyprofile] = useRecoilState(MyProfileAtom);
const getMyProfile = async () => {
const myInfo = await USERS.getMyProfile();
setMyprofile(myInfo);
};
useEffect(() => {
getMyProfile();
});

const handleChatPage = () => {
const myId = useRecoilValue(MyProfileAtom);
};

return <></>;
};

export default ChatIcon;
2 changes: 1 addition & 1 deletion src/components/molecules/chat-list/ChatDMFriendList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { friendInfoState } from '@/recoil/atoms/FriendsAtom';
interface DMFriendListProps {}

const DMFriendList = ({}: DMFriendListProps) => {
const [friendListCollapse, setFriendListCollapse] = useState(false);
const [friendListCollapse, setFriendListCollapse] = useState<boolean>(false);
const friendsData = useRecoilValue(friendInfoState);
const router = useRouter();
const collapsibleRef = useRef<HTMLDivElement>(null);
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/chat-list/styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from 'styled-components';

interface ButtonContainerProps {
collapse: boolean;
collapse: Boolean;
onClick: () => void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const PostCreateReComment = ({ commentId }: PostCreateRCommentProps) => {

//본인 정보 받아오는 api 호출
const getUserInfo = async () => {
const response = await USERS.getUserProfile();
const response = await USERS.getMyProfile();
setUserInfo((prev) => {
return {
...prev,
Expand Down
4 changes: 1 addition & 3 deletions src/components/organisms/chats/chat-space/ChatSpace.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React, { useEffect } from 'react';
import React from 'react';
import * as S from './styled';
import DMFriendList from '../../../molecules/chat-list/ChatDMFriendList';
import DMList from '../../../molecules/chat-list/ChatDMList';
import Chatting from '../chatting/Chatting';
// import ChattingRoom from '../chat-room/ChatRoom';
// import DMList from '../chat-dm/ChatDMList';

const ChatSpace = (): JSX.Element => {
return (
Expand Down
7 changes: 1 addition & 6 deletions src/components/organisms/common/floatingbar/FloatingBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const FloatingBar = () => {

const handleGetMyId = async () => {
try {
const response = await USERS.getUserProfile();
const response = await USERS.getMyProfile();
console.log(response);
setMyInfo(response.userId);
} catch (error: any) {
Expand Down Expand Up @@ -87,18 +87,13 @@ const FloatingBar = () => {
<MdOutlineSearch />
</S.FriendSearchIcon>
</div>
{/* <div onClick={friendOnClink}>
<UserIcon />
</div> */}
<div onClick={handleMypage}>
<UserIcon />
</div>

<S.ChatIcon onClick={handleModal}>
<IoMdChatbubbles />
</S.ChatIcon>
{isOpenModal && <ChatModal show={isOpenModal} hide={handleModal} />}

<S.ScrollButotn>
<MdKeyboardArrowDown onClick={scrollToBottom} />
</S.ScrollButotn>
Expand Down
15 changes: 8 additions & 7 deletions src/components/organisms/friend-list/ListFriend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,19 @@ const ListFriend = () => {

if (loginUserId === item.requesterId) {
friendInfo = {
requesterId: item[`${requester}Id`],
requesterName: item[requester]?.name || '',
requesterImage: item[requester]?.userImage?.imageUrl || '',
requesterId: item[`${respondent}Id`],
requesterName: item[respondent]?.name || '',
requesterImage: item[respondent]?.userImage?.imageUrl || '',
};
} else {
friendInfo = {
respondentId: item[`${respondent}Id`],
respondentName: item[respondent]?.name || '',
respondentImage: item[respondent]?.userImage?.imageUrl || '',
respondentId: item[`${requester}Id`],
respondentName: item[requester]?.name || '',
respondentImage: item[requester]?.userImage?.imageUrl || '',
};
}

console.log(friendInfo);
return friendInfo;
});

Expand All @@ -78,7 +79,7 @@ const ListFriend = () => {

const isConfirmed = window.confirm(
`${
friendToDelete?.respondentId === deletedId
friendToDelete?.requesterId === deletedId
? friendToDelete?.respondentName
: friendToDelete?.requesterName
}님을 친구에서 삭제하시겠습니까?`,
Expand Down
2 changes: 1 addition & 1 deletion src/components/organisms/post-board/PostBoards.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEffect, useState, useRef, useCallback } from 'react';
import UnitBox from '@/components/molecules/post-board/UnitBox';
import BOARDS from '@/apis/boards';
import { Board } from '@/components/veiws/AllPost';
import * as S from './styled';
import { Board } from '@/components/templates/post-temp/PostTemplates';

const PostBoards = (props: Board): JSX.Element => {
const [getList, setGetList] = useState<any>([]);
Expand Down
2 changes: 1 addition & 1 deletion src/components/organisms/post-unit/PostCreateComments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const PostCreateComment = (props: BoardId) => {

//본인 정보 받아오는 api 호출
const getUserInfo = async () => {
const response = await USERS.getUserProfile();
const response = await USERS.getMyProfile();
setUserInfo((prev) => {
return {
...prev,
Expand Down
11 changes: 11 additions & 0 deletions src/components/templates/chat-temp/ChatPageTemplate.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

export interface Me {
id: number;
}

const ChatPageTemplate = () => {
return <></>;
};

export default ChatPageTemplate;
6 changes: 5 additions & 1 deletion src/components/templates/post-temp/PostTemplates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ import PostBoardHeader from '../../organisms/post-board/PostBoardHearder';
import * as S from './styled';
import PostBoards from '@/components/organisms/post-board/PostBoards';
import { ContextType, Suspense, useEffect, useState } from 'react';
import { Board } from '@/components/veiws/AllPost';
import { useRouter } from 'next/router';
import PostSearchBoard from '@/components/organisms/post-board/PostSearchBoard';
import { ParsedUrlQuery } from 'querystring';
import { IncomingMessage, ServerResponse } from 'http';
import SEARCH from '@/apis/search';
import { GetServerSideProps, NextPage } from 'next';

export interface Board {
main?: string;
totalPage?: number;
}

const PostBoardTemplates = (props: Board): JSX.Element => {
const router = useRouter();
const [queryValue, setQueryValue] = useState('');
Expand Down
17 changes: 0 additions & 17 deletions src/components/veiws/AllPost.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions src/components/veiws/FreePost.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions src/components/veiws/IndividualPage.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions src/components/veiws/MarketPost.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions src/components/veiws/MeetingPost.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions src/components/veiws/MenmenPost.tsx

This file was deleted.

Loading

0 comments on commit 701b01d

Please sign in to comment.