From 9061327e5878f40a47d55101596ec28680ed582e Mon Sep 17 00:00:00 2001 From: Seonghwan Sim Date: Sat, 3 Aug 2024 16:17:42 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20enter=EB=A1=9C=20=EB=8C=93=EA=B8=80?= =?UTF-8?q?=20=EB=8B=AC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/project/Detail.jsx | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/pages/project/Detail.jsx b/src/pages/project/Detail.jsx index 99d598a..e33cc54 100644 --- a/src/pages/project/Detail.jsx +++ b/src/pages/project/Detail.jsx @@ -40,11 +40,11 @@ export default function Detail() { ); }; - const BookmarkList = ({ bookmark = []}) => { + const BookmarkList = ({ bookmark = [] }) => { if (!bookmark || bookmark.length === 0) { return null; } - + return (
{bookmark.map((item, index) => ( @@ -98,6 +98,7 @@ export default function Detail() { console.log("Post uploaded successfully"); // alert("게시물 업로드 성공"); navigate("/"); // 성공적으로 업로드 후 메인 페이지로 이동 + setComment(""); } else { console.error("Error uploading post"); } @@ -114,7 +115,6 @@ export default function Detail() { localStorage.removeItem("token"); navigate("/", { replace: true }); } - setComment(""); } }; @@ -206,20 +206,23 @@ export default function Detail() { navigate("/update"); } -// 글 작성하는 페이지로 이동 - const toWrite = (id) => { // 넘겨주는 id는 갈피의 id - if(project.isOwner) { // owner인 경우 - navigate("/update", { state: { id: id, user: 2, mode: 0, bookmarkList: bookmarkList} }); + // 글 작성하는 페이지로 이동 + const toWrite = (id) => { + // 넘겨주는 id는 갈피의 id + if (project.isOwner) { + // owner인 경우 + navigate("/update", { + state: { id: id, user: 2, mode: 0, bookmarkList: bookmarkList }, + }); } - if(project.isOwner === false && project.isParticipate === true) { + if (project.isOwner === false && project.isParticipate === true) { navigate("/update", { state: { id, user: 1, mode: 0, bookmarkList } }); // 참여자인 경우 } - - if(project.isOwner === false && project.isParticipate === false) { - navigate("/update", { state: { id, user: 0, mode: 0, bookmarkList } }); // 그냥 사람 + + if (project.isOwner === false && project.isParticipate === false) { + navigate("/update", { state: { id, user: 0, mode: 0, bookmarkList } }); // 그냥 사람 } - }; const handleGoCommunity = (id) => { @@ -331,7 +334,7 @@ export default function Detail() { id="detail-write-container" value={comment} onChange={(e) => setComment(e.target.value)} - onKeyDown={(e) => (e.key === "Enter" ? addComment() : null)} + onKeyDown={(e) => (e.key === "Enter" ? handleSubmit() : null)} /> Date: Sat, 3 Aug 2024 16:24:29 +0900 Subject: [PATCH 2/2] =?UTF-8?q?style:=20detail=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=95=88?= =?UTF-8?q?=EB=B3=B4=EC=9D=B4=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header.jsx | 43 ++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/components/Header.jsx b/src/components/Header.jsx index d47265c..f67f878 100644 --- a/src/components/Header.jsx +++ b/src/components/Header.jsx @@ -127,31 +127,32 @@ export default function Header({ mode }) {
{/* 프로젝트 이외에 경우에는 카테고리를 안보여줘도 됨 */} - {mode === 3 ? ( + {/* detail 페이지도 */} + {mode === 3 || mode === 2 ? ( <> ) : ( -
-
- {Object.keys(categories).map((category) => ( - - ))} -
- {/* 프로젝트 전체 페이지일 경우 보여줌 */} - {mode === 1 ? ( -
- {categories[selectedCategory].map((option, index) => ( - +
+
+ {Object.keys(categories).map((category) => ( + ))}
- ) : ( - <> - )} -
+ {/* 프로젝트 전체 페이지일 경우 보여줌 */} + {mode === 1 ? ( +
+ {categories[selectedCategory].map((option, index) => ( + + ))} +
+ ) : ( + <> + )} +
)}
);