Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
4160439
Feat: 취향 선택 페이지 라우팅
mimizae Feb 14, 2025
6520ad0
Feat: 취향 선택 UI 1차 퍼블리싱
mimizae Feb 17, 2025
94b1b2b
feat: 이미지 호버 시 확대, 축소 기능과 클릭 시 확대/축소 토글 기능 추가
mimizae Feb 20, 2025
d3cfd24
feat: 2차 UI 퍼블리싱 후 api 연동
mimizae Feb 21, 2025
ced84ab
refact: request data 타입을 문자열에서 배열로 변경
mimizae Feb 21, 2025
7709737
Fix: 매칭 탭을 채팅 UX로 변경
gustn99 Feb 21, 2025
c656100
Rename: 매칭 관련 폴더 및 컴포넌트명 수정정
gustn99 Feb 21, 2025
d312ff2
feat: matching UX 구현에 따라 채팅 메시지 관련 컴포넌트 폴더 이동
gustn99 Feb 22, 2025
3d0fa61
feat: 채팅 UX의 매칭 렌더링 구현
gustn99 Feb 22, 2025
49f3bc1
Refactor: 채팅방 리스트 관련 파일을 RecentChat 폴더 내부로 이동
gustn99 Feb 22, 2025
ce3406d
Refactor: 로그아웃 모달 변경
lalaurrel Feb 24, 2025
4074464
refact: 스타일 태그를 배열로 받기 위해 dto 수정
mimizae Feb 24, 2025
9cab98f
Merge pull request #130 from oodd-team/OD-182
gustn99 Feb 24, 2025
aa12026
Feat: svg 파일 추가
lalaurrel Feb 24, 2025
202205a
Feat: 친구에게 공유하기 기능 추가
lalaurrel Feb 24, 2025
b4df44b
Merge branch 'dev' of https://github.com/oodd-team/oodd-web-react int…
mimizae Feb 24, 2025
aa538f8
Merge pull request #131 from oodd-team/OD-194
gustn99 Feb 24, 2025
94a8da9
chore: 이용약관 동의 화면의 문구의 커서를 포인터 모양으로 변경
mimizae Feb 24, 2025
a7f0797
fix: 빌드 오류 수정
mimizae Feb 24, 2025
fa5d5ab
Merge branch 'dev' of https://github.com/oodd-team/oodd-web-react int…
mimizae Feb 24, 2025
30965eb
chore: 취향 선택 문구 변경
mimizae Feb 25, 2025
7fc829b
chore: 개발 문서에 따라 api 호출 함수명 변경
mimizae Feb 25, 2025
dfd27ea
Merge branch 'dev' of https://github.com/oodd-team/oodd-web-react int…
gustn99 Feb 25, 2025
647d3ea
fix: 서로 다른 엔드포인트에 대한 useSocket 훅 기능 구현
gustn99 Feb 25, 2025
7454240
feat: 매칭 메시지 UI 구현
gustn99 Feb 25, 2025
7729d62
Merge pull request #132 from oodd-team/feat/OD-179
gustn99 Feb 27, 2025
7efd26a
feat: 매칭 수락/거절 버튼 UI 구현
gustn99 Feb 27, 2025
6077165
feat: MatchingRoom 내부 챗박스 disabled 처리
gustn99 Feb 27, 2025
2975bf9
Refactor: px to rem
lalaurrel Feb 27, 2025
ca1b7cd
Refactor: 유저 프로필 shadow 추가
lalaurrel Feb 27, 2025
d41b30c
fix: 매칭 거절/수락 UI 및 로직 수정
gustn99 Feb 27, 2025
4acece6
fix: 새 매칭이 없을 때 렌더링 로직 수정
gustn99 Feb 27, 2025
a192cbe
feat: 매칭 수락 시 채팅방으로 이동하는 기능 추가
gustn99 Feb 27, 2025
bf1116e
refactor: 매칭 신청을 소켓 api로 변경
gustn99 Feb 27, 2025
cf25af3
Merge branch 'dev' of https://github.com/oodd-team/oodd-web-react int…
gustn99 Feb 27, 2025
03e1195
Merge pull request #133 from oodd-team/feat/OD-180
gustn99 Feb 27, 2025
1f26638
Fix: dto 관련 빌드 문제 해결
gustn99 Feb 27, 2025
a0d2295
Merge pull request #134 from oodd-team/feat/OD-180
gustn99 Feb 27, 2025
67ef14f
fix: 채팅방이 없을 때 UI 제거 & 오딩이 프로필 이미지 기본 프로필로 설정
gustn99 Feb 27, 2025
e840ad3
fix: 기존 매칭 신청 로직을 소켓으로 변경
gustn99 Feb 28, 2025
5a7b761
Refactor: 사이즈 조정 및 섀도우 추가
lalaurrel Mar 6, 2025
98b2558
Merge branch 'dev' into OD-197
lalaurrel Mar 6, 2025
4b7938d
fix: 인증이 필요한 페이지에서 사용자 인증 로직 수정
gustn99 Mar 10, 2025
3341925
fix: isAuthenticated가 업데이트되기 전에 return하는 문제 해결
gustn99 Mar 10, 2025
d0d8695
fix: 매칭룸 버그 해결
gustn99 Mar 10, 2025
75866e1
Merge pull request #135 from oodd-team/feat/OD-180
gustn99 Mar 10, 2025
4a35f20
Merge remote-tracking branch 'origin/dev' into OD-197
lalaurrel Mar 10, 2025
6cca016
Fix: 프로필 버튼 UI 수정
lalaurrel Mar 12, 2025
62bc596
Fix: 아이콘 위치 수정
lalaurrel Mar 12, 2025
295a01d
Merge pull request #136 from oodd-team/OD-197
gustn99 Mar 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/styles/casual.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/styles/classic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/styles/feminine.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/styles/formal.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/styles/hip.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/styles/luxury.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/styles/minimal.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/styles/outdoor.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/styles/street.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 23 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import { BrowserRouter, Route, Routes, Navigate } from 'react-router-dom';

import Home from '@pages/Home';
Expand All @@ -7,6 +7,7 @@ import LoginComplete from '@pages/Login/LoginComplete';

import SignUp from '@pages/SignUp';
import TermsAgreement from '@pages/SignUp/TermsAgreement';
import PickMyStyle from '@pages/SignUp/PickMyStyle';

import Profile from '@pages/Profile';
import ProfileEdit from '@pages/Profile/ProfileEdit';
Expand All @@ -24,11 +25,29 @@ import PostInstaFeedSelect from '@pages/Post/PostInstaFeedSelect';

import Chats from '@pages/Chats';
import ChatRoom from '@pages/Chats/ChatRoom';
import MatchingRoom from '@pages/Chats/MatchingRoom';

import NotFound from '@pages/NotFound';
import { getUserInfoApi } from '@apis/user';
import { getCurrentUserId } from '@utils/getCurrentUserId';
import Loading from '@components/Loading';

const ProtectedRoute = ({ children }: { children: JSX.Element }) => {
const isAuthenticated = Boolean(localStorage.getItem('new_jwt_token'));
const [isAuthenticated, setIsAuthenticated] = useState<boolean | null>(null);

useEffect(() => {
const checkAuth = async () => {
const currentUserId = getCurrentUserId();
const response = await getUserInfoApi(currentUserId);
setIsAuthenticated(response.isSuccess);
};
checkAuth();
}, []);

if (isAuthenticated === null) {
return <Loading />;
}

return isAuthenticated ? children : <Navigate to="/login" />;
};

Expand All @@ -55,6 +74,7 @@ const protectedRoutes = [
// 메시지/채팅
{ path: '/chats', element: <Chats /> },
{ path: '/chats/:chatRoomId', element: <ChatRoom /> },
{ path: '/matching', element: <MatchingRoom /> },
];

// 인증이 필요 없는 페이지 배열
Expand All @@ -64,6 +84,7 @@ const publicRoutes = [

{ path: '/signup', element: <SignUp /> },
{ path: '/signup/terms-agreement', element: <TermsAgreement /> },
{ path: '/signup/pick-my-style', element: <PickMyStyle /> },
];

const App: React.FC = () => {
Expand Down
1 change: 1 addition & 0 deletions src/apis/auth/dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export interface getUserInfoByJwtData {
profilePictureUrl: string;
bio: string;
birthDate: string;
userStyletags: string[];
}
2 changes: 1 addition & 1 deletion src/apis/chatting/dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface LatestMessageDto {
// 채팅방 전체 대화 내역 조회
// 최근 메시지 수신
// response
export interface chatRoomMessagesData {
export interface ChatRoomMessagesData {
id: number;
content: string;
fromUser: FromUserDto;
Expand Down
58 changes: 18 additions & 40 deletions src/apis/matching/dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BaseSuccessResponse } from '@apis/core/dto';
type RequestStatusEnum = 'accepted' | 'rejected' | 'pending';

// 매칭 요청
// request
Expand All @@ -8,39 +8,34 @@ export interface CreateMatchingRequest {
message: string;
}

// response
export type CreateMatchingResponse = BaseSuccessResponse<CreateMatchingData>;
// 최근 매칭 조회 (채팅방 리스트에서)
export interface LatestMatchingData {
id?: number;
requesterId?: number;
targetId?: number;
requestStatus?: RequestStatusEnum;
createdAt: Date;
}

export interface CreateMatchingData {
id: number; // matchingId
// 전체 매칭 리스트 조회
export interface MatchingData {
id: number;
message: string;
createdAt: string;
chatRoomId: number;
requesterId: number;
targetId: number;
}

// 매칭 리스트 조회
// response
export type GetMatchingListResponse = BaseSuccessResponse<GetMatchingListData>;

export interface GetMatchingListData {
hasMatching: boolean;
matchingsCount: number;
matching: MatchingDto[];
}

export interface MatchingDto {
id: number; // matchingId
requester: RequesterDto;
requestStatus: RequestStatusEnum;
}

export interface RequesterDto {
id: number; // requesterId
id: number;
nickname: string;
profilePictureUrl: string;
representativePost: RepresentativePost;
representativePost: RepresentativePostDto;
}

export interface RepresentativePost {
export interface RepresentativePostDto {
postImages: PostImageDto[];
styleTags: string[];
}
Expand All @@ -49,20 +44,3 @@ export interface PostImageDto {
url: string;
orderNum: number;
}

// 매칭 요청 수락 및 거절
// request
export interface ModifyMatchingStatusRequest {
requestStatus: 'accept' | 'reject';
}

// response
export type ModifyMatchingStatusResponse = BaseSuccessResponse<ModifyMatchingStatusData>;

export interface ModifyMatchingStatusData {
id: number; // matchingId
requesterId: number;
targetId: number;
requestStatus: string;
chatRoomId: number;
}
20 changes: 0 additions & 20 deletions src/apis/matching/index.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/apis/user/dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface UserInfoData {
bio: string;
birthDate: string;
isFriend: boolean;
userStyletags: string[];
}

// 사용자 정보 조회 응답
Expand All @@ -28,6 +29,7 @@ export interface PatchUserInfoRequest {
nickname: string;
profilePictureUrl: string;
bio: string;
userStyletags: string[];
}

// 회원 탈퇴 응답
Expand Down
20 changes: 20 additions & 0 deletions src/assets/default/share.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 34 additions & 26 deletions src/context/SocketProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,55 @@ import { createContext, useContext, useEffect, useState } from 'react';

import { io, Socket } from 'socket.io-client';

const SocketContext = createContext<Socket | null>(null);
type SocketMap = { [endpoint: string]: Socket };

const SocketContext = createContext<SocketMap | null>(null);

export const SocketProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const [socket, setSocket] = useState<Socket | null>(null);
const [socketMap, setSocketMap] = useState<SocketMap>({});

useEffect(() => {
const newSocket = io(`${import.meta.env.VITE_NEW_API_URL}/socket/chatting`, {
transports: ['websocket'],
});
setSocket(newSocket);

newSocket.on('connect', () => {
console.log('connection is open');
const endpoints = ['chatting', 'matching']; // 필요한 엔드포인트 추가
const newSockets: SocketMap = {};

endpoints.forEach((endpoint) => {
const socket = io(`${import.meta.env.VITE_NEW_API_URL}/socket/${endpoint}`, {
transports: ['websocket'],
});
newSockets[endpoint] = socket;

socket.on('connect', () => {
console.log(`${endpoint} connection is open`);
});

socket.on('disconnect', (reason) => {
console.log(`${endpoint} Disconnected from server:`, reason);
});

socket.on('connect_error', (err) => {
console.log(`${endpoint} connect error:`, err.message);
});
});

newSocket.on('disconnect', (reason) => {
console.log('Disconnected from server:', reason);
});

newSocket.on('connect_error', (err) => {
console.log(err.message);
});
setSocketMap(newSockets);

return () => {
newSocket.disconnect();
Object.values(newSockets).forEach((socket) => socket.disconnect());
};
}, []);

// 소켓 설정이 완료되지 않은 경우 렌더링 방지
// 채팅방에서 새로고침했을 때 오류 방지
if (!socket) {
if (!Object.keys(socketMap).length) {
return null;
}

return <SocketContext.Provider value={socket}>{children}</SocketContext.Provider>;
return <SocketContext.Provider value={socketMap}>{children}</SocketContext.Provider>;
};

export const useSocket = () => {
const context = useContext(SocketContext);
if (context === null) {
throw new Error('useSocket must be used within a SocketProvider');
// 엔드포인트를 인자로 받아 해당 소켓을 반환하는 훅
export const useSocket = (endpoint = 'chatting') => {
const socketMap = useContext(SocketContext);
if (!socketMap || !socketMap[endpoint]) {
throw new Error(`useSocket must be used within a SocketProvider with a valid endpoint (${endpoint})`);
}
return context;
return socketMap[endpoint];
};
18 changes: 9 additions & 9 deletions src/pages/Account/AccountCancel/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ export const SubTitle = styled.h3`
margin-bottom: 0.625rem;
text-align: center;
text-align: left;
margin-top: 10px;
margin-top: 0.625rem;
padding: 1.25rem;
`;

export const Text = styled.p`
font-size: 0.875rem;
margin-bottom: 5px;
margin-bottom: 0.3125rem;
text-align: left;
margin-top: 10px;
margin-top: 0.625rem;
padding: 0rem 1.25rem;
`;

export const InfoBox = styled.div`
background: ${({ theme }) => theme.colors.background.secondary};
padding: 70px;
margin-top: 10px;
border-radius: 10px;
margin: 10px 20px 1.25rem 20px;
padding: 4.375rem;
margin-top: 0.625rem;
border-radius: 0.625rem;
margin: 0.625rem 1.25rem 1.25rem 1.25rem;
`;

export const InfoItem = styled.p`
font-size: 0.875rem;
margin-bottom: 0.625rem;
padding: 2px 10px;
padding: 0.125rem 0.625rem;
display: flex;
justify-content: center;
align-items: center;
Expand All @@ -51,7 +51,7 @@ export const CheckboxWrapper = styled.div`
display: flex;
align-items: center;
margin-bottom: 1.25rem;
padding: 0rem 15px;
padding: 0rem 0.9375rem;

input[type='checkbox'] {
margin-right: 0.625rem;
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Account/AccountEdit/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { styled } from 'styled-components';

export const ProfileEditContainer = styled.div`
max-width: 512px;
max-width: 32rem;
display: flex;
flex-direction: column;
position: relative;
Expand All @@ -11,7 +11,7 @@ export const Section = styled.div`
margin-top: 1.875rem;
margin-bottom: 1.875rem;
width: 100%;
padding: 0px 30px;
padding: 0rem 1.875rem;
`;

export const SectionTitle = styled.div`
Expand Down Expand Up @@ -62,7 +62,7 @@ export const SnsConnection = styled.div`
export const MemberInfo = styled.div`
display: flex;
flex-direction: column;
margin-top: 35px;
margin-top: 2.1875rem;
width: 100%;
`;

Expand All @@ -71,7 +71,7 @@ export const MemberInfoRow = styled.div`
align-items: center;
justify-content: flex-start;
margin-bottom: 0.625rem;
margin-top: 10px;
margin-top: 0.625rem;
`;

export const Label = styled.div`
Expand Down
Loading