diff --git a/public/images/close-darkmode.svg b/public/images/close-darkmode.svg new file mode 100644 index 0000000..2d4b644 --- /dev/null +++ b/public/images/close-darkmode.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/images/drop-more-darkmode.svg b/public/images/drop-more-darkmode.svg new file mode 100644 index 0000000..c87e1a7 --- /dev/null +++ b/public/images/drop-more-darkmode.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/images/modify-pen.svg b/public/images/modify-pen.svg new file mode 100644 index 0000000..0d89c27 --- /dev/null +++ b/public/images/modify-pen.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/app/dashboard/[id]/page.tsx b/src/app/dashboard/[id]/page.tsx index e4086f6..eb9b91d 100644 --- a/src/app/dashboard/[id]/page.tsx +++ b/src/app/dashboard/[id]/page.tsx @@ -147,17 +147,17 @@ export default function DashboardID() { <>
{columns?.map((column) => ( - ))} -
+ ))}{' '} +
- )} + {preview ? ( + 미리보기 + ) : isUploading ? ( + '' + ) : ( + 플러스 아이콘 + )} + + {/* ❌ 이미지 제거 버튼 (이미지가 있을 경우만 표시) */} + {preview && !isUploading && ( + + )} +
{/* 파일 입력 필드 (실제 input은 숨겨져 있음) */} - )} + {preview ? ( + 미리보기 + ) : isUploading ? ( + '' + ) : ( + 플러스 아이콘 + )} + + {/* ❌ 이미지 제거 버튼 (이미지가 있을 경우만 표시) */} + {preview && ( + + )} + {/* 이미지 수정 가능 표시 */} + {preview === card.imageUrl && ( +
+ 이미지 수정펜 +
+ )} +
{/* 파일 입력 필드 (실제 input은 숨겨져 있음) */}
-
+ +
+ - 카드 닫기 { + {/* X 버튼 (카드 닫기)*/} +
+ {/* 카드 상단 */}
- 그리드로 관리하기 / 컬럼명은 따로 컴포넌트로 만들어 빼기 -
{column.title}
- -

설명~~~~~~~~

-
-
{assignee.nickname}
-
{dueDate}
+
+ {/* 컬럼명 / 태그 // 설명 // 이미지 */} +
+
+ +
+ {card.tags && } +
+ {card.description && ( +

+ {card.description} +

+ )} + {card.imageUrl && ( + 카드 이미지 + )} +
+ {/* 담당자 / 마감일 박스 */} +
+
+
+ + 담당자 + + {card.assignee && ( +
+ <> + + + {card.assignee.nickname} + + +
+ )} +
+
+ + 마감일 + + {card.dueDate && ( + + {card.dueDate} + + )} +
+
+
+
-
이미지 있으면 이미지
-
댓글 컴포넌트
- {/* 카드 수정 모달 */} - {openModifyCard && ( - - setOpenModifyCard(false)} - // columnId={column.id} - currentColumn={currentColumn} - card={card} - /> - - )} - + + +
) } diff --git a/src/app/features/dashboard_Id/Card/cardModal/CardModal.tsx b/src/app/features/dashboard_Id/Card/cardModal/CardModal.tsx index 9f8b32b..c494164 100644 --- a/src/app/features/dashboard_Id/Card/cardModal/CardModal.tsx +++ b/src/app/features/dashboard_Id/Card/cardModal/CardModal.tsx @@ -1,17 +1,20 @@ import { createPortal } from 'react-dom' +import { useLockBodyScroll } from '@/app/shared/hooks/useLockBodyScroll' + interface ModalProps { children: React.ReactNode } export default function CardModal({ children }: ModalProps) { const modalRoot = document.getElementById('modal-root') + + useLockBodyScroll() + if (!modalRoot) return null return createPortal(
-
- {children} -
+
{children}
, modalRoot, ) diff --git a/src/app/features/dashboard_Id/Card/cardModal/Comment.tsx b/src/app/features/dashboard_Id/Card/cardModal/Comment.tsx new file mode 100644 index 0000000..a681885 --- /dev/null +++ b/src/app/features/dashboard_Id/Card/cardModal/Comment.tsx @@ -0,0 +1,58 @@ +import { format } from 'date-fns' +import { useState } from 'react' + +import { Avatar } from '@/app/shared/components/common/Avatar' +import { useIsMobile } from '@/app/shared/hooks/useIsmobile' + +import { useDeleteCommentMutation } from '../../api/useDeleteCommentMutation' +import { Comment as CommentType } from '../../type/Comment.type' +import CommentModifyForm from './CommentModifyForm' + +export default function Comment({ comment }: { comment: CommentType }) { + const isMobile = useIsMobile() + const [modifyComment, setModifyComment] = useState(false) + const { mutate: deleteComment, isPending } = useDeleteCommentMutation() + + return ( +
+ {isMobile ? ( + + ) : ( + + )} +
+
+ + {comment.author.nickname} + + + {format(new Date(comment.createdAt), 'yyyy.MM.dd HH:mm')} + +
+ {modifyComment ? ( + setModifyComment(false)} + commentId={comment.id} + content={comment.content} + /> + ) : ( +

{comment.content}

+ )} + {!modifyComment && ( +
+ + +
+ )} +
+
+ ) +} diff --git a/src/app/features/dashboard_Id/Card/cardModal/CommentForm.tsx b/src/app/features/dashboard_Id/Card/cardModal/CommentForm.tsx new file mode 100644 index 0000000..08cc66f --- /dev/null +++ b/src/app/features/dashboard_Id/Card/cardModal/CommentForm.tsx @@ -0,0 +1,69 @@ +import { useForm } from 'react-hook-form' + +import { usePostCommentMutation } from '../../api/usePostCommentMutation' +import { CommentFormData } from '../../type/CommentFormData.type' + +export default function CommentForm({ + cardId, + columnId, + dashboardId, +}: { + cardId: number + columnId: number + dashboardId: number +}) { + const { + register, + handleSubmit, + reset, + formState: { errors, isValid, isSubmitting }, + } = useForm({ + mode: 'onChange', + }) + + // 폼 제출 핸들러 함수 + const { mutate: createComment, isPending } = usePostCommentMutation() + + function onSubmit(data: CommentFormData) { + const payload = { + ...data, + cardId, + columnId, + dashboardId, + } + console.log(payload) + createComment(payload) + reset() + } + + return ( + + +
+