Skip to content

Commit f4ef1c1

Browse files
authored
any 타입 제거
Card detail01
2 parents 0e26c05 + bcde692 commit f4ef1c1

5 files changed

Lines changed: 51 additions & 50 deletions

File tree

src/components/columnCard/Card.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export default function Card({
4545
</div>
4646
)}
4747

48-
{/* 텍스트 콘텐츠 영역 */}
4948
<div className="flex flex-col justify-between flex-1 w-full">
5049
{/* 제목 */}
5150
<h3

src/components/columnCard/CardList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
PointerSensor,
66
useSensor,
77
useSensors,
8+
DragEndEvent,
89
} from "@dnd-kit/core";
910
import {
1011
SortableContext,
@@ -101,7 +102,7 @@ export default function CardList({
101102
return () => observer.disconnect();
102103
}, [fetchMoreCards, hasMore]);
103104

104-
const handleDragEnd = (event: any) => {
105+
const handleDragEnd = (event: DragEndEvent) => {
105106
const { active, over } = event;
106107

107108
if (!over || active.id === over.id) return;

src/components/modalDashboard/CardDetail.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// CardDetail.tsx
21
import Image from "next/image";
32
import { CardDetailType } from "@/types/cards";
43
import { ProfileIcon } from "./profelicon";
@@ -13,13 +12,12 @@ interface CardDetailProps {
1312

1413
export default function CardDetail({ card, columnName }: CardDetailProps) {
1514
return (
16-
<div className="p-4 ">
17-
<h2 className="text-3xl font-semibold mb-5">{card.title}</h2>
18-
{/* 작성자 정보 추가 */}
15+
<div className="p-4">
16+
{/* 담당자 정보 박스 */}
1917
<div className="absolute w-[181px] h-[155px] lg:[200px] top-20 right-10 rounded-lg p-3.5 bg-white border border-[#D9D9D9]">
2018
<div className="mb-3">
2119
<p className="text-sm font-semibold text-gray-800 mb-1">담당자</p>
22-
<div className="flex items-center gap-2">
20+
<div className="flex items-center gap-2">
2321
<ProfileIcon
2422
userId={card.assignee.id}
2523
nickname={card.assignee.nickname}
@@ -28,7 +26,6 @@ export default function CardDetail({ card, columnName }: CardDetailProps) {
2826
imgClassName="w-6 h-6"
2927
fontClassName="text-sm"
3028
/>
31-
3229
<span className="text-sm text-gray-700">
3330
{card.assignee.nickname}
3431
</span>
@@ -50,6 +47,8 @@ export default function CardDetail({ card, columnName }: CardDetailProps) {
5047
</div>
5148
</div>
5249
</div>
50+
51+
{/* 상태 + 태그 */}
5352
<div className="flex items-center gap-2 mb-2">
5453
<span
5554
className="rounded-full bg-violet-200 px-3 py-1 text-sm text-violet-800"
@@ -67,25 +66,28 @@ export default function CardDetail({ card, columnName }: CardDetailProps) {
6766
);
6867
})}
6968
</div>
69+
70+
{/* 설명 */}
7071
<p
71-
className="text-gray-700 p-2 break-words overflow-auto"
72-
style={{
73-
width: "470px",
74-
height: "70px",
75-
whiteSpace: "pre-wrap", // 줄바꿈 유지 + 자동 줄바꿈
76-
wordBreak: "break-word", // 긴 단어도 줄바꿈
77-
}}
72+
className="
73+
text-gray-700 p-2 break-words overflow-auto
74+
w-full max-w-[470px] md:max-w-[349px]
75+
whitespace-pre-wrap word-break break-words
76+
h-[70px]
77+
"
7878
>
7979
{card.description}
8080
</p>
81+
82+
{/* 이미지 */}
8183
{card.imageUrl && (
82-
<div className="md:w-420px lg:w-445px">
84+
<div className="md:w-[420px] lg:w-[445px]">
8385
<Image
8486
src={card.imageUrl}
8587
alt="카드 이미지"
8688
width={420}
8789
height={226}
88-
className="rounded-lg object-cover lg:w-[445px] lg:h-[260px] w-[420px] h-[246px] "
90+
className="rounded-lg object-cover lg:w-[445px] lg:h-[260px] w-[420px] h-[246px]"
8991
/>
9092
</div>
9193
)}

src/components/modalDashboard/CardDetailModal.tsx

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import CommentList from "./CommentList";
55
import CardInput from "@/components/modalInput/CardInput";
66
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
77
import { createComment } from "@/api/comment";
8-
import { deleteCard, EditCard } from "@/api/card"; // EditCard API 추가
8+
import { deleteCard, EditCard } from "@/api/card";
99
import type { CardDetailType } from "@/types/cards";
1010
import TaskModal from "@/components/modalInput/TaskModal";
1111
import { useClosePopup } from "@/hooks/useClosePopup";
1212
import { getColumn } from "@/api/columns";
1313
import { useRouter } from "next/router";
1414
import { toast } from "react-toastify";
15+
1516
interface CardDetailModalProps {
1617
card: CardDetailType;
1718
currentUserId: number;
@@ -66,7 +67,6 @@ export default function CardDetailPage({
6667
queryClient.invalidateQueries({ queryKey: ["cards"] });
6768
toast.success("카드가 삭제되었습니다.");
6869
onClose();
69-
7070
setTimeout(() => {
7171
router.reload();
7272
}, 1500);
@@ -90,21 +90,25 @@ export default function CardDetailPage({
9090
const { mutateAsync: updateCardMutate } = useMutation({
9191
mutationFn: (data: Partial<CardDetailType>) => EditCard(cardData.id, data),
9292
onSuccess: (updatedCard) => {
93-
setCardData(updatedCard); // ✅ 서버 응답을 최신 cardData로 설정
94-
queryClient.invalidateQueries({ queryKey: ["cards"] }); // 필요시
93+
setCardData(updatedCard);
94+
queryClient.invalidateQueries({ queryKey: ["cards"] });
9595
},
9696
});
9797

9898
return (
9999
<>
100-
<div className="fixed inset-0 bg-black/30 z-50 flex items-center justify-center">
100+
<div className="fixed inset-0 bg-black/30 z-50 flex items-center justify-center px-4 sm:px-6">
101101
<div
102-
className="relative bg-white rounded-lg shadow-lg w-[730px] h-[763px] flex flex-col
103-
md:w-[678px] lg:w-[730px]"
102+
className="
103+
relative bg-white rounded-lg shadow-lg flex flex-col
104+
w-[327px] h-[710px]
105+
md:w-[678px] md:h-[766px]
106+
lg:w-[730px] lg:h-[763px]
107+
"
104108
>
105-
<div className="absolute top-6 right-8.5 z-30 flex items-center gap-3 mt-1">
106-
{/* 오른쪽 상단 메뉴 */}
107-
<div className="relative">
109+
<div className="flex justify-between items-center px-6 pt-6 pb-2">
110+
<h2 className="font-24sb">{cardData.title}</h2>
111+
<div className="flex items-center gap-3 relative" ref={popupRef}>
108112
<button
109113
onClick={() => setShowMenu((prev) => !prev)}
110114
className="w-7 h-7 flex items-center justify-center hover:cursor-pointer"
@@ -114,7 +118,7 @@ export default function CardDetailPage({
114118
<MoreVertical className="w-8 h-8 text-black cursor-pointer" />
115119
</button>
116120
{showMenu && (
117-
<div className="absolute right-0.5 p-2 w-27 bg-white border border-[#D9D9D9] z-40 rounded-lg">
121+
<div className="absolute right-0 top-10 p-2 w-27 bg-white border border-[#D9D9D9] z-40 rounded-lg">
118122
<button
119123
className="block w-full px-4 py-2 text-base text-gray-800 hover:bg-[#F1EFFD] hover:text-[#5534DA] rounded-sm cursor-pointer"
120124
type="button"
@@ -134,22 +138,20 @@ export default function CardDetailPage({
134138
</button>
135139
</div>
136140
)}
141+
<button onClick={handleClose} title="닫기">
142+
<X className="w-7 h-7 flex items-center justify-center hover:cursor-pointer" />
143+
</button>
137144
</div>
138-
139-
<button onClick={handleClose} title="닫기">
140-
<X className="w-7 h-7 flex items-center justify-center hover:cursor-pointer" />
141-
</button>
142145
</div>
143146

144-
{/* 모달 내부 콘텐츠 */}
145-
<div className="p-6 flex gap-6 overflow-y-auto flex-1 w-[550px] h-[460px]">
147+
{/* 콘텐츠 (스크롤 없음) */}
148+
<div className="px-6 pb-4 flex flex-col gap-6 flex-1 overflow-hidden">
149+
{/* 카드 상세 */}
146150
<CardDetail card={cardData} columnName={columnName} />
147-
</div>
148151

149-
{/* 댓글 입력창 */}
150-
<div className="px-10 pt-2 pb-2">
151-
<p className="ml-1 text-sm font-semibold mb-2">댓글</p>
152-
<div className="w-[450px] h-[110px]">
152+
{/* 댓글 입력 */}
153+
<div className="w-full max-w-[450px]">
154+
<p className="text-sm font-semibold mb-2">댓글</p>
153155
<CardInput
154156
hasButton
155157
small
@@ -159,11 +161,9 @@ export default function CardDetailPage({
159161
placeholder="댓글 작성하기"
160162
/>
161163
</div>
162-
</div>
163164

164-
{/* 댓글 목록 */}
165-
<div className=" max-h-[100px] ml-7 text-base overflow-y-auto scrollbar-hidden">
166-
<div className=" max-h-[50vh]">
165+
{/* 댓글 리스트 (스크롤 가능) */}
166+
<div className="w-full max-w-[450px] text-base max-h-[180px] overflow-y-auto scrollbar-hidden">
167167
<CommentList
168168
cardId={card.id}
169169
currentUserId={currentUserId}
@@ -174,27 +174,25 @@ export default function CardDetailPage({
174174
</div>
175175
</div>
176176

177-
{/* TaskModal 수정 모드 */}
177+
{/* 수정 모달 */}
178178
{isEditModalOpen && (
179179
<TaskModal
180180
mode="edit"
181-
columnId={card.columnId} // ✅ 여기에 columnId 추가!
181+
columnId={card.columnId}
182182
onClose={() => setIsEditModalOpen(false)}
183183
onSubmit={async (data) => {
184184
const matchedColumn = columns.find(
185185
(col) => col.title === data.status
186-
); // title → id
187-
186+
);
188187
await updateCardMutate({
189-
columnId: matchedColumn?.id, // ✅ columnId로 넘기기!
188+
columnId: matchedColumn?.id,
190189
assignee: { ...cardData.assignee, nickname: data.assignee },
191190
title: data.title,
192191
description: data.description,
193192
dueDate: data.deadline,
194193
tags: data.tags,
195194
imageUrl: data.image || undefined,
196195
});
197-
198196
setIsEditModalOpen(false);
199197
router.reload();
200198
}}

src/pages/mydashboard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
PointerSensor,
2222
useSensor,
2323
useSensors,
24+
DragEndEvent,
2425
} from "@dnd-kit/core";
2526
import {
2627
SortableContext,
@@ -119,7 +120,7 @@ export default function MyDashboardPage() {
119120
setSelectedDashboardId(null);
120121
};
121122

122-
const handleDragEnd = (event: any) => {
123+
const handleDragEnd = (event: DragEndEvent) => {
123124
const { active, over } = event;
124125
if (!over || active.id === over.id) return;
125126

0 commit comments

Comments
 (0)