From 8106a5b54c41ef1ab64323f40860c1453df28e22 Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 17:11:38 +0900 Subject: [PATCH 01/14] =?UTF-8?q?Fix:=20apis=20=EB=A6=B0=ED=8A=B8=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/chatting/dto.ts | 2 +- src/apis/post-comment/dto.ts | 2 +- src/apis/post-comment/index.ts | 6 +++--- src/apis/post-like/dto.ts | 4 ++-- src/apis/post-like/index.ts | 4 ++-- src/apis/post-report/dto.ts | 2 +- src/apis/post-report/index.ts | 4 ++-- src/apis/post/dto.ts | 6 +++--- src/apis/post/index.ts | 8 ++++---- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/apis/chatting/dto.ts b/src/apis/chatting/dto.ts index ee2dc1e8..2d317a07 100644 --- a/src/apis/chatting/dto.ts +++ b/src/apis/chatting/dto.ts @@ -27,7 +27,7 @@ export interface chatRoomMessagesData { fromUser: FromUserDto; toUser: ToUserDto; createdAt: string; - toUserReadAt: any; + toUserReadAt: Date; } export interface FromUserDto { diff --git a/src/apis/post-comment/dto.ts b/src/apis/post-comment/dto.ts index ce25c48d..d0a9fe02 100644 --- a/src/apis/post-comment/dto.ts +++ b/src/apis/post-comment/dto.ts @@ -17,7 +17,7 @@ interface Content { content: string; } -interface CreateCommentData extends Content {} +type CreateCommentData = Content; export interface Comment { id: number; diff --git a/src/apis/post-comment/index.ts b/src/apis/post-comment/index.ts index 43031182..b6471270 100644 --- a/src/apis/post-comment/index.ts +++ b/src/apis/post-comment/index.ts @@ -1,8 +1,8 @@ -import { EmptySuccessResponse } from '../core/dto'; +import { newRequest } from '@apis/core'; -import { CreateCommentRequest, CreateCommentResponse, GetCommentListResponse } from './dto'; +import type { EmptySuccessResponse } from '@apis/core/dto'; -import { newRequest } from '../core'; +import type { CreateCommentRequest, CreateCommentResponse, GetCommentListResponse } from './dto'; // 게시글 댓글 생성 API export const createCommentApi = (postId: number, data: CreateCommentRequest) => diff --git a/src/apis/post-like/dto.ts b/src/apis/post-like/dto.ts index 299bf209..c1f8f05e 100644 --- a/src/apis/post-like/dto.ts +++ b/src/apis/post-like/dto.ts @@ -1,5 +1,5 @@ -import { BaseSuccessResponse } from '../core/dto'; -import { PaginationMeta } from '../util/dto'; +import type { BaseSuccessResponse } from '@apis/core/dto'; +import type { PaginationMeta } from '@apis/util/dto'; // 좋아요 누르기/취소 export type TogglePostLikeStatusResponse = BaseSuccessResponse; diff --git a/src/apis/post-like/index.ts b/src/apis/post-like/index.ts index a5f3c4cd..aab0eec2 100644 --- a/src/apis/post-like/index.ts +++ b/src/apis/post-like/index.ts @@ -1,6 +1,6 @@ -import { TogglePostLikeStatusResponse, GetPostLikeListResponse } from './dto'; +import { newRequest } from '@apis/core'; -import { newRequest } from '../core'; +import type { TogglePostLikeStatusResponse, GetPostLikeListResponse } from './dto'; // 게시글 좋아요 누르기/취소 export const togglePostLikeStatusApi = (postId: number) => diff --git a/src/apis/post-report/dto.ts b/src/apis/post-report/dto.ts index fc7c9ddf..0d5491cc 100644 --- a/src/apis/post-report/dto.ts +++ b/src/apis/post-report/dto.ts @@ -1,4 +1,4 @@ -import { BaseSuccessResponse } from '../core/dto'; +import type { BaseSuccessResponse } from '@apis/core/dto'; interface BaseReport { id: number; // 신고 ID diff --git a/src/apis/post-report/index.ts b/src/apis/post-report/index.ts index 83c361c9..27bb70a1 100644 --- a/src/apis/post-report/index.ts +++ b/src/apis/post-report/index.ts @@ -1,6 +1,6 @@ -import { SendPostReportRequest, SendPostReportResponse } from './dto'; +import { newRequest } from '@apis/core'; -import { newRequest } from '../core'; +import type { SendPostReportRequest, SendPostReportResponse } from './dto'; // 게시글 신고 API export const sendPostReportApi = (data: SendPostReportRequest) => diff --git a/src/apis/post/dto.ts b/src/apis/post/dto.ts index d3d86a9f..f1b98627 100644 --- a/src/apis/post/dto.ts +++ b/src/apis/post/dto.ts @@ -1,5 +1,5 @@ -import { BaseSuccessResponse } from '../core/dto'; -import { PaginationMeta } from '../util/dto'; +import type { BaseSuccessResponse } from '@apis/core/dto'; +import type { PaginationMeta } from '@apis/util/dto'; // 게시글 생성 //request @@ -28,7 +28,7 @@ export interface PostBase { postClothings?: PostClothing[] | null; isRepresentative: boolean; } -export interface CreatePostData extends PostBase {} +export type CreatePostData = PostBase; export interface PostSummary { id: number; content: string; diff --git a/src/apis/post/index.ts b/src/apis/post/index.ts index a6a6b0d9..18614464 100644 --- a/src/apis/post/index.ts +++ b/src/apis/post/index.ts @@ -1,6 +1,8 @@ -import { EmptySuccessResponse } from '../core/dto'; +import { newRequest } from '@apis/core'; -import { +import type { EmptySuccessResponse } from '@apis/core/dto'; + +import type { CreatePostRequest, CreatePostResponse, GetPostListResponse, @@ -10,8 +12,6 @@ import { ModifyPostResponse, } from './dto'; -import { newRequest } from '../core'; - // 게시글 생성 export const createPostApi = (data: CreatePostRequest) => newRequest.post('/post', data); From da6141ff466c00c1ce603b99ffec38e319fe2c78 Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 17:15:30 +0900 Subject: [PATCH 02/14] =?UTF-8?q?Fix:=20TopBarLayout=EC=9D=98=20props?= =?UTF-8?q?=EB=A5=BC=20=EC=A0=84=EC=B2=B4=20TopBarProps=EA=B0=80=20?= =?UTF-8?q?=EC=95=84=EB=8B=8C=20$withBorder=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TopBar/styles.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/TopBar/styles.tsx b/src/components/TopBar/styles.tsx index 2ab92929..0c2aefb7 100644 --- a/src/components/TopBar/styles.tsx +++ b/src/components/TopBar/styles.tsx @@ -4,8 +4,7 @@ import theme from '@styles/theme'; import { StyledText } from '@components/Text/StyledText'; -import type { TopBarLayoutProps } from './dto'; -export const TopBarLayout = styled.header` +export const TopBarLayout = styled.header<{ $withBorder: boolean }>` display: flex; position: sticky; top: 0; /* 부모 요소의 상단에 붙도록 설정 */ From 6be0f0c00b17b458ff07599724157c8b6073af7e Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 17:37:18 +0900 Subject: [PATCH 03/14] =?UTF-8?q?Fix:=20pages=20=EB=A6=B0=ED=8A=B8=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Account/AccountCancel/index.tsx | 226 +++++----- src/pages/Account/AccountSetting/index.tsx | 213 +++++----- src/pages/Chats/ChatRoomItem/index.tsx | 4 +- .../LikeCommentBottomSheetContent/index.tsx | 5 +- src/pages/Post/PostBase/index.tsx | 3 +- src/pages/Post/PostImageSelect/index.tsx | 2 + .../Post/PostUpload/ImageSwiper/index.tsx | 4 +- src/pages/Profile/ProfileEdit/index.tsx | 398 +++++++++--------- src/pages/Profile/index.tsx | 308 +++++++------- 9 files changed, 583 insertions(+), 580 deletions(-) diff --git a/src/pages/Account/AccountCancel/index.tsx b/src/pages/Account/AccountCancel/index.tsx index 9f9c7456..86070a97 100644 --- a/src/pages/Account/AccountCancel/index.tsx +++ b/src/pages/Account/AccountCancel/index.tsx @@ -2,10 +2,12 @@ import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import theme from '@styles/theme'; -import { getCurrentUserId } from '@utils/getCurrentUserId'; + import { patchUserWithdrawApi } from '@apis/user'; +import { getCurrentUserId } from '@utils/getCurrentUserId'; import back from '@assets/arrow/left.svg'; + import BottomButton from '@components/BottomButton/index'; import { OODDFrame } from '@components/Frame/Frame'; import Modal from '@components/Modal/index'; @@ -13,119 +15,119 @@ import { StyledText } from '@components/Text/StyledText'; import TopBar from '@components/TopBar/index'; import { - CancelContainer, - SubTitle, - Text, - InfoBox, - InfoItem, - CheckboxWrapper, - CheckboxInput, - Label, - StyledCheckboxText, - StyledDiv, + CancelContainer, + SubTitle, + Text, + InfoBox, + InfoItem, + CheckboxWrapper, + CheckboxInput, + Label, + StyledCheckboxText, + StyledDiv, } from './styles'; const AccountCancel: React.FC = () => { - const [isChecked, setIsChecked] = useState(false); - const [modalContent, setModalContent] = useState(null); - const [isModalVisible, setIsModalVisible] = useState(false); - const navigate = useNavigate(); - - const handleCheckboxChange = () => { - setIsChecked(!isChecked); - }; - - const handleModalClose = () => { - setIsModalVisible(false); - setModalContent(null); - }; - - const handleDeleteAccount = async () => { - try { - if (!isChecked) { - setModalContent('탈퇴 안내사항에 동의해야 합니다.'); - setIsModalVisible(true); - return; - } - - const currentUserId = getCurrentUserId(); - const token = localStorage.getItem('new_jwt_token'); - - if (!currentUserId || !token) { - setModalContent('사용자 정보를 찾을 수 없습니다.'); - setIsModalVisible(true); - return; - } - - const response = await patchUserWithdrawApi(currentUserId); - - if (response.isSuccess) { - setModalContent('계정이 성공적으로 삭제되었습니다.'); - setIsModalVisible(true); - localStorage.clear(); - - setTimeout(() => { - navigate('/login'); - }, 2000); - } else { - setModalContent(response.code || '알 수 없는 오류가 발생했습니다.'); - setIsModalVisible(true); - } - } catch (error) { - console.error('계정 삭제하는데 오류남:', error); - setModalContent('계정을 삭제하는 동안 오류가 발생했습니다. 다시 시도해 주세요.'); - setIsModalVisible(true); - } - }; - - return ( - - - navigate(-1)} /> - - - OOTD 탈퇴 전 확인하세요! - - - - - {`탈퇴하시면 이용 중인 서비스가 폐쇄되며,\n모든 데이터는 복구할 수 없습니다.`} - - - - - - 지금까지 OODD를 이용해주셔서 감사합니다! - - - - - - - - - - - {isModalVisible && ( - - )} - - ); + const [isChecked, setIsChecked] = useState(false); + const [modalContent, setModalContent] = useState(null); + const [isModalVisible, setIsModalVisible] = useState(false); + const navigate = useNavigate(); + + const handleCheckboxChange = () => { + setIsChecked(!isChecked); + }; + + const handleModalClose = () => { + setIsModalVisible(false); + setModalContent(null); + }; + + const handleDeleteAccount = async () => { + try { + if (!isChecked) { + setModalContent('탈퇴 안내사항에 동의해야 합니다.'); + setIsModalVisible(true); + return; + } + + const currentUserId = getCurrentUserId(); + const token = localStorage.getItem('new_jwt_token'); + + if (!currentUserId || !token) { + setModalContent('사용자 정보를 찾을 수 없습니다.'); + setIsModalVisible(true); + return; + } + + const response = await patchUserWithdrawApi(currentUserId); + + if (response.isSuccess) { + setModalContent('계정이 성공적으로 삭제되었습니다.'); + setIsModalVisible(true); + localStorage.clear(); + + setTimeout(() => { + navigate('/login'); + }, 2000); + } else { + setModalContent(response.code || '알 수 없는 오류가 발생했습니다.'); + setIsModalVisible(true); + } + } catch (error) { + console.error('계정 삭제하는데 오류남:', error); + setModalContent('계정을 삭제하는 동안 오류가 발생했습니다. 다시 시도해 주세요.'); + setIsModalVisible(true); + } + }; + + return ( + + + navigate(-1)} /> + + + OOTD 탈퇴 전 확인하세요! + + + + + {`탈퇴하시면 이용 중인 서비스가 폐쇄되며,\n모든 데이터는 복구할 수 없습니다.`} + + + + + + 지금까지 OODD를 이용해주셔서 감사합니다! + + + + + + + + + + + {isModalVisible && ( + + )} + + ); }; -export default AccountCancel; \ No newline at end of file +export default AccountCancel; diff --git a/src/pages/Account/AccountSetting/index.tsx b/src/pages/Account/AccountSetting/index.tsx index c1bfd315..99adb521 100644 --- a/src/pages/Account/AccountSetting/index.tsx +++ b/src/pages/Account/AccountSetting/index.tsx @@ -2,8 +2,9 @@ import { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import theme from '@styles/theme'; -import { getCurrentUserId } from '@utils/getCurrentUserId'; + import { getUserInfoApi } from '@apis/user'; +import { getCurrentUserId } from '@utils/getCurrentUserId'; import back from '@assets/arrow/left.svg'; import imageBasic from '@assets/default/defaultProfile.svg'; @@ -18,116 +19,108 @@ import TopBar from '@components/TopBar/index'; import type { UserInfoData } from '@apis/user/dto'; -import { - ProfileEditContainer, - ProfilePic, - ProfilePicWrapper, - Label, - Row, - List, - ListItem -} from './styles'; +import { ProfileEditContainer, ProfilePic, ProfilePicWrapper, Label, Row, List, ListItem } from './styles'; const AccountSetting: React.FC = () => { - const navigate = useNavigate(); - const [isLogoutModalOpen, setIsLogoutModalOpen] = useState(false); - const [userProfile, setUserProfile] = useState(null); - const [isLoading, setIsLoading] = useState(true); - - useEffect(() => { - const getUserInfo = async () => { - try { - const currentUserId = getCurrentUserId(); - if (!currentUserId) { - console.error('User is not logged in'); - return; - } - - const response = await getUserInfoApi(currentUserId); - setUserProfile(response.data); - } catch (error) { - console.error('Error fetching user info:', error); - } finally { - setIsLoading(false); - } - }; - - getUserInfo(); - }, []); - - const handleConfirmLogout = () => { - localStorage.clear(); - console.log('Logout confirmed'); - setIsLogoutModalOpen(false); - navigate('/login'); - }; - - const handleLogoutClick = () => { - setIsLogoutModalOpen(true); - }; - - const handleCloseModal = () => { - setIsLogoutModalOpen(false); - }; - - const handleDeleteAccountClick = () => { - navigate('/account/cancel'); - }; - - if (isLoading) { - return ; - } - - return ( - - - navigate(-1)} /> - - - 프로필 사진 - - - - - - - - - - - - 로그아웃 아이콘 - - Logout - - - - 회원 탈퇴 아이콘 - - 회원탈퇴 - - - - - {isLogoutModalOpen && ( - - )} - - - ); + const navigate = useNavigate(); + const [isLogoutModalOpen, setIsLogoutModalOpen] = useState(false); + const [userProfile, setUserProfile] = useState(null); + const [isLoading, setIsLoading] = useState(true); + + useEffect(() => { + const getUserInfo = async () => { + try { + const currentUserId = getCurrentUserId(); + if (!currentUserId) { + console.error('User is not logged in'); + return; + } + + const response = await getUserInfoApi(currentUserId); + setUserProfile(response.data); + } catch (error) { + console.error('Error fetching user info:', error); + } finally { + setIsLoading(false); + } + }; + + getUserInfo(); + }, []); + + const handleConfirmLogout = () => { + localStorage.clear(); + console.log('Logout confirmed'); + setIsLogoutModalOpen(false); + navigate('/login'); + }; + + const handleLogoutClick = () => { + setIsLogoutModalOpen(true); + }; + + const handleCloseModal = () => { + setIsLogoutModalOpen(false); + }; + + const handleDeleteAccountClick = () => { + navigate('/account/cancel'); + }; + + if (isLoading) { + return ; + } + + return ( + + + navigate(-1)} /> + + + 프로필 사진 + + + + + + + + + + + + 로그아웃 아이콘 + + Logout + + + + 회원 탈퇴 아이콘 + + 회원탈퇴 + + + + + {isLogoutModalOpen && ( + + )} + + + ); }; -export default AccountSetting; \ No newline at end of file +export default AccountSetting; diff --git a/src/pages/Chats/ChatRoomItem/index.tsx b/src/pages/Chats/ChatRoomItem/index.tsx index 75cc6afd..0798cfa7 100644 --- a/src/pages/Chats/ChatRoomItem/index.tsx +++ b/src/pages/Chats/ChatRoomItem/index.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import dayjs from 'dayjs'; +import dayjs, { extend } from 'dayjs'; import relativeTime from 'dayjs/plugin/relativeTime'; import { useRecoilState } from 'recoil'; @@ -18,12 +18,12 @@ import type { ChatRoomData } from '@apis/chatting/dto'; import { UserImage, ChatRoomItemLayout, LeftBox, RightBox, LatestMessage } from './styles'; import 'dayjs/locale/ko'; -dayjs.extend(relativeTime); const ChatRoomItem: React.FC = ({ id, otherUser, latestMessage }) => { const [timeAgo, setTimeAgo] = useState(null); const [, setOtherUser] = useRecoilState(OtherUserAtom); const nav = useNavigate(); + extend(relativeTime); const handleChatRoomClick = () => { setOtherUser(otherUser); diff --git a/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx b/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx index 300a1e60..ee0ada50 100644 --- a/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx +++ b/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx @@ -25,8 +25,6 @@ import X from '@assets/default/x.svg'; import Loading from '@components/Loading'; import Modal from '@components/Modal'; import { StyledText } from '@components/Text/StyledText'; -import CommentItem from './CommentItem/index'; -import MenuButtonList from './MenuButtonList/index'; import type { Comment, GetCommentListResponse } from '@apis/post-comment/dto'; import type { GetPostLikeListResponse } from '@apis/post-like/dto'; @@ -34,6 +32,9 @@ import type { ModalProps } from '@components/Modal/dto'; import type { LikeCommentBottomSheetProps } from '../dto'; +import CommentItem from './CommentItem/index'; +import MenuButtonList from './MenuButtonList/index'; + import { TabContainer, Tab, ContentContainer, Content, BigUserProfile, LikeItem, InputLayout } from './styles'; const LikeCommentBottomSheetContent: React.FC = ({ tab, likeCount, commentCount }) => { diff --git a/src/pages/Post/PostBase/index.tsx b/src/pages/Post/PostBase/index.tsx index b0c904bc..6c38df20 100644 --- a/src/pages/Post/PostBase/index.tsx +++ b/src/pages/Post/PostBase/index.tsx @@ -13,10 +13,11 @@ import { postIdAtom, userAtom, isPostRepresentativeAtom } from '@recoil/Post/Pos import { getCurrentUserId } from '@utils/getCurrentUserId'; import Left from '@assets/arrow/left.svg'; -import Like from '@components/Icons/Like'; import Message from '@assets/default/message.svg'; import More from '@assets/default/more.svg'; +import Like from '@components/Icons/Like'; + import BottomSheet from '@components/BottomSheet'; import ClothingInfoItem from '@components/ClothingInfoItem'; import { OODDFrame } from '@components/Frame/Frame'; diff --git a/src/pages/Post/PostImageSelect/index.tsx b/src/pages/Post/PostImageSelect/index.tsx index 25d54552..7ca8729e 100644 --- a/src/pages/Post/PostImageSelect/index.tsx +++ b/src/pages/Post/PostImageSelect/index.tsx @@ -15,6 +15,7 @@ import { getCurrentUserId } from '@utils/getCurrentUserId'; import Left from '@assets/arrow/left.svg'; import X from '@assets/default/x.svg'; + import Photo from '@components/Icons/Photo'; import BottomButton from '@components/BottomButton'; @@ -23,6 +24,7 @@ import { StyledText } from '@components/Text/StyledText'; import TopBar from '@components/TopBar'; import ImageSwiper from './ImageSwiper/index'; + import { UploadContainer, ImageDragDropContainer, Content } from './styles'; const PostImageSelect: React.FC = () => { diff --git a/src/pages/Post/PostUpload/ImageSwiper/index.tsx b/src/pages/Post/PostUpload/ImageSwiper/index.tsx index a643f0c2..7d95520f 100644 --- a/src/pages/Post/PostUpload/ImageSwiper/index.tsx +++ b/src/pages/Post/PostUpload/ImageSwiper/index.tsx @@ -1,6 +1,6 @@ import { useRef } from 'react'; -import ReactDOMServer from 'react-dom/server'; +import { renderToString } from 'react-dom/server'; import { Navigation, Pagination } from 'swiper/modules'; import { Swiper, SwiperRef, SwiperSlide } from 'swiper/react'; import 'swiper/css'; @@ -32,7 +32,7 @@ const ImageSwiper: React.FC = ({ images }) => { el: '.swiper-pagination', type: 'custom', renderCustom: (_, current, total) => { - const photoIcon = ReactDOMServer.renderToString(); + const photoIcon = renderToString(); return `
${photoIcon} diff --git a/src/pages/Profile/ProfileEdit/index.tsx b/src/pages/Profile/ProfileEdit/index.tsx index 420a59eb..cb38acfa 100644 --- a/src/pages/Profile/ProfileEdit/index.tsx +++ b/src/pages/Profile/ProfileEdit/index.tsx @@ -1,11 +1,13 @@ import { useRef, useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; + import { ref, uploadBytes, getDownloadURL } from 'firebase/storage'; import theme from '@styles/theme'; -import { getCurrentUserId } from '@utils/getCurrentUserId'; + import { getUserInfoApi, patchUserInfoApi } from '@apis/user'; import { storage } from '@config/firebaseConfig'; +import { getCurrentUserId } from '@utils/getCurrentUserId'; import back from '@assets/arrow/left.svg'; import camera from '@assets/default/camera.svg'; @@ -21,208 +23,208 @@ import TopBar from '@components/TopBar/index'; import type { UserInfoData, PatchUserInfoRequest } from '@apis/user/dto'; import { - ProfileEditContainer, - ProfilePic, - ProfilePicWrapper, - Input, - Button, - Row, - FileInput, - CameraIcon, - UserInfo, - Username, - EmailInput, + ProfileEditContainer, + ProfilePic, + ProfilePicWrapper, + Input, + Button, + Row, + FileInput, + CameraIcon, + UserInfo, + Username, + EmailInput, } from './styles'; type ExtendedUserInfoData = UserInfoData & { - birthDate?: string; + birthDate?: string; }; const ProfileEdit: React.FC = () => { - const fileInputRef = useRef(null); - const [nickname, setNickname] = useState(''); - const [bio, setBio] = useState(''); - const [profilePictureUrl, setProfilePictureUrl] = useState(null); - const [phoneNumber, setPhoneNumber] = useState(''); - const [birthDate, setBirthDate] = useState(''); - const [name, setName] = useState(''); - const [email, setEmail] = useState(''); - const [isLoading, setIsLoading] = useState(true); - const navigate = useNavigate(); - const [modalContent, setModalContent] = useState(null); - const [isModalVisible, setIsModalVisible] = useState(false); - const [uploading, setUploading] = useState(false); - const userId = getCurrentUserId(); - - useEffect(() => { - const getUserInfo = async () => { - try { - const currentUserId = getCurrentUserId(); - if (!currentUserId) { - console.error('User ID not found'); - return; - } - - const response = await getUserInfoApi(currentUserId); - const userInfo: ExtendedUserInfoData = response.data; - - setNickname(userInfo.nickname); - setBio(userInfo.bio); - setProfilePictureUrl(userInfo.profilePictureUrl || null); - setPhoneNumber(userInfo.phoneNumber || ''); - setBirthDate(userInfo.birthDate || ''); - setName(userInfo.name || ''); - setEmail(userInfo.email || ''); - } catch (error) { - console.error('Error fetching user info:', error); - } finally { - setIsLoading(false); - } - }; - - getUserInfo(); - }, []); - - const handleButtonClick = () => { - fileInputRef.current?.click(); - }; - - const handleFileChange = async (event: React.ChangeEvent) => { - const file = event.target.files?.[0]; - if (file) { - setUploading(true); - try { - const storageRef = ref(storage, `profilePictures/${file.name}`); - await uploadBytes(storageRef, file); - const imageUrl = await getDownloadURL(storageRef); - setProfilePictureUrl(imageUrl); - console.log('File uploaded and URL retrieved:', imageUrl); - } catch (error) { - console.error('Error uploading file:', error); - } finally { - setUploading(false); - } - } - }; - - const handleModalClose = () => { - setIsModalVisible(false); - setModalContent(null); - }; - - const handleSave = async () => { - try { - const currentUserId = getCurrentUserId(); - if (!currentUserId) { - console.error('User ID not found'); - return; - } - - const formattedBirthDate = birthDate ? new Date(birthDate).toISOString().split('T')[0] : ''; - - const payload: PatchUserInfoRequest = { - name: name || 'Default Name', - phoneNumber: phoneNumber || '000-0000-0000', - birthDate: formattedBirthDate, - email: email || 'default@example.com', - nickname: nickname || '닉네임 없음', - profilePictureUrl: profilePictureUrl || '', - bio: bio || '', - }; - - const response = await patchUserInfoApi(payload, currentUserId); - - if (response.isSuccess) { - setModalContent('프로필이 성공적으로 수정되었습니다.'); - setIsModalVisible(true); - - setTimeout(() => { - handleModalClose(); - navigate(`/profile/${userId}`); - }, 2000); - } else { - setModalContent('프로필 수정에 실패했습니다.'); - setIsModalVisible(true); - } - } catch (error) { - setModalContent('프로필 수정 중 오류가 발생했습니다.'); - setIsModalVisible(true); - console.error('Error updating user info:', error); - } - }; - - if (isLoading || uploading) { - return ; - } - - return ( - - - navigate(-1)} /> - {isModalVisible && ( - - )} - - - 프로필 사진 - - - - - - - {nickname || '알수없음'} - - - - - 이름 - - setName(e.target.value)} /> - - - - 닉네임 - - setNickname(e.target.value)} /> - - - - 소개글 - - setBio(e.target.value)} /> - - - - 전화번호 - - setPhoneNumber(e.target.value)} /> - - - - 생년월일 - - setBirthDate(e.target.value)} /> - - - - 이메일 - - setEmail(e.target.value)} /> - - - - - ); + const fileInputRef = useRef(null); + const [nickname, setNickname] = useState(''); + const [bio, setBio] = useState(''); + const [profilePictureUrl, setProfilePictureUrl] = useState(null); + const [phoneNumber, setPhoneNumber] = useState(''); + const [birthDate, setBirthDate] = useState(''); + const [name, setName] = useState(''); + const [email, setEmail] = useState(''); + const [isLoading, setIsLoading] = useState(true); + const navigate = useNavigate(); + const [modalContent, setModalContent] = useState(null); + const [isModalVisible, setIsModalVisible] = useState(false); + const [uploading, setUploading] = useState(false); + const userId = getCurrentUserId(); + + useEffect(() => { + const getUserInfo = async () => { + try { + const currentUserId = getCurrentUserId(); + if (!currentUserId) { + console.error('User ID not found'); + return; + } + + const response = await getUserInfoApi(currentUserId); + const userInfo: ExtendedUserInfoData = response.data; + + setNickname(userInfo.nickname); + setBio(userInfo.bio); + setProfilePictureUrl(userInfo.profilePictureUrl || null); + setPhoneNumber(userInfo.phoneNumber || ''); + setBirthDate(userInfo.birthDate || ''); + setName(userInfo.name || ''); + setEmail(userInfo.email || ''); + } catch (error) { + console.error('Error fetching user info:', error); + } finally { + setIsLoading(false); + } + }; + + getUserInfo(); + }, []); + + const handleButtonClick = () => { + fileInputRef.current?.click(); + }; + + const handleFileChange = async (event: React.ChangeEvent) => { + const file = event.target.files?.[0]; + if (file) { + setUploading(true); + try { + const storageRef = ref(storage, `profilePictures/${file.name}`); + await uploadBytes(storageRef, file); + const imageUrl = await getDownloadURL(storageRef); + setProfilePictureUrl(imageUrl); + console.log('File uploaded and URL retrieved:', imageUrl); + } catch (error) { + console.error('Error uploading file:', error); + } finally { + setUploading(false); + } + } + }; + + const handleModalClose = () => { + setIsModalVisible(false); + setModalContent(null); + }; + + const handleSave = async () => { + try { + const currentUserId = getCurrentUserId(); + if (!currentUserId) { + console.error('User ID not found'); + return; + } + + const formattedBirthDate = birthDate ? new Date(birthDate).toISOString().split('T')[0] : ''; + + const payload: PatchUserInfoRequest = { + name: name || 'Default Name', + phoneNumber: phoneNumber || '000-0000-0000', + birthDate: formattedBirthDate, + email: email || 'default@example.com', + nickname: nickname || '닉네임 없음', + profilePictureUrl: profilePictureUrl || '', + bio: bio || '', + }; + + const response = await patchUserInfoApi(payload, currentUserId); + + if (response.isSuccess) { + setModalContent('프로필이 성공적으로 수정되었습니다.'); + setIsModalVisible(true); + + setTimeout(() => { + handleModalClose(); + navigate(`/profile/${userId}`); + }, 2000); + } else { + setModalContent('프로필 수정에 실패했습니다.'); + setIsModalVisible(true); + } + } catch (error) { + setModalContent('프로필 수정 중 오류가 발생했습니다.'); + setIsModalVisible(true); + console.error('Error updating user info:', error); + } + }; + + if (isLoading || uploading) { + return ; + } + + return ( + + + navigate(-1)} /> + {isModalVisible && ( + + )} + + + 프로필 사진 + + + + + + + {nickname || '알수없음'} + + + + + 이름 + + setName(e.target.value)} /> + + + + 닉네임 + + setNickname(e.target.value)} /> + + + + 소개글 + + setBio(e.target.value)} /> + + + + 전화번호 + + setPhoneNumber(e.target.value)} /> + + + + 생년월일 + + setBirthDate(e.target.value)} /> + + + + 이메일 + + setEmail(e.target.value)} /> + + + + + ); }; -export default ProfileEdit; \ No newline at end of file +export default ProfileEdit; diff --git a/src/pages/Profile/index.tsx b/src/pages/Profile/index.tsx index ca04aae1..400eca2a 100644 --- a/src/pages/Profile/index.tsx +++ b/src/pages/Profile/index.tsx @@ -1,13 +1,15 @@ import { useState, useEffect } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; + import { useRecoilValue } from 'recoil'; import theme from '@styles/theme'; -import { OtherUserAtom } from '@recoil/util/OtherUser'; -import { getCurrentUserId } from '@utils/getCurrentUserId'; + import { createMatchingApi } from '@apis/matching'; import { getUserPostListApi } from '@apis/post'; import { getUserInfoApi } from '@apis/user'; +import { OtherUserAtom } from '@recoil/util/OtherUser'; +import { getCurrentUserId } from '@utils/getCurrentUserId'; import BackSvg from '@assets/arrow/left.svg'; import imageBasic from '@assets/default/defaultProfile.svg'; @@ -32,159 +34,159 @@ import ButtonSecondary from './ButtonSecondary/index'; import NavbarProfile from './NavbarProfile/index'; import { - ProfileContainer, - Header, - StatsContainer, - Stat, - StatNumber, - StatLabel, - PostsContainer, - AddButton, - NoPostWrapper, - Button, + ProfileContainer, + Header, + StatsContainer, + Stat, + StatNumber, + StatLabel, + PostsContainer, + AddButton, + NoPostWrapper, + Button, } from './styles'; const Profile: React.FC = () => { - const { userId } = useParams<{ userId: string }>(); - const profileUserId = Number(userId); - const loggedInUserId = getCurrentUserId(); - const otherUser = useRecoilValue(OtherUserAtom); - - const [isLoading, setIsLoading] = useState(true); - const [posts, setPosts] = useState([]); - const [totalPosts, setTotalPosts] = useState(0); - const [userInfo, setUserInfo] = useState(null); - const [isBottomSheetOpen, setIsBottomSheetOpen] = useState(false); - const [isOptionsBottomSheetOpen, setIsOptionsBottomSheetOpen] = useState(false); - const [isModalOpen, setIsModalOpen] = useState(false); - const [modalContent, setModalContent] = useState(''); - const navigate = useNavigate(); - - const isMyPage = loggedInUserId === profileUserId; - - useEffect(() => { - const fetchData = async () => { - try { - const response = await getUserInfoApi(profileUserId); - const postResponse = await getUserPostListApi(1, 10, profileUserId); - setUserInfo(response.data); - setPosts(postResponse.data.post); - setTotalPosts(postResponse.data.totalPostsCount); - } catch (error) { - console.error('데이터 가져오기 실패:', error); - } finally { - setIsLoading(false); - } - }; - fetchData(); - }, [profileUserId]); - - const createMatching = async (message: string) => { - const matchingRequestData = { - requesterId: loggedInUserId, - targetId: otherUser?.id || profileUserId, - message: message, - }; - - try { - await createMatchingApi(matchingRequestData); - handleModalOpen(`${userInfo?.nickname}님에게 대표 OOTD와 \n한 줄 메세지를 보냈어요!`); - } catch (error) { - console.error('매칭 신청 오류:', error); - handleModalOpen('매칭 신청에 실패했습니다.'); - } - }; - - const handleModalOpen = (message: string) => { - setIsBottomSheetOpen(false); - setModalContent(message); - setIsModalOpen(true); - }; - - if (isLoading) return ; - - return ( - - - {isMyPage && ( - navigate('/post/upload/photo/select')}> - Add - - )} - - {isMyPage ? ( - - ) : ( - navigate(-1)} - onClickRightButton={() => setIsOptionsBottomSheetOpen(true)} - /> - )} - -
- -
- - {isMyPage ? : } - - - - OOTD - {totalPosts || 0} - - {isMyPage && ( - - 코멘트 - {posts.reduce((sum, post) => sum + (post.postCommentsCount || 0), 0)} - - )} - - 좋아요 - {posts.reduce((sum, post) => sum + (post.postLikesCount || 0), 0)} - - - - - {posts.length > 0 ? ( - posts.map((post) => ) - ) : ( - - - 게시물이 없어요. - - - )} - - - {isMyPage && } - - setIsBottomSheetOpen(false)} - /> - - setIsOptionsBottomSheetOpen(false)} - /> - - {isModalOpen && setIsModalOpen(false)} />} -
-
- ); + const { userId } = useParams<{ userId: string }>(); + const profileUserId = Number(userId); + const loggedInUserId = getCurrentUserId(); + const otherUser = useRecoilValue(OtherUserAtom); + + const [isLoading, setIsLoading] = useState(true); + const [posts, setPosts] = useState([]); + const [totalPosts, setTotalPosts] = useState(0); + const [userInfo, setUserInfo] = useState(null); + const [isBottomSheetOpen, setIsBottomSheetOpen] = useState(false); + const [isOptionsBottomSheetOpen, setIsOptionsBottomSheetOpen] = useState(false); + const [isModalOpen, setIsModalOpen] = useState(false); + const [modalContent, setModalContent] = useState(''); + const navigate = useNavigate(); + + const isMyPage = loggedInUserId === profileUserId; + + useEffect(() => { + const fetchData = async () => { + try { + const response = await getUserInfoApi(profileUserId); + const postResponse = await getUserPostListApi(1, 10, profileUserId); + setUserInfo(response.data); + setPosts(postResponse.data.post); + setTotalPosts(postResponse.data.totalPostsCount); + } catch (error) { + console.error('데이터 가져오기 실패:', error); + } finally { + setIsLoading(false); + } + }; + fetchData(); + }, [profileUserId]); + + const createMatching = async (message: string) => { + const matchingRequestData = { + requesterId: loggedInUserId, + targetId: otherUser?.id || profileUserId, + message: message, + }; + + try { + await createMatchingApi(matchingRequestData); + handleModalOpen(`${userInfo?.nickname}님에게 대표 OOTD와 \n한 줄 메세지를 보냈어요!`); + } catch (error) { + console.error('매칭 신청 오류:', error); + handleModalOpen('매칭 신청에 실패했습니다.'); + } + }; + + const handleModalOpen = (message: string) => { + setIsBottomSheetOpen(false); + setModalContent(message); + setIsModalOpen(true); + }; + + if (isLoading) return ; + + return ( + + + {isMyPage && ( + navigate('/post/upload/photo/select')}> + Add + + )} + + {isMyPage ? ( + + ) : ( + navigate(-1)} + onClickRightButton={() => setIsOptionsBottomSheetOpen(true)} + /> + )} + +
+ +
+ + {isMyPage ? : } + + + + OOTD + {totalPosts || 0} + + {isMyPage && ( + + 코멘트 + {posts.reduce((sum, post) => sum + (post.postCommentsCount || 0), 0)} + + )} + + 좋아요 + {posts.reduce((sum, post) => sum + (post.postLikesCount || 0), 0)} + + + + + {posts.length > 0 ? ( + posts.map((post) => ) + ) : ( + + + 게시물이 없어요. + + + )} + + + {isMyPage && } + + setIsBottomSheetOpen(false)} + /> + + setIsOptionsBottomSheetOpen(false)} + /> + + {isModalOpen && setIsModalOpen(false)} />} +
+
+ ); }; -export default Profile; \ No newline at end of file +export default Profile; From c01651fda7c412b47f466aa60cec4a6762dde43f Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 17:37:28 +0900 Subject: [PATCH 04/14] =?UTF-8?q?Fix:=20GlobalStyles=20=EB=A6=B0=ED=8A=B8?= =?UTF-8?q?=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/styles/GlobalStyles.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/GlobalStyles.ts b/src/styles/GlobalStyles.ts index 4d5330c7..49dda526 100644 --- a/src/styles/GlobalStyles.ts +++ b/src/styles/GlobalStyles.ts @@ -1,5 +1,5 @@ import { createGlobalStyle } from 'styled-components'; -import reset from 'styled-reset'; +import { reset } from 'styled-reset'; const GlobalStyles = createGlobalStyle` ${reset} From ed4c7fca2900563b911bc5eaf2649e36f46f792c Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 17:57:01 +0900 Subject: [PATCH 05/14] =?UTF-8?q?Fix:=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=A1=B0=ED=9A=8C=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EC=97=90=EC=84=9C=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=EB=9D=BC=EC=9A=B0=ED=8C=85=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Post/PostBase/index.tsx | 9 +-------- src/pages/Post/PostBase/styles.tsx | 4 +++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/pages/Post/PostBase/index.tsx b/src/pages/Post/PostBase/index.tsx index 6c38df20..9f5df391 100644 --- a/src/pages/Post/PostBase/index.tsx +++ b/src/pages/Post/PostBase/index.tsx @@ -63,7 +63,6 @@ const PostBase: React.FC = ({ onClickMenu }) => { const [activeTab, setActiveTab] = useState<'likes' | 'comments'>('likes'); // activeTab state const { postId } = useParams<{ postId: string }>(); - const userId = getCurrentUserId(); const nav = useNavigate(); @@ -73,13 +72,7 @@ const PostBase: React.FC = ({ onClickMenu }) => { }; const handleUserClick = () => { - if (post?.isPostWriter) { - // 내 게시물인 경우 - nav(`/profile/${userId}`); - } else { - // 다른 유저의 게시물인 경우 - nav(`/users/${post?.user.id}`); - } + nav(`/profile/${post?.user.id}`); }; const contentRef = useRef(null); diff --git a/src/pages/Post/PostBase/styles.tsx b/src/pages/Post/PostBase/styles.tsx index a0f40f83..8ec77731 100644 --- a/src/pages/Post/PostBase/styles.tsx +++ b/src/pages/Post/PostBase/styles.tsx @@ -88,7 +88,9 @@ export const UserProfile = styled(LoadingSkeleton)` } `; -export const UserName = styled(StyledText)``; +export const UserName = styled(StyledText)` + cursor: pointer; +`; export const MenuBtn = styled.button` width: 18px; From 37f0db6c3c26dbb01ea7994fbfa5db900c089dc2 Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 17:57:41 +0900 Subject: [PATCH 06/14] =?UTF-8?q?Feat:=20Feed=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=EC=97=90=20relativeTime=20=ED=94=8C=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Chats/ChatRoomItem/index.tsx | 2 -- src/pages/Home/OOTD/Feed/index.tsx | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/Chats/ChatRoomItem/index.tsx b/src/pages/Chats/ChatRoomItem/index.tsx index 0798cfa7..6e04a3d5 100644 --- a/src/pages/Chats/ChatRoomItem/index.tsx +++ b/src/pages/Chats/ChatRoomItem/index.tsx @@ -17,8 +17,6 @@ import type { ChatRoomData } from '@apis/chatting/dto'; import { UserImage, ChatRoomItemLayout, LeftBox, RightBox, LatestMessage } from './styles'; -import 'dayjs/locale/ko'; - const ChatRoomItem: React.FC = ({ id, otherUser, latestMessage }) => { const [timeAgo, setTimeAgo] = useState(null); const [, setOtherUser] = useRecoilState(OtherUserAtom); diff --git a/src/pages/Home/OOTD/Feed/index.tsx b/src/pages/Home/OOTD/Feed/index.tsx index 66dc117f..842e6580 100644 --- a/src/pages/Home/OOTD/Feed/index.tsx +++ b/src/pages/Home/OOTD/Feed/index.tsx @@ -1,7 +1,8 @@ import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import dayjs from 'dayjs'; +import dayjs, { extend } from 'dayjs'; +import relativeTime from 'dayjs/plugin/relativeTime'; import { Pagination } from 'swiper/modules'; import { Swiper, SwiperSlide } from 'swiper/react'; import 'swiper/css'; @@ -58,6 +59,7 @@ const Feed: React.FC = ({ feed }) => { const [isStatusModalOpen, setIsStatusModalOpen] = useState(false); const [modalContent, setModalContent] = useState(''); + extend(relativeTime); const nav = useNavigate(); const currentUserId = getCurrentUserId(); const timeAgo = dayjs(feed.createdAt).locale('ko').fromNow(); From 16eff7e2b437869d3956498226bc2d707ed22c3e Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 18:03:23 +0900 Subject: [PATCH 07/14] =?UTF-8?q?Fix:=20getCurrentUserId=EB=A1=9C=20?= =?UTF-8?q?=EB=B0=9B=EC=95=84=EC=98=A4=EB=8A=94=20=EB=AA=A8=EB=93=A0=20?= =?UTF-8?q?=EA=B0=9C=EB=B3=84=20=EB=B3=80=EC=88=98=EB=AA=85=EC=9D=84=20cur?= =?UTF-8?q?rentUserId=EB=A1=9C=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PostBase/LikeCommentBottomSheetContent/index.tsx | 12 ++++-------- src/pages/Post/PostBase/index.tsx | 1 - src/pages/Post/PostImageSelect/index.tsx | 4 ++-- src/pages/Post/PostInstaFeedSelect/index.tsx | 4 ++-- src/pages/Post/PostUpload/index.tsx | 4 ++-- src/pages/Post/index.tsx | 6 +++--- src/pages/Profile/ProfileEdit/index.tsx | 6 ++---- src/pages/Profile/index.tsx | 6 +++--- 8 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx b/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx index ee0ada50..5afa2315 100644 --- a/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx +++ b/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx @@ -69,6 +69,7 @@ const LikeCommentBottomSheetContent: React.FC = ({ const { postId } = useParams<{ postId: string }>(); const nav = useNavigate(); + const currentUserId = getCurrentUserId(); // 댓글 메뉴 클릭한 경우 const handleMenuOpen = (comment: Comment, event: React.MouseEvent) => { @@ -80,10 +81,7 @@ const LikeCommentBottomSheetContent: React.FC = ({ // 유저 클릭한 경우 const handleUserClick = (userId: number) => { - // 로컬 스토리지에서 사용자 ID 가져오기 - const myUserId = getCurrentUserId(); // 로컬 스토리지에 저장된 사용자 ID를 가져옴 - - if (String(myUserId) === String(userId)) { + if (currentUserId === userId) { // 나인 경우 nav(`/profile/${userId}`); } else { @@ -190,10 +188,8 @@ const LikeCommentBottomSheetContent: React.FC = ({ // 유저 차단 api const postUserBlock = async () => { - const storedUserId = getCurrentUserId(); - // 사용자 ID 또는 선택된 댓글이 없으면 함수 종료 - if (!storedUserId || !selectedComment) { + if (!currentUserId || !selectedComment) { setModalContent('유저 정보를 찾을 수 없습니다.'); setIsStatusModalOpen(true); return; @@ -201,7 +197,7 @@ const LikeCommentBottomSheetContent: React.FC = ({ try { const blockRequest: PostUserBlockRequest = { - requesterId: Number(storedUserId), + requesterId: currentUserId, targetId: selectedComment.user.id, action: 'block', }; diff --git a/src/pages/Post/PostBase/index.tsx b/src/pages/Post/PostBase/index.tsx index 9f5df391..e4274c92 100644 --- a/src/pages/Post/PostBase/index.tsx +++ b/src/pages/Post/PostBase/index.tsx @@ -10,7 +10,6 @@ import theme from '@styles/theme'; import { getPostDetailApi } from '@apis/post'; import { togglePostLikeStatusApi } from '@apis/post-like'; import { postIdAtom, userAtom, isPostRepresentativeAtom } from '@recoil/Post/PostAtom'; -import { getCurrentUserId } from '@utils/getCurrentUserId'; import Left from '@assets/arrow/left.svg'; import Message from '@assets/default/message.svg'; diff --git a/src/pages/Post/PostImageSelect/index.tsx b/src/pages/Post/PostImageSelect/index.tsx index 7ca8729e..8cb1c567 100644 --- a/src/pages/Post/PostImageSelect/index.tsx +++ b/src/pages/Post/PostImageSelect/index.tsx @@ -37,10 +37,10 @@ const PostImageSelect: React.FC = () => { const fileInputRef = useRef(null); const location = useLocation(); const navigate = useNavigate(); - const userId = getCurrentUserId(); + const currentUserId = getCurrentUserId(); const handleClose = () => { - navigate(`/profile/${userId}`); + navigate(`/profile/${currentUserId}`); }; const handlePrev = () => { diff --git a/src/pages/Post/PostInstaFeedSelect/index.tsx b/src/pages/Post/PostInstaFeedSelect/index.tsx index 96d3d976..6d358c37 100644 --- a/src/pages/Post/PostInstaFeedSelect/index.tsx +++ b/src/pages/Post/PostInstaFeedSelect/index.tsx @@ -26,7 +26,7 @@ const PostInstaFeedSelect: React.FC = () => { const [posts, setPosts] = useState([]); // Post 타입으로 지정 const [, setImages] = useRecoilState(postImagesAtom); const navigate = useNavigate(); - const userId = getCurrentUserId(); + const currentUserId = getCurrentUserId(); // 인스타그램 데이터 가져오는 함수 const fetchInstagramData = async (accessToken: string) => { @@ -75,7 +75,7 @@ const PostInstaFeedSelect: React.FC = () => { // 페이지 종료 함수 const handleClose = () => { - navigate(`/profile/${userId}`); + navigate(`/profile/${currentUserId}`); }; return ( diff --git a/src/pages/Post/PostUpload/index.tsx b/src/pages/Post/PostUpload/index.tsx index 32c75f3d..92906aa8 100644 --- a/src/pages/Post/PostUpload/index.tsx +++ b/src/pages/Post/PostUpload/index.tsx @@ -69,7 +69,7 @@ const PostUpload: React.FC = () => { const [modalContent, setModalContent] = useState('알 수 없는 오류입니다.\n관리자에게 문의해 주세요.'); const location = useLocation(); const navigate = useNavigate(); - const userId = getCurrentUserId(); + const currentUserId = getCurrentUserId(); const styletags = [ 'classic', @@ -240,7 +240,7 @@ const PostUpload: React.FC = () => { setSelectedStyletag([]); setMode(''); - navigate(`/profile/${userId}`); + navigate(`/profile/${currentUserId}`); } catch (error) { const errorMessage = handleError(error, 'post'); setModalContent(errorMessage); diff --git a/src/pages/Post/index.tsx b/src/pages/Post/index.tsx index baddc707..ad69bbfd 100644 --- a/src/pages/Post/index.tsx +++ b/src/pages/Post/index.tsx @@ -38,7 +38,7 @@ const Post: React.FC = () => { const [postPinStatus, setPostPinStatus] = useState<'지정' | '해제'>('지정'); const navigate = useNavigate(); - const userId = getCurrentUserId(); + const currentUserId = getCurrentUserId(); const handleMenuOpen = () => { if (isMyPost) { @@ -73,7 +73,7 @@ const Post: React.FC = () => { setModalContent('OOTD 삭제에 성공했어요'); setTimeout(() => { - navigate(`/profile/${userId}`); + navigate(`/profile/${currentUserId}`); }, 1000); } else { setModalContent(`OOTD 삭제에 실패했어요\n잠시 뒤 다시 시도해 보세요`); @@ -89,7 +89,7 @@ const Post: React.FC = () => { useEffect(() => { // 현재 게시글이 내 게시글인지 확인 if (user?.id && postId) { - setIsMyPost(Number(userId) === user.id); + setIsMyPost(currentUserId === user.id); } }, [user, postId]); diff --git a/src/pages/Profile/ProfileEdit/index.tsx b/src/pages/Profile/ProfileEdit/index.tsx index cb38acfa..a3526002 100644 --- a/src/pages/Profile/ProfileEdit/index.tsx +++ b/src/pages/Profile/ProfileEdit/index.tsx @@ -54,12 +54,11 @@ const ProfileEdit: React.FC = () => { const [modalContent, setModalContent] = useState(null); const [isModalVisible, setIsModalVisible] = useState(false); const [uploading, setUploading] = useState(false); - const userId = getCurrentUserId(); + const currentUserId = getCurrentUserId(); useEffect(() => { const getUserInfo = async () => { try { - const currentUserId = getCurrentUserId(); if (!currentUserId) { console.error('User ID not found'); return; @@ -114,7 +113,6 @@ const ProfileEdit: React.FC = () => { const handleSave = async () => { try { - const currentUserId = getCurrentUserId(); if (!currentUserId) { console.error('User ID not found'); return; @@ -140,7 +138,7 @@ const ProfileEdit: React.FC = () => { setTimeout(() => { handleModalClose(); - navigate(`/profile/${userId}`); + navigate(`/profile/${currentUserId}`); }, 2000); } else { setModalContent('프로필 수정에 실패했습니다.'); diff --git a/src/pages/Profile/index.tsx b/src/pages/Profile/index.tsx index 400eca2a..599a56e9 100644 --- a/src/pages/Profile/index.tsx +++ b/src/pages/Profile/index.tsx @@ -49,7 +49,7 @@ import { const Profile: React.FC = () => { const { userId } = useParams<{ userId: string }>(); const profileUserId = Number(userId); - const loggedInUserId = getCurrentUserId(); + const currentUserId = getCurrentUserId(); const otherUser = useRecoilValue(OtherUserAtom); const [isLoading, setIsLoading] = useState(true); @@ -62,7 +62,7 @@ const Profile: React.FC = () => { const [modalContent, setModalContent] = useState(''); const navigate = useNavigate(); - const isMyPage = loggedInUserId === profileUserId; + const isMyPage = currentUserId === profileUserId; useEffect(() => { const fetchData = async () => { @@ -83,7 +83,7 @@ const Profile: React.FC = () => { const createMatching = async (message: string) => { const matchingRequestData = { - requesterId: loggedInUserId, + requesterId: currentUserId, targetId: otherUser?.id || profileUserId, message: message, }; From 4f11bbf40e74e77985031bd6199c50cd62f75c2f Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 18:03:59 +0900 Subject: [PATCH 08/14] =?UTF-8?q?Fix:=20=EB=82=A8=EC=95=84=20=EC=9E=88?= =?UTF-8?q?=EB=8D=98=20users=20=EA=B2=BD=EB=A1=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Post/PostBase/LikeCommentBottomSheetContent/index.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx b/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx index 5afa2315..ed0a2cda 100644 --- a/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx +++ b/src/pages/Post/PostBase/LikeCommentBottomSheetContent/index.tsx @@ -81,13 +81,7 @@ const LikeCommentBottomSheetContent: React.FC = ({ // 유저 클릭한 경우 const handleUserClick = (userId: number) => { - if (currentUserId === userId) { - // 나인 경우 - nav(`/profile/${userId}`); - } else { - // 다른 유저인 경우 - nav(`/users/${userId}`); - } + nav(`/profile/${userId}`); }; // 댓글 작성 Input From 1d54d0e7265c98ad6c0e2323aa7874afb69597f6 Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 18:26:59 +0900 Subject: [PATCH 09/14] =?UTF-8?q?Fix:=20=EC=BB=AC=EB=9F=AC=EC=8B=9C?= =?UTF-8?q?=EC=8A=A4=ED=85=9C=20=EC=98=A4=EC=A0=81=EC=9A=A9=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ClothingInfoItem/styles.tsx | 2 +- src/components/ConfirmationModal/index.tsx | 4 ++-- src/pages/Account/AccountCancel/index.tsx | 11 ++++------- src/pages/Account/AccountCancel/styles.tsx | 12 +++--------- src/pages/Account/AccountEdit/index.tsx | 4 ++-- src/pages/Account/AccountEdit/styles.tsx | 2 +- src/pages/Account/AccountSetting/index.tsx | 6 +++--- src/pages/Account/Verification/styles.tsx | 6 +++--- src/pages/NotFound/styles.tsx | 2 +- .../LikeCommentBottomSheetContent/styles.tsx | 2 +- src/pages/Post/PostUpload/ToggleSwitch/styles.tsx | 4 ++-- src/pages/Post/PostUpload/styles.tsx | 2 +- src/pages/Profile/NavbarProfile/index.tsx | 2 +- src/pages/Profile/NavbarProfile/styles.tsx | 2 +- src/pages/Profile/ProfileEdit/styles.tsx | 2 +- src/pages/Profile/styles.tsx | 2 +- src/pages/SignUp/TermsAgreement/styles.tsx | 4 ++-- 17 files changed, 30 insertions(+), 39 deletions(-) diff --git a/src/components/ClothingInfoItem/styles.tsx b/src/components/ClothingInfoItem/styles.tsx index 5eb00bfb..8a556f89 100644 --- a/src/components/ClothingInfoItem/styles.tsx +++ b/src/components/ClothingInfoItem/styles.tsx @@ -39,7 +39,7 @@ export const ClothingInfoLeft = styled.div` .model { margin-right: auto; - color: ${({ theme }) => theme.colors.black}; + color: ${({ theme }) => theme.colors.text.primary}; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; diff --git a/src/components/ConfirmationModal/index.tsx b/src/components/ConfirmationModal/index.tsx index 697982ec..fabcf23f 100644 --- a/src/components/ConfirmationModal/index.tsx +++ b/src/components/ConfirmationModal/index.tsx @@ -24,7 +24,7 @@ const ConfirmationModal: React.FC = ({ > - + {content} @@ -36,7 +36,7 @@ const ConfirmationModal: React.FC = ({ onCloseModal(); }} > - + 취소 diff --git a/src/pages/Account/AccountCancel/index.tsx b/src/pages/Account/AccountCancel/index.tsx index 86070a97..17e4dd2c 100644 --- a/src/pages/Account/AccountCancel/index.tsx +++ b/src/pages/Account/AccountCancel/index.tsx @@ -24,7 +24,6 @@ import { CheckboxInput, Label, StyledCheckboxText, - StyledDiv, } from './styles'; const AccountCancel: React.FC = () => { @@ -85,12 +84,12 @@ const AccountCancel: React.FC = () => { navigate(-1)} /> - + OOTD 탈퇴 전 확인하세요! - + {`탈퇴하시면 이용 중인 서비스가 폐쇄되며,\n모든 데이터는 복구할 수 없습니다.`} @@ -99,7 +98,7 @@ const AccountCancel: React.FC = () => { 지금까지 OODD를 이용해주셔서 감사합니다! @@ -115,9 +114,7 @@ const AccountCancel: React.FC = () => { - - - + {isModalVisible && ( theme.colors.gray[200]}; + border: 0.125rem solid ${({ theme }) => theme.colors.border.divider}; border-radius: 0.25rem; position: relative; &:checked { - background-color: ${({ theme }) => theme.colors.background.primaryLight}; + background-color: ${({ theme }) => theme.colors.brand.primaryLight}; border-color: ${({ theme }) => theme.colors.brand.primary}; } &:checked::after { content: '✓'; - color: ${({ theme }) => theme.colors.contrast}; + color: ${({ theme }) => theme.colors.text.contrast}; font-size: 0.875rem; position: absolute; top: 50%; @@ -92,9 +92,3 @@ export const Label = styled.label` export const StyledCheckboxText = styled(StyledText)` color: ${({ theme }) => theme.colors.text.caption}; `; - -export const StyledDiv = styled.div<{ isChecked: boolean }>` - background-color: ${({ isChecked, theme }) => (isChecked ? theme.colors.primary : theme.colors.gray[300])}; - color: ${({ isChecked, theme }) => (isChecked ? theme.colors.contrast : theme.colors.caption)}; - cursor: ${({ isChecked }) => (isChecked ? 'pointer' : 'not-allowed')}; -`; diff --git a/src/pages/Account/AccountEdit/index.tsx b/src/pages/Account/AccountEdit/index.tsx index c6ee9c74..2be0eded 100644 --- a/src/pages/Account/AccountEdit/index.tsx +++ b/src/pages/Account/AccountEdit/index.tsx @@ -41,7 +41,7 @@ const AccountEdit: React.FC = () => {
- + 로그인 정보 @@ -64,7 +64,7 @@ const AccountEdit: React.FC = () => {
- + 회원 정보 diff --git a/src/pages/Account/AccountEdit/styles.tsx b/src/pages/Account/AccountEdit/styles.tsx index 4fb7366f..65eb681d 100644 --- a/src/pages/Account/AccountEdit/styles.tsx +++ b/src/pages/Account/AccountEdit/styles.tsx @@ -84,7 +84,7 @@ export const Label = styled.div` export const Info = styled.div` font-size: 0.875rem; - color: ${({ theme }) => theme.colors.caption}; + color: ${({ theme }) => theme.colors.text.caption}; margin-left: 0.625rem; flex-grow: 1; text-align: left; diff --git a/src/pages/Account/AccountSetting/index.tsx b/src/pages/Account/AccountSetting/index.tsx index 99adb521..75f1bcbc 100644 --- a/src/pages/Account/AccountSetting/index.tsx +++ b/src/pages/Account/AccountSetting/index.tsx @@ -81,7 +81,7 @@ const AccountSetting: React.FC = () => { @@ -98,13 +98,13 @@ const AccountSetting: React.FC = () => { 로그아웃 아이콘 - + Logout 회원 탈퇴 아이콘 - + 회원탈퇴 diff --git a/src/pages/Account/Verification/styles.tsx b/src/pages/Account/Verification/styles.tsx index 78d6b9a4..23a57005 100644 --- a/src/pages/Account/Verification/styles.tsx +++ b/src/pages/Account/Verification/styles.tsx @@ -45,7 +45,7 @@ export const Button = styled.button` padding: 1.25rem; margin-top: 300px; font-size: 0.875rem; - color: ${({ theme }) => theme.colors.contrast}; + color: ${({ theme }) => theme.colors.text.contrast}; background-color: ${({ theme, disabled }) => (disabled ? theme.colors.gray[300] : theme.colors.black)}; border: none; border-radius: 0.3125rem; @@ -76,7 +76,7 @@ export const Timer = styled.div` top: 50%; transform: translateY(-50%); font-size: 1rem; - color: ${({ theme }) => theme.colors.red || theme.colors.brand.primary}; + color: ${({ theme }) => theme.colors.brand.primary}; `; export const ResendButton = styled.button` @@ -86,7 +86,7 @@ export const ResendButton = styled.button` transform: translateY(-50%); padding: 0.625rem; font-size: 0.875rem; - color: ${({ theme }) => theme.colors.black}; + color: ${({ theme }) => theme.colors.text.primary}; background: none; border: none; cursor: pointer; diff --git a/src/pages/NotFound/styles.tsx b/src/pages/NotFound/styles.tsx index 915337f2..cb7a5f66 100644 --- a/src/pages/NotFound/styles.tsx +++ b/src/pages/NotFound/styles.tsx @@ -45,6 +45,6 @@ export const StyledButton = styled(StyledText)` &.prev { background-color: ${({ theme }) => theme.colors.brand.primary}; - color: ${({ theme }) => theme.colors.white}; + color: ${({ theme }) => theme.colors.text.contrast}; } `; diff --git a/src/pages/Post/PostBase/LikeCommentBottomSheetContent/styles.tsx b/src/pages/Post/PostBase/LikeCommentBottomSheetContent/styles.tsx index c61584f1..21da8d11 100644 --- a/src/pages/Post/PostBase/LikeCommentBottomSheetContent/styles.tsx +++ b/src/pages/Post/PostBase/LikeCommentBottomSheetContent/styles.tsx @@ -114,7 +114,7 @@ export const InputLayout = styled.div` width: 50px; height: 50px; border-radius: 8px; - color: ${({ theme }) => theme.colors.white}; + color: ${({ theme }) => theme.colors.text.contrast}; border: none; font-size: 0.875rem; } diff --git a/src/pages/Post/PostUpload/ToggleSwitch/styles.tsx b/src/pages/Post/PostUpload/ToggleSwitch/styles.tsx index b8d69b7c..98084266 100644 --- a/src/pages/Post/PostUpload/ToggleSwitch/styles.tsx +++ b/src/pages/Post/PostUpload/ToggleSwitch/styles.tsx @@ -18,7 +18,7 @@ export const HiddenCheckbox = styled.input.attrs({ type: 'checkbox' })` width: 25px; height: 25px; border-radius: 50%; - background-color: ${({ theme }) => theme.colors.white}; + background-color: ${({ theme }) => theme.colors.background.primary}; border: 1.5px solid ${({ theme }) => theme.colors.border.active}; transition: left 250ms linear; } @@ -29,7 +29,7 @@ export const HiddenCheckbox = styled.input.attrs({ type: 'checkbox' })` } &:checked::before { - background-color: white; + background-color: ${({ theme }) => theme.colors.background.primary}; left: 25px; } `; diff --git a/src/pages/Post/PostUpload/styles.tsx b/src/pages/Post/PostUpload/styles.tsx index 17a34396..9eb65c7a 100644 --- a/src/pages/Post/PostUpload/styles.tsx +++ b/src/pages/Post/PostUpload/styles.tsx @@ -168,7 +168,7 @@ export const StyletagItem = styled.span<{ selected: boolean }>` cursor: pointer; .tag { - color: ${({ selected, theme }) => (selected ? theme.colors.white : theme.colors.brand.primary)}; + color: ${({ selected, theme }) => (selected ? theme.colors.text.contrast : theme.colors.brand.primary)}; } `; diff --git a/src/pages/Profile/NavbarProfile/index.tsx b/src/pages/Profile/NavbarProfile/index.tsx index 811eca61..d4878322 100644 --- a/src/pages/Profile/NavbarProfile/index.tsx +++ b/src/pages/Profile/NavbarProfile/index.tsx @@ -11,7 +11,7 @@ import { Nav, IconContainer } from './styles'; const NavbarProfile: React.FC = () => { return (
@@ -167,12 +167,12 @@ const SearchBottomSheetContent: React.FC = ({ onClose, o handleClothingInfoAdd(searchResultItem)}> {searchResultItem.title.replace(/<[^]+>/g, '')} />
- + {searchResultItem.brand} {removeBrandFromTitle(searchResultItem.title, searchResultItem.brand)} @@ -183,7 +183,7 @@ const SearchBottomSheetContent: React.FC = ({ onClose, o
{isLoading && ( - + 로딩 중 diff --git a/src/pages/Post/PostUpload/index.tsx b/src/pages/Post/PostUpload/index.tsx index 92906aa8..54e49cfb 100644 --- a/src/pages/Post/PostUpload/index.tsx +++ b/src/pages/Post/PostUpload/index.tsx @@ -343,21 +343,21 @@ const PostUpload: React.FC = () => {
- + 스타일 태그 {isStyletagListOpen ? ( ) : selectedStyletag.length === 0 ? ( <> - + 미지정 ) : ( - + #{selectedStyletag[0]} @@ -371,7 +371,7 @@ const PostUpload: React.FC = () => { onClick={() => handleStyletagSelect(tag)} selected={selectedStyletag[0] === tag} > - + #{tag} @@ -381,7 +381,7 @@ const PostUpload: React.FC = () => { - 대표 OOTD 지정 + 대표 OOTD 지정
From cb83aab893d45934bc57c2a2bc29821a831872f2 Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 18:36:09 +0900 Subject: [PATCH 11/14] =?UTF-8?q?Fix:=20PostBase=20&=20Profile=20=EC=9D=BC?= =?UTF-8?q?=EB=B6=80=20=EC=BD=94=EB=93=9C=20=ED=9D=90=EB=A6=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Post/PostBase/index.tsx | 3 +-- src/pages/Profile/index.tsx | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/pages/Post/PostBase/index.tsx b/src/pages/Post/PostBase/index.tsx index e4274c92..990daa75 100644 --- a/src/pages/Post/PostBase/index.tsx +++ b/src/pages/Post/PostBase/index.tsx @@ -62,6 +62,7 @@ const PostBase: React.FC = ({ onClickMenu }) => { const [activeTab, setActiveTab] = useState<'likes' | 'comments'>('likes'); // activeTab state const { postId } = useParams<{ postId: string }>(); + const contentRef = useRef(null); const nav = useNavigate(); @@ -74,8 +75,6 @@ const PostBase: React.FC = ({ onClickMenu }) => { nav(`/profile/${post?.user.id}`); }; - const contentRef = useRef(null); - const toggleTextDisplay = () => { setShowFullText((prev) => !prev); }; diff --git a/src/pages/Profile/index.tsx b/src/pages/Profile/index.tsx index 599a56e9..5748896b 100644 --- a/src/pages/Profile/index.tsx +++ b/src/pages/Profile/index.tsx @@ -47,11 +47,6 @@ import { } from './styles'; const Profile: React.FC = () => { - const { userId } = useParams<{ userId: string }>(); - const profileUserId = Number(userId); - const currentUserId = getCurrentUserId(); - const otherUser = useRecoilValue(OtherUserAtom); - const [isLoading, setIsLoading] = useState(true); const [posts, setPosts] = useState([]); const [totalPosts, setTotalPosts] = useState(0); @@ -62,6 +57,11 @@ const Profile: React.FC = () => { const [modalContent, setModalContent] = useState(''); const navigate = useNavigate(); + const { userId } = useParams<{ userId: string }>(); + const profileUserId = Number(userId); + const currentUserId = getCurrentUserId(); + const otherUser = useRecoilValue(OtherUserAtom); + const isMyPage = currentUserId === profileUserId; useEffect(() => { From d45900579b2d174e3abc2be5ba55844434543413 Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 18:36:58 +0900 Subject: [PATCH 12/14] =?UTF-8?q?Fix:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BB=A4=EC=84=9C=20=ED=8F=AC=EC=9D=B8=ED=84=B0=20?= =?UTF-8?q?css=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Profile/styles.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/Profile/styles.tsx b/src/pages/Profile/styles.tsx index 10de6cb6..7db238d6 100644 --- a/src/pages/Profile/styles.tsx +++ b/src/pages/Profile/styles.tsx @@ -58,7 +58,6 @@ export const PostsContainer = styled.div` flex-wrap: wrap; justify-content: space-between; gap: 15px; - cursor: pointer; margin-bottom: 100px; padding: 20px; `; From d3fea10adecf47547e088a983b82171faf7f6722 Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 18:44:55 +0900 Subject: [PATCH 13/14] =?UTF-8?q?Fix:=20Home=20=EC=A0=84=EC=B2=B4=20?= =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EC=A1=B0=ED=9A=8C=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=AA=A8=EB=8B=AC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Home/OOTD/index.tsx | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/pages/Home/OOTD/index.tsx b/src/pages/Home/OOTD/index.tsx index 46fc288a..edf31e5b 100644 --- a/src/pages/Home/OOTD/index.tsx +++ b/src/pages/Home/OOTD/index.tsx @@ -3,12 +3,8 @@ import { useState, useEffect, useRef } from 'react'; import debounce from 'lodash/debounce'; import { getPostListApi } from '@apis/post'; -import { handleError } from '@apis/util/handleError'; - -import Modal from '@components/Modal'; import type { PostSummary } from '@apis/post/dto'; -import type { ModalProps } from '@components/Modal/dto'; import Feed from './Feed/index'; @@ -17,9 +13,6 @@ import { OOTDContainer, FeedContainer } from './styles'; const OOTD: React.FC = () => { const [feeds, setFeeds] = useState([]); - const [modalContent, setModalContent] = useState('알 수 없는 오류입니다.\n관리자에게 문의해 주세요.'); - const [isStatusModalOpen, setIsStatusModalOpen] = useState(false); - const isFetchingRef = useRef(false); const isReachedEndRef = useRef(false); const feedPageRef = useRef(1); @@ -51,10 +44,6 @@ const OOTD: React.FC = () => { feedPageRef.current += 1; } } - } catch (error) { - const errorMessage = handleError(error); - setModalContent(errorMessage); - setIsStatusModalOpen(true); } finally { isFetchingRef.current = false; console.log(feeds); @@ -109,13 +98,6 @@ const OOTD: React.FC = () => { }; }, []); - const statusModalProps: ModalProps = { - content: modalContent, - onClose: () => { - setIsStatusModalOpen(false); - }, - }; - return ( @@ -127,7 +109,6 @@ const OOTD: React.FC = () => { {/* Intersection Observer가 감지할 마지막 요소 */}
- {isStatusModalOpen && } ); }; From fc4ebb7b301812bc924f4684f74cea66de2147d3 Mon Sep 17 00:00:00 2001 From: young Date: Sun, 5 Jan 2025 18:55:01 +0900 Subject: [PATCH 14/14] =?UTF-8?q?Fix:=20PostItem=20&=20UserProfile?= =?UTF-8?q?=EC=9D=84=20components=20=ED=8F=B4=EB=8D=94=EC=97=90=EC=84=9C?= =?UTF-8?q?=20Profile=20=ED=8F=B4=EB=8D=94=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/{components => pages/Profile}/PostItem/dto.ts | 0 src/{components => pages/Profile}/PostItem/index.tsx | 0 src/{components => pages/Profile}/PostItem/style.tsx | 0 src/{components => pages/Profile}/UserProfile/dto.ts | 0 src/{components => pages/Profile}/UserProfile/index.tsx | 0 src/{components => pages/Profile}/UserProfile/style.tsx | 0 src/pages/Profile/index.tsx | 4 ++-- 7 files changed, 2 insertions(+), 2 deletions(-) rename src/{components => pages/Profile}/PostItem/dto.ts (100%) rename src/{components => pages/Profile}/PostItem/index.tsx (100%) rename src/{components => pages/Profile}/PostItem/style.tsx (100%) rename src/{components => pages/Profile}/UserProfile/dto.ts (100%) rename src/{components => pages/Profile}/UserProfile/index.tsx (100%) rename src/{components => pages/Profile}/UserProfile/style.tsx (100%) diff --git a/src/components/PostItem/dto.ts b/src/pages/Profile/PostItem/dto.ts similarity index 100% rename from src/components/PostItem/dto.ts rename to src/pages/Profile/PostItem/dto.ts diff --git a/src/components/PostItem/index.tsx b/src/pages/Profile/PostItem/index.tsx similarity index 100% rename from src/components/PostItem/index.tsx rename to src/pages/Profile/PostItem/index.tsx diff --git a/src/components/PostItem/style.tsx b/src/pages/Profile/PostItem/style.tsx similarity index 100% rename from src/components/PostItem/style.tsx rename to src/pages/Profile/PostItem/style.tsx diff --git a/src/components/UserProfile/dto.ts b/src/pages/Profile/UserProfile/dto.ts similarity index 100% rename from src/components/UserProfile/dto.ts rename to src/pages/Profile/UserProfile/dto.ts diff --git a/src/components/UserProfile/index.tsx b/src/pages/Profile/UserProfile/index.tsx similarity index 100% rename from src/components/UserProfile/index.tsx rename to src/pages/Profile/UserProfile/index.tsx diff --git a/src/components/UserProfile/style.tsx b/src/pages/Profile/UserProfile/style.tsx similarity index 100% rename from src/components/UserProfile/style.tsx rename to src/pages/Profile/UserProfile/style.tsx diff --git a/src/pages/Profile/index.tsx b/src/pages/Profile/index.tsx index 5748896b..4953104f 100644 --- a/src/pages/Profile/index.tsx +++ b/src/pages/Profile/index.tsx @@ -22,16 +22,16 @@ import { OODDFrame } from '@components/Frame/Frame'; import Loading from '@components/Loading'; import Modal from '@components/Modal'; import NavBar from '@components/NavBar'; -import PostItem from '@components/PostItem'; import { StyledText } from '@components/Text/StyledText'; import TopBar from '@components/TopBar'; -import UserProfile from '@components/UserProfile'; import type { UserPostSummary } from '@apis/post/dto'; import type { UserInfoData } from '@apis/user/dto'; import ButtonSecondary from './ButtonSecondary/index'; import NavbarProfile from './NavbarProfile/index'; +import PostItem from './PostItem/index'; +import UserProfile from './UserProfile/index'; import { ProfileContainer,