From 4fd146e85cc84ae6f46967bd2496d19f63d5bc6c Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Sat, 17 May 2025 21:35:19 +0900 Subject: [PATCH 01/15] =?UTF-8?q?fix=20:=20=EA=B3=B5=EA=B3=A0=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=8B=A4=EB=A5=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99=20=ED=9B=84=20=EB=8B=A4=EC=8B=9C=20=EB=8F=8C?= =?UTF-8?q?=EC=95=84=EC=98=A4=EB=A9=B4=20=EB=B0=9C=EC=83=9D=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=82=A0=EC=A7=9C=20=ED=8F=AC=EB=A7=B7=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectInformation.tsx | 30 ++++++++++--------- .../user/projectDetail/ProjectDetail.tsx | 6 +--- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/components/user/projectFormComponents/projectInformationText/ProjectInformation.tsx b/src/components/user/projectFormComponents/projectInformationText/ProjectInformation.tsx index 2acf1073..d3fbc4d7 100644 --- a/src/components/user/projectFormComponents/projectInformationText/ProjectInformation.tsx +++ b/src/components/user/projectFormComponents/projectInformationText/ProjectInformation.tsx @@ -1,19 +1,13 @@ -import { PROJECT_DATA_GET } from '../../../../constants/user/projectConstants'; -import { - ProjectDetailPlus, - ProjectDetailPlusExtended, -} from '../../../../models/projectDetail'; -import { formatDate } from '../../../../util/formatDate'; +import { ProjectDetailPlusExtended } from '../../../../models/projectDetail'; import * as S from './ProjectInformation.styled'; import beginner from '../../../../assets/beginner.svg'; +import { formatDate } from '../../../../util/formatDate'; interface ProjectInformationProps { data: ProjectDetailPlusExtended; } const ProjectInformation = ({ data }: ProjectInformationProps) => { - data.startDate = formatDate(data.startDate); - return ( @@ -23,12 +17,20 @@ const ProjectInformation = ({ data }: ProjectInformationProps) => { )} - {PROJECT_DATA_GET.map((input, index) => ( - - {input.label} - {data[input.name as keyof ProjectDetailPlus]} - - ))} + + 모집 인원 + {data.totalMember} + + + + 시작 예정 + {formatDate(data.startDate)} + + + + 예상 기간 + {data.estimatedPeriod} + 모집 분야 diff --git a/src/pages/user/projectDetail/ProjectDetail.tsx b/src/pages/user/projectDetail/ProjectDetail.tsx index 14079c45..ec4a877d 100644 --- a/src/pages/user/projectDetail/ProjectDetail.tsx +++ b/src/pages/user/projectDetail/ProjectDetail.tsx @@ -30,8 +30,7 @@ const ProjectDetail = () => { } }, [data, handleModalOpen]); - if (isLoading) return ; - if (isFetching) return ; + if (isLoading || isFetching) return ; if (!data) { return ( @@ -58,9 +57,6 @@ const ProjectDetail = () => { navigate(`/user/${userId}`); }; - console.log(data); - console.log(userData.id); - return ( From afc5840c8d6112a94ca8b6e98b52fa61b9d9431b Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Sat, 17 May 2025 21:41:14 +0900 Subject: [PATCH 02/15] =?UTF-8?q?style=20:=20=EB=8C=93=EA=B8=80=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EB=93=9C=EB=A1=AD?= =?UTF-8?q?=EB=8B=A4=EC=9A=B4=EC=9D=84=20=ED=97=A4=EB=8D=94=EC=9D=98=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=95=84=20=EB=93=9C=EB=A1=AD=EB=8B=A4?= =?UTF-8?q?=EC=9A=B4=EA=B3=BC=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/dropDown/DropDown.styled.ts | 14 ++++++-- src/components/common/dropDown/DropDown.tsx | 4 ++- src/components/common/header/Header.tsx | 1 + .../user/comment/DropDownItem.styled.ts | 34 ++++++++++--------- src/components/user/comment/DropDownItem.tsx | 8 ++--- .../CommentComponentLayout.tsx | 1 + .../comment/replyComponent/ReplyComponent.tsx | 1 + 7 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/components/common/dropDown/DropDown.styled.ts b/src/components/common/dropDown/DropDown.styled.ts index 723df0e5..f9f3d83f 100644 --- a/src/components/common/dropDown/DropDown.styled.ts +++ b/src/components/common/dropDown/DropDown.styled.ts @@ -1,4 +1,4 @@ -import styled from 'styled-components'; +import styled, { css } from 'styled-components'; export const DropDownContainer = styled.div` position: relative; @@ -11,12 +11,20 @@ export const DropDownButtonWrapper = styled.div` outline: none; `; -export const Panel = styled.div` +export const Panel = styled.div<{ $comment: boolean }>` position: absolute; - top: 50px; + top: 40px; right: 0; background-color: ${({ theme }) => theme.color.white}; border-radius: ${({ theme }) => theme.borderRadius.primary}; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); z-index: 100; + + ${({ $comment }) => + $comment && + css` + position: absolute; + top: 0px; + right: 30px; + `} `; diff --git a/src/components/common/dropDown/DropDown.tsx b/src/components/common/dropDown/DropDown.tsx index 515f87a0..32c40a6e 100644 --- a/src/components/common/dropDown/DropDown.tsx +++ b/src/components/common/dropDown/DropDown.tsx @@ -7,12 +7,14 @@ interface DropDownProps { children: React.ReactNode; toggleButton: React.ReactNode; isOpen?: boolean; + comment: boolean; } const DropDown = ({ children, toggleButton, isOpen = false, + comment, ...props }: DropDownProps) => { const [open, setOpen] = useState(isOpen); @@ -31,7 +33,7 @@ const DropDown = ({ > {toggleButton} - {open && {children}} + {open && {children}} ); diff --git a/src/components/common/header/Header.tsx b/src/components/common/header/Header.tsx index c2dc1aaf..a8c6c482 100644 --- a/src/components/common/header/Header.tsx +++ b/src/components/common/header/Header.tsx @@ -83,6 +83,7 @@ function Header() { ) } + comment={false} > <> {isLoggedIn && ( diff --git a/src/components/user/comment/DropDownItem.styled.ts b/src/components/user/comment/DropDownItem.styled.ts index 3864d4ae..04a50881 100644 --- a/src/components/user/comment/DropDownItem.styled.ts +++ b/src/components/user/comment/DropDownItem.styled.ts @@ -1,29 +1,31 @@ import styled from 'styled-components'; -export const Container = styled.div` - position: absolute; - top: -20px; - right: 0; - width: 120px; - background-color: #f7f7f7; - border: 1px solid #e0e0e0; - border-radius: 4px; - overflow: hidden; - z-index: 999; +export const Container = styled.ul` + display: flex; + flex-direction: column; + justify-content: center; + width: 5.5rem; `; export const Item = styled.div` padding: 12px 16px; - font-size: 14px; - color: #333; + font-size: 0.9rem; + font-weight: 600; + line-height: 1; + color: inherit; cursor: pointer; - background-color: #f7f7f7; &:hover { - background-color: #eaeaea; + color: ${({ theme }) => theme.color.white}; + background-color: ${({ theme }) => theme.color.navy}; } - & + & { - border-top: 1px solid #ccc; + &:first-child { + border-top-left-radius: ${({ theme }) => theme.borderRadius.primary}; + border-top-right-radius: ${({ theme }) => theme.borderRadius.primary}; + } + &:last-child { + border-bottom-left-radius: ${({ theme }) => theme.borderRadius.primary}; + border-bottom-right-radius: ${({ theme }) => theme.borderRadius.primary}; } `; diff --git a/src/components/user/comment/DropDownItem.tsx b/src/components/user/comment/DropDownItem.tsx index f6de9cf5..2a63ebc9 100644 --- a/src/components/user/comment/DropDownItem.tsx +++ b/src/components/user/comment/DropDownItem.tsx @@ -1,8 +1,8 @@ import useDeleteComment from '../../../hooks/user/CommentHooks/useDeleteComment'; import useDeleteReply from '../../../hooks/user/CommentHooks/useDeleteReply'; -import { useModal } from '../../../hooks/useModal'; import ReportModal from '../reportComponent/ReportModal'; import * as S from './DropDownItem.styled'; +import useReportModal from '../../../hooks/user/useReportModal'; interface DropdownProps { projectId: number; @@ -29,7 +29,8 @@ const DropDownItem = ({ }: DropdownProps) => { const { removeComment } = useDeleteComment(projectId); const { removeReply } = useDeleteReply(commentId, projectId); - const { isOpen, handleOpenReportModal, handleCloseReportModal } = useModal(); + const { isOpen, handleOpenReportModal, handleCloseReportModal } = + useReportModal(); const onDelete = (commentId: number, recommentId?: number) => { if (reply && recommentId) { @@ -42,10 +43,9 @@ const DropDownItem = ({ return ( <> - 신고하기 - {loginUserId === commentUserId && ( <> + 신고하기 {activateEditMode === commentId ? '수정 취소하기' : '수정하기'} diff --git a/src/components/user/comment/commentComponent/CommentComponentLayout.tsx b/src/components/user/comment/commentComponent/CommentComponentLayout.tsx index a9316519..6eddcdf0 100644 --- a/src/components/user/comment/commentComponent/CommentComponentLayout.tsx +++ b/src/components/user/comment/commentComponent/CommentComponentLayout.tsx @@ -55,6 +55,7 @@ const CommentComponentLayout = ({ toggleButton={ } + comment={true} > } + comment={true} > Date: Sat, 17 May 2025 22:00:41 +0900 Subject: [PATCH 03/15] =?UTF-8?q?refactor=20:=20=EC=9D=BC=EB=B0=98=20?= =?UTF-8?q?=EB=AA=A8=EB=8B=AC=EC=97=90=20=EC=97=B0=EA=B2=B0=20=EB=90=98?= =?UTF-8?q?=EC=96=B4=20=EC=9E=88=EB=8D=98=20=EC=8B=A0=EA=B3=A0=ED=95=98?= =?UTF-8?q?=EA=B8=B0=20=EB=AA=A8=EB=8B=AC=20=ED=9B=85=20=EB=94=B0=EB=A1=9C?= =?UTF-8?q?=20=EB=B9=BC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useModal.ts | 10 ---------- src/hooks/user/useReportModal.ts | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 src/hooks/user/useReportModal.ts diff --git a/src/hooks/useModal.ts b/src/hooks/useModal.ts index d9c0dcfa..d87d29fc 100644 --- a/src/hooks/useModal.ts +++ b/src/hooks/useModal.ts @@ -25,22 +25,12 @@ export const useModal = () => { handleModalClose(); }, [onConfirm, handleModalClose]); - const handleOpenReportModal = () => { - setIsOpen(true); - }; - - const handleCloseReportModal = () => { - setIsOpen(false); - }; - return { isOpen, message, setIsOpen, handleModalClose, handleModalOpen, - handleOpenReportModal, - handleCloseReportModal, handleConfirm, }; }; diff --git a/src/hooks/user/useReportModal.ts b/src/hooks/user/useReportModal.ts new file mode 100644 index 00000000..7f85f21b --- /dev/null +++ b/src/hooks/user/useReportModal.ts @@ -0,0 +1,21 @@ +import { useState } from 'react'; + +export const useReportModal = () => { + const [isOpen, setIsOpen] = useState(false); + + const handleOpenReportModal = () => { + setIsOpen(true); + }; + + const handleCloseReportModal = () => { + setIsOpen(false); + }; + + return { + handleOpenReportModal, + handleCloseReportModal, + isOpen, + }; +}; + +export default useReportModal; From 1f758f0f680129bcf417dbb428f80c3b67f37a86 Mon Sep 17 00:00:00 2001 From: Cho SeungYeon <111514472+layout-SY@users.noreply.github.com> Date: Sat, 17 May 2025 22:07:55 +0900 Subject: [PATCH 04/15] =?UTF-8?q?feat=20:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8?= =?UTF-8?q?=ED=95=9C=20=EC=9C=A0=EC=A0=80=EB=A7=8C=20=EB=8C=93=EA=B8=80?= =?UTF-8?q?=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=8B=A0=EA=B3=A0=20=EC=9D=B4?= =?UTF-8?q?=EC=83=81=EC=9D=98=20=EA=B8=B0=EB=8A=A5=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommentComponentLayout.tsx | 34 +++++++++-------- .../comment/replyComponent/ReplyComponent.tsx | 38 ++++++++++--------- .../user/projectDetail/ProjectDetail.tsx | 13 ++----- 3 files changed, 41 insertions(+), 44 deletions(-) diff --git a/src/components/user/comment/commentComponent/CommentComponentLayout.tsx b/src/components/user/comment/commentComponent/CommentComponentLayout.tsx index 6eddcdf0..ace7a53f 100644 --- a/src/components/user/comment/commentComponent/CommentComponentLayout.tsx +++ b/src/components/user/comment/commentComponent/CommentComponentLayout.tsx @@ -51,22 +51,24 @@ const CommentComponentLayout = ({ projectId={projectId} setActivateEditMode={setActivateEditMode} /> - - } - comment={true} - > - onEdit(item.id)} - loginUserId={loginUserId} - commentUserId={item.user.id} - reportTitle={item.content} - activateEditMode={activateEditMode} - /> - + {loginUserId && ( + + } + comment={true} + > + onEdit(item.id)} + loginUserId={loginUserId} + commentUserId={item.user.id} + reportTitle={item.content} + activateEditMode={activateEditMode} + /> + + )} diff --git a/src/components/user/comment/replyComponent/ReplyComponent.tsx b/src/components/user/comment/replyComponent/ReplyComponent.tsx index 203f79e8..1a842ac3 100644 --- a/src/components/user/comment/replyComponent/ReplyComponent.tsx +++ b/src/components/user/comment/replyComponent/ReplyComponent.tsx @@ -72,24 +72,26 @@ const ReplyComponent = ({ )} - - } - comment={true} - > - onEdit(item.id)} - loginUserId={loginUserId} - commentUserId={item.user.id} - reportTitle={item.content} - activateEditMode={activateEditMode} - reply={true} - /> - + {loginUserId && ( + + } + comment={true} + > + onEdit(item.id)} + loginUserId={loginUserId} + commentUserId={item.user.id} + reportTitle={item.content} + activateEditMode={activateEditMode} + reply={true} + /> + + )} )); }; diff --git a/src/pages/user/projectDetail/ProjectDetail.tsx b/src/pages/user/projectDetail/ProjectDetail.tsx index ec4a877d..c149ddc0 100644 --- a/src/pages/user/projectDetail/ProjectDetail.tsx +++ b/src/pages/user/projectDetail/ProjectDetail.tsx @@ -40,14 +40,6 @@ const ProjectDetail = () => { ); } - if (!userData) { - return ( - - {message} - - ); - } - const handleApplyClick = () => { navigate(`${ROUTES.apply}/${id}`); }; @@ -87,7 +79,8 @@ const ProjectDetail = () => { - {userData.id !== data.user.id && + {userData && + userData.id !== data.user.id && !data.acceptedIds.includes(userData.id) && !data.applicantIds.includes(userData.id) ? (