{depth === 1 ? null : (
From d29a1e5adae57200de4abf0b2d79b2d526da5d92 Mon Sep 17 00:00:00 2001
From: afds4567 <33995840+afds4567@users.noreply.github.com>
Date: Tue, 17 Oct 2023 16:33:48 +0900
Subject: [PATCH 08/14] =?UTF-8?q?refactor:=20=EC=88=98=EC=A0=95=20?=
=?UTF-8?q?=EC=82=AD=EC=A0=9C=20=EA=B6=8C=ED=95=9C=20=EB=B0=98=EC=98=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/common/Input/SingleComment.tsx | 40 ++++++++++---------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/frontend/src/components/common/Input/SingleComment.tsx b/frontend/src/components/common/Input/SingleComment.tsx
index 5a1247ee..51804b08 100644
--- a/frontend/src/components/common/Input/SingleComment.tsx
+++ b/frontend/src/components/common/Input/SingleComment.tsx
@@ -75,6 +75,7 @@ function SingleComment({
refetch();
showToast('info', '댓글이 삭제되었습니다.');
} catch (e) {
+ console.error(e);
showToast('error', '댓글을 다시 작성해주세요');
}
};
@@ -96,6 +97,7 @@ function SingleComment({
setIsEditing;
showToast('info', '댓글이 수정되었습니다.');
} catch (e) {
+ console.error(e);
showToast('error', '댓글을 다시 작성해주세요');
}
};
@@ -189,24 +191,26 @@ function SingleComment({
)}
-
-
- 수정
-
-
- 삭제
-
-
+ {comment.canChange && (
+
+
+ 수정
+
+
+ 삭제
+
+
+ )}
{seeMore && (
From 0f2589d94e598f7cfa641f7c326c37d77cbfc503 Mon Sep 17 00:00:00 2001
From: afds4567 <33995840+afds4567@users.noreply.github.com>
Date: Tue, 17 Oct 2023 16:42:32 +0900
Subject: [PATCH 09/14] =?UTF-8?q?refactor:=20=EB=8C=93=EA=B8=80=20?=
=?UTF-8?q?=EC=9E=AC=EC=9A=94=EC=B2=AD=20=EB=A1=9C=EC=A7=81=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
---
frontend/src/components/common/Input/SingleComment.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/frontend/src/components/common/Input/SingleComment.tsx b/frontend/src/components/common/Input/SingleComment.tsx
index 51804b08..e42deb1a 100644
--- a/frontend/src/components/common/Input/SingleComment.tsx
+++ b/frontend/src/components/common/Input/SingleComment.tsx
@@ -72,7 +72,7 @@ function SingleComment({
try {
// 댓글 삭제
await deleteApi(`/pins/comments/${comment.id}`);
- refetch();
+ refetch(comment.id);
showToast('info', '댓글이 삭제되었습니다.');
} catch (e) {
console.error(e);
@@ -93,7 +93,7 @@ function SingleComment({
await putApi(`/pins/comments/${comment.id}`, {
content,
});
- refetch();
+ refetch(comment.id);
setIsEditing;
showToast('info', '댓글이 수정되었습니다.');
} catch (e) {
From 347cbc0fdc8f7e89a4ea3b57e57b4cce0e8b115d Mon Sep 17 00:00:00 2001
From: afds4567 <33995840+afds4567@users.noreply.github.com>
Date: Tue, 17 Oct 2023 17:04:06 +0900
Subject: [PATCH 10/14] =?UTF-8?q?refactor=20:=EC=88=98=EC=A0=95=20?=
=?UTF-8?q?=EC=82=AD=EC=A0=9C=EC=8B=9C=20commentId=EC=97=90=EC=84=9C=20pin?=
=?UTF-8?q?Id=EB=A1=9C=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/components/common/Input/SingleComment.tsx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/frontend/src/components/common/Input/SingleComment.tsx b/frontend/src/components/common/Input/SingleComment.tsx
index e42deb1a..00fac8a2 100644
--- a/frontend/src/components/common/Input/SingleComment.tsx
+++ b/frontend/src/components/common/Input/SingleComment.tsx
@@ -58,7 +58,7 @@ function SingleComment({
},
'application/json',
);
- refetch(Number(pinDetail));
+ await refetch(Number(pinDetail));
setReplyOpen(false);
setNewComment('');
showToast('info', '댓글이 추가되었습니다.');
@@ -72,7 +72,7 @@ function SingleComment({
try {
// 댓글 삭제
await deleteApi(`/pins/comments/${comment.id}`);
- refetch(comment.id);
+ refetch(Number(pinDetail));
showToast('info', '댓글이 삭제되었습니다.');
} catch (e) {
console.error(e);
@@ -93,7 +93,7 @@ function SingleComment({
await putApi(`/pins/comments/${comment.id}`, {
content,
});
- refetch(comment.id);
+ refetch(Number(pinDetail));
setIsEditing;
showToast('info', '댓글이 수정되었습니다.');
} catch (e) {
From cdfaf48a15c4caf6ce33fa855f8866bb4fcb21ea Mon Sep 17 00:00:00 2001
From: afds4567 <33995840+afds4567@users.noreply.github.com>
Date: Tue, 17 Oct 2023 17:06:39 +0900
Subject: [PATCH 11/14] =?UTF-8?q?refactor:=20fetch=EB=A1=9C=EC=A7=81=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/components/common/Input/SingleComment.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/frontend/src/components/common/Input/SingleComment.tsx b/frontend/src/components/common/Input/SingleComment.tsx
index 00fac8a2..ce648e8d 100644
--- a/frontend/src/components/common/Input/SingleComment.tsx
+++ b/frontend/src/components/common/Input/SingleComment.tsx
@@ -72,7 +72,7 @@ function SingleComment({
try {
// 댓글 삭제
await deleteApi(`/pins/comments/${comment.id}`);
- refetch(Number(pinDetail));
+ await refetch(Number(pinDetail));
showToast('info', '댓글이 삭제되었습니다.');
} catch (e) {
console.error(e);
@@ -93,7 +93,7 @@ function SingleComment({
await putApi(`/pins/comments/${comment.id}`, {
content,
});
- refetch(Number(pinDetail));
+ await refetch(Number(pinDetail));
setIsEditing;
showToast('info', '댓글이 수정되었습니다.');
} catch (e) {
From 2a931db79f683ba17fb705946e4c718f2715d7a3 Mon Sep 17 00:00:00 2001
From: afds4567 <33995840+afds4567@users.noreply.github.com>
Date: Tue, 17 Oct 2023 17:12:57 +0900
Subject: [PATCH 12/14] =?UTF-8?q?refactor:=20=EC=97=90=EB=9F=AC=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/components/common/Input/ReplyComment.tsx | 8 +++++++-
frontend/src/components/common/Input/SingleComment.tsx | 3 ++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/frontend/src/components/common/Input/ReplyComment.tsx b/frontend/src/components/common/Input/ReplyComment.tsx
index bd76e116..de1ba2d9 100644
--- a/frontend/src/components/common/Input/ReplyComment.tsx
+++ b/frontend/src/components/common/Input/ReplyComment.tsx
@@ -1,6 +1,11 @@
import SingleComment from './SingleComment';
-function ReplyComment({ commentList, pageTotalCommentList, depth }: any) {
+function ReplyComment({
+ commentList,
+ pageTotalCommentList,
+ depth,
+ refetch,
+}: any) {
if (depth === 2) return null;
return (
<>
@@ -12,6 +17,7 @@ function ReplyComment({ commentList, pageTotalCommentList, depth }: any) {
commentList={commentList}
totalList={pageTotalCommentList}
depth={depth}
+ refetch={refetch}
/>
>
))}
diff --git a/frontend/src/components/common/Input/SingleComment.tsx b/frontend/src/components/common/Input/SingleComment.tsx
index ce648e8d..3b1a655b 100644
--- a/frontend/src/components/common/Input/SingleComment.tsx
+++ b/frontend/src/components/common/Input/SingleComment.tsx
@@ -94,7 +94,7 @@ function SingleComment({
content,
});
await refetch(Number(pinDetail));
- setIsEditing;
+ setIsEditing(false);
showToast('info', '댓글이 수정되었습니다.');
} catch (e) {
console.error(e);
@@ -219,6 +219,7 @@ function SingleComment({
parentId={comment.id}
pageTotalCommentList={totalList}
depth={depth + 1}
+ refetch={refetch}
/>
)}
From 994e904885a98480baef6c01e84d2495c878c36f Mon Sep 17 00:00:00 2001
From: afds4567 <33995840+afds4567@users.noreply.github.com>
Date: Tue, 17 Oct 2023 17:35:37 +0900
Subject: [PATCH 13/14] =?UTF-8?q?refactor:=20default=20prod=20url=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/constants/index.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/frontend/src/constants/index.ts b/frontend/src/constants/index.ts
index a2135671..ca04016c 100644
--- a/frontend/src/constants/index.ts
+++ b/frontend/src/constants/index.ts
@@ -9,4 +9,5 @@ export const DEFAULT_TOPIC_IMAGE =
export const DEFAULT_PROFILE_IMAGE =
'https://dr702blqc4x5d.cloudfront.net/2023-map-be-fine/icon/profile_defaultImage.svg';
-export const DEFAULT_PROD_URL = process.env.APP_URL || 'http://localhost:8080';
+export const DEFAULT_PROD_URL =
+ process.env.APP_URL || 'https://mapbefine.kro.kr/api';
From 334005804a2a0fc90cef789c47b2d4085a697f7e Mon Sep 17 00:00:00 2001
From: afds4567 <33995840+afds4567@users.noreply.github.com>
Date: Thu, 19 Oct 2023 11:02:44 +0900
Subject: [PATCH 14/14] =?UTF-8?q?refactor:=20=EB=A6=AC=EB=B7=B0=20?=
=?UTF-8?q?=EB=B0=98=EC=98=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/common/Input/ReplyComment.tsx | 11 +-
.../components/common/Input/SingleComment.tsx | 155 +++++++++---------
frontend/src/pages/PinDetail.tsx | 81 +++++----
frontend/src/pages/UpdatedPinDetail.tsx | 23 +--
frontend/src/types/Comment.ts | 9 +
5 files changed, 138 insertions(+), 141 deletions(-)
create mode 100644 frontend/src/types/Comment.ts
diff --git a/frontend/src/components/common/Input/ReplyComment.tsx b/frontend/src/components/common/Input/ReplyComment.tsx
index de1ba2d9..f40065d2 100644
--- a/frontend/src/components/common/Input/ReplyComment.tsx
+++ b/frontend/src/components/common/Input/ReplyComment.tsx
@@ -1,16 +1,23 @@
import SingleComment from './SingleComment';
+interface ReplyCommentProps {
+ commentList: Comment[];
+ pageTotalCommentList: Comment[];
+ depth: number;
+ refetch: (pinId: number) => Promise
;
+}
+
function ReplyComment({
commentList,
pageTotalCommentList,
depth,
refetch,
-}: any) {
+}: ReplyCommentProps) {
if (depth === 2) return null;
return (
<>
{commentList.length > 0 &&
- commentList.map((comment: string) => (
+ commentList.map((comment) => (
<>
-
+
-
-
- @{comment.creator}
-
-
+
+
+
+
+ @{comment.creator}
+
+
+
+ {comment.canChange && (
+
+
+ 수정
+
+
+ 삭제
+
+
+ )}
+
{isEditing ? (
-
-
-
-
+
+
+
+ 등록
+
+
) : (
-
+
{comment.content}
)}
{depth === 1 ? null : (
-
- )}
- {replyOpen && (
+
+ 답글 작성
+
+
+ )}
+ {replyOpen && (
+
)}
{replyCount > 0 && (
-
- {seeMore ? '\u25B2' : '\u25BC'} 답글 {replyCount}개
-
+
+
+
+ {seeMore ? '\u25B2' : '\u25BC'} 답글 {replyCount}개
+
+
)}
- {comment.canChange && (
-
-
- 수정
-
-
- 삭제
-
-
- )}
{seeMore && (
@@ -229,24 +238,20 @@ function SingleComment({
export default SingleComment;
const CommentWrapper = styled.li<{ depth: number }>`
- width: 100%;
margin-left: ${(props) => props.depth * 20}px;
+ margin-top: 12px;
list-style: none;
`;
-const Flex = styled.div`
- display: flex;
- gap: 12px;
- margin-bottom: 24px;
-`;
-
export const ProfileImage = styled.img`
display: block;
border-radius: 50%;
`;
-const CommentInfo = styled.div``;
+const CommentInfo = styled.div`
+ flex: 1;
+`;
const Writer = styled.div`
white-space: nowrap;
diff --git a/frontend/src/pages/PinDetail.tsx b/frontend/src/pages/PinDetail.tsx
index c72a0a96..1ae547da 100644
--- a/frontend/src/pages/PinDetail.tsx
+++ b/frontend/src/pages/PinDetail.tsx
@@ -20,6 +20,7 @@ import { ModalContext } from '../context/ModalContext';
import useCompressImage from '../hooks/useCompressImage';
import useFormValues from '../hooks/useFormValues';
import useToast from '../hooks/useToast';
+import theme from '../themes';
import { ModifyPinFormProps } from '../types/FormValues';
import { PinProps } from '../types/Pin';
import UpdatedPinDetail from './UpdatedPinDetail';
@@ -41,11 +42,9 @@ function PinDetail({
isEditPinDetail,
setIsEditPinDetail,
}: PinDetailProps) {
- console.log(user);
-
const [searchParams, setSearchParams] = useSearchParams();
const [pin, setPin] = useState(null);
- const [commentList, setCommentList] = useState([]); // 댓글 리스트
+ const [commentList, setCommentList] = useState([]); // 댓글 리스트
const [newComment, setNewComment] = useState('');
const { showToast } = useToast();
const {
@@ -131,7 +130,7 @@ function PinDetail({
// 댓글 구현 부분
const setCurrentPageCommentList = async (pinId: number) => {
- const data: any[] = await getApi(`/pins/comments/${pinId}`);
+ const data = await getApi(`/pins/${pinId}/comments`);
setCommentList(data);
return data;
};
@@ -239,50 +238,32 @@ function PinDetail({
{/* Comment Section */}
- 댓글{' '}
+ 어떻게 생각하나요?{' '}
{userToken && (
)}
{commentList?.length > 0 &&
commentList.map(
- (comment: any) =>
+ (comment) =>
!comment.parentPinCommentId ? (
-
- 내 지도에 저장하기
-
-
-
- 공유하기
-
-
+
theme.fontSize.extraSmall};
+ font-weight: ${({ theme }) => theme.fontWeight.bold};
+
+ box-shadow: 8px 8px 8px 0px rgba(69, 69, 69, 0.15);
+
+ margin-top: 12px;
+ float: right;
+ font-size: 12px;
+`;
export default PinDetail;
diff --git a/frontend/src/pages/UpdatedPinDetail.tsx b/frontend/src/pages/UpdatedPinDetail.tsx
index 71edf779..46069be7 100644
--- a/frontend/src/pages/UpdatedPinDetail.tsx
+++ b/frontend/src/pages/UpdatedPinDetail.tsx
@@ -73,27 +73,6 @@ function UpdatedPinDetail({
return (
-
-
-
- + 사진을 추가해주시면 더 알찬 정보를 제공해줄 수 있을 것 같아요.
-
-
-