From 53bdd65cb230559d054bcaaf936c7d401239bd4e Mon Sep 17 00:00:00 2001 From: HA-SEUNG-JEONG Date: Mon, 6 May 2024 19:13:33 +0900 Subject: [PATCH 1/4] =?UTF-8?q?style=20:=20=EC=A7=88=EB=AC=B8=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/asset/sass/etc/header/userInfoHeader.scss | 2 +- src/asset/sass/pages/postPage/questionDetailPage.scss | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/asset/sass/etc/header/userInfoHeader.scss b/src/asset/sass/etc/header/userInfoHeader.scss index 846b7aa5..4c1f8df0 100644 --- a/src/asset/sass/etc/header/userInfoHeader.scss +++ b/src/asset/sass/etc/header/userInfoHeader.scss @@ -51,7 +51,7 @@ img.loginuser { .dropdown-question-detail-menu { position: relative; z-index: 500; - right: 5rem; + right: 6rem; top: 6rem; ul { diff --git a/src/asset/sass/pages/postPage/questionDetailPage.scss b/src/asset/sass/pages/postPage/questionDetailPage.scss index 6dbd2f11..78f464f1 100644 --- a/src/asset/sass/pages/postPage/questionDetailPage.scss +++ b/src/asset/sass/pages/postPage/questionDetailPage.scss @@ -13,17 +13,16 @@ } .detailpage-company { - font-size: 1.5rem; + font-size: 1.2rem; letter-spacing: -1px; display: flex; justify-content: space-evenly; background-color: #ff8d1d; border: 1px solid #ff8d1d; - border-radius: 20px; + border-radius: 25px; margin-left: 1.5%; font-family: 'Pretendard-SemiBold'; padding: 1% 2.5% 1% 2.5%; - width: 83px; color: #fff; } From cee99b0cc90615c15caa34fc7269140231d9807c Mon Sep 17 00:00:00 2001 From: HA-SEUNG-JEONG Date: Mon, 6 May 2024 20:49:19 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat=20:=20=EB=B3=B8=EC=9D=B8=20=EA=B8=80?= =?UTF-8?q?=20=EC=97=AC=EB=B6=80=EC=97=90=20=EB=94=B0=EB=9D=BC=20=EB=93=9C?= =?UTF-8?q?=EB=A1=AD=EB=8B=A4=EC=9A=B4=20=EB=8B=A4=EB=A5=B4=EA=B2=8C=20?= =?UTF-8?q?=EB=B3=B4=EC=97=AC=EC=A3=BC=EA=B8=B0=20-=20=EB=B3=B8=EC=9D=B8?= =?UTF-8?q?=20=EA=B8=80=EC=9D=BC=20=EA=B2=BD=EC=9A=B0=20=EC=88=98=EC=A0=95?= =?UTF-8?q?/=EC=82=AD=EC=A0=9C=20-=20=EB=B3=B8=EC=9D=B8=20=EA=B8=80?= =?UTF-8?q?=EC=9D=B4=20=EC=95=84=EB=8B=90=20=EA=B2=BD=EC=9A=B0=20=EC=8B=A0?= =?UTF-8?q?=EA=B3=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/asset/sass/etc/header/userInfoHeader.scss | 25 +++++++++ .../pages/postPage/questionDetailPage.tsx | 51 ++++++++++++------- 2 files changed, 57 insertions(+), 19 deletions(-) diff --git a/src/asset/sass/etc/header/userInfoHeader.scss b/src/asset/sass/etc/header/userInfoHeader.scss index 4c1f8df0..db224c19 100644 --- a/src/asset/sass/etc/header/userInfoHeader.scss +++ b/src/asset/sass/etc/header/userInfoHeader.scss @@ -48,6 +48,31 @@ img.loginuser { font-family: Pretendard-Medium; } +.dropdown-question-detail-report-menu { + position: relative; + z-index: 500; + right: 6rem; + top: 6rem; + cursor: pointer; + ul { + position: absolute; + list-style: none; + padding: 0; + margin: 0; + background: #fff; + border: 1px solid rgba(0, 0, 0, 0.3); + width: 88px; + height: 36px; + display: flex; + justify-content: space-evenly; + flex-direction: column; + align-items: center; + + border-radius: 10px; + border-color: #d9d9d9; + } +} + .dropdown-question-detail-menu { position: relative; z-index: 500; diff --git a/src/components/pages/postPage/questionDetailPage.tsx b/src/components/pages/postPage/questionDetailPage.tsx index 7bf2a21c..1c0b8d0d 100644 --- a/src/components/pages/postPage/questionDetailPage.tsx +++ b/src/components/pages/postPage/questionDetailPage.tsx @@ -46,10 +46,11 @@ const QuestionTitle = styled.div` font-size: 3rem; padding: 10px; color: #000000; - margin: 0 78% 2% 3%; } display: flex; align-items: center; + justify-content: space-between; + padding: 15px; img { cursor: pointer; } @@ -131,6 +132,7 @@ function QuestionDetailPage() { const [isShowEdit, setIsShowEdit] = useState(false); const [isShowReport, setIsShowReport] = useState(false); + const [isShowReportModal, setIsShowReportModal] = useState(false); const [isAdopted, setIsAdopted] = useState(false); const [anyAdopted, setAnyAdopted] = useState(false); @@ -177,15 +179,20 @@ function QuestionDetailPage() { }; const toggleReportPopup = () => { - setIsShowReport((show) => !show); + setIsShowReport((showReport) => !showReport); + setIsShowReportModal((showReportModal) => !showReportModal); }; - const handleEdit = () => { - console.log('click '); - setIsShowEdit((edit) => !edit); - }; + const handleEdit = async () => { + const res = await fetchAPI('/api/member/me', 'GET'); - console.log(isShowEdit); + if (res.data.nickname === questionerNickname) { + setIsShowEdit(true); + setIsShowReport(false); + } else if (res.data.nickname !== questionerNickname) { + setIsShowReport((showReport) => !showReport); + } + }; const handleClickEdit = async () => { const editBody = { @@ -227,8 +234,9 @@ function QuestionDetailPage() { }; const handleCloseReportPopup = () => { - setIsShowReport((show) => !show); + setIsShowReportModal(false); }; + const fetchData = async () => { const response = await axios.get( `${BASE_URL}/api/question/${questionId}?pageNo=${currentPage}&criterion=createdAt`, @@ -273,7 +281,6 @@ function QuestionDetailPage() { '스팸 혹은 홍보성 도배글이에요', '특정 이용자가 질문, 답변, 채택을 반복해요', ]; - // console.log(questionerTag); return ( @@ -288,8 +295,11 @@ function QuestionDetailPage() { ? `${questionerTag}이 남긴 질문이에요` : `${questionerTag}가 남긴 질문이에요`} - - {!isShowEdit && ( + + + {questionTitle} + dot + {isShowEdit && (
  • @@ -303,19 +313,22 @@ function QuestionDetailPage() { 삭제
  • {/* + */} +
+
+ )} + {isShowReport ? ( +
+
  • 신고 -
  • */} +
- )} - - - {questionTitle} - dot + ) : null}
@@ -335,7 +348,7 @@ function QuestionDetailPage() {
- {isShowReport ? ( + {isShowReportModal && (
사용자 신고
@@ -365,7 +378,7 @@ function QuestionDetailPage() {
- ) : null} + )} {!isAdopted && ( From a9f92cba3ec0d054ecc957188d057373b163d8b6 Mon Sep 17 00:00:00 2001 From: HA-SEUNG-JEONG Date: Mon, 6 May 2024 22:10:44 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat=20:=20=EC=98=88=EC=99=B8=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/postPage/questionDetailPage.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/pages/postPage/questionDetailPage.tsx b/src/components/pages/postPage/questionDetailPage.tsx index 1c0b8d0d..ec16b3b3 100644 --- a/src/components/pages/postPage/questionDetailPage.tsx +++ b/src/components/pages/postPage/questionDetailPage.tsx @@ -114,6 +114,7 @@ function QuestionDetailPage() { const [totalPages, setTotalPages] = useState(0); const [questionerNickname, setQuestionerNickname] = useState(''); + // const [answererNickname, setAnswererNickname] = useState(''); const [questionerTag, setQuestionerTag] = useState(''); const [answerCount, setAnswerCount] = useState(0); @@ -147,9 +148,13 @@ function QuestionDetailPage() { }; try { - const data = await fetchAPI('/api/answer', 'POST', requestData); + // 답변 내용이 비어있을 경우 에러 던지기 + if (answerRef.current?.value === '') { + throw new Error('크기가 1에서 500 사이여야 합니다'); + } - if (data.statusCode === 'CREATED' && answerRef.current) { + const answerResponse = await fetchAPI('/api/answer', 'POST', requestData); + if (answerResponse.statusCode === 'CREATED' && answerRef.current) { setPostAnswer(answerRef.current?.value); showSuccessToast('답변이 등록되었습니다.'); @@ -158,7 +163,12 @@ function QuestionDetailPage() { } } } catch (error) { - if (error instanceof Error) showErrorToast('비속어가 존재합니다.'); + if (error instanceof Error) { + showErrorToast('질문 작성자는 답변 작성이 불가능합니다.'); + if (error.message === '크기가 1에서 500 사이여야 합니다') { + showErrorToast(error.message); + } + } } }; From 96bc4440e662ed4f4e69844597c8fc5cb9fb94cf Mon Sep 17 00:00:00 2001 From: HA-SEUNG-JEONG Date: Mon, 6 May 2024 23:01:30 +0900 Subject: [PATCH 4/4] =?UTF-8?q?style=20:=20=EA=B8=B0=EC=97=85=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EA=B5=AC=EB=B6=84=EC=84=A0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/pages/searchPage/companyInfoPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/pages/searchPage/companyInfoPage.tsx b/src/components/pages/searchPage/companyInfoPage.tsx index 986e711f..536182ab 100644 --- a/src/components/pages/searchPage/companyInfoPage.tsx +++ b/src/components/pages/searchPage/companyInfoPage.tsx @@ -48,8 +48,8 @@ const CompanyName = styled.div` // `; const Line = styled.div` - height: 1px; - background-color: #f2f2f2; + height: 5px; + background-color: #fff9f4; width: 80%; margin: 10% 0% 5% 10%; stroke: 5px solid #fff9f4;