Skip to content

Commit b681ec3

Browse files
authored
[Fix] TaskModal: 분리 전으로 롤백
[Fix] TaskModal: 분리 전으로 롤백
2 parents 11ca1db + 1966381 commit b681ec3

File tree

15 files changed

+171
-243
lines changed

15 files changed

+171
-243
lines changed

src/api/columns.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import axiosInstance from "./axiosInstance";
33
import { apiRoutes } from "./apiRoutes";
44
import { TEAM_ID } from "@/constants/team";
55

6-
// 칼럼 생성
6+
// 칼럼 생성
77
export const createColumn = async ({
88
title,
99
dashboardId,
@@ -19,11 +19,8 @@ export const createColumn = async ({
1919
return res.data;
2020
};
2121

22-
export const getColumns = async ({
23-
dashboardId,
24-
}: {
25-
dashboardId: number;
26-
}): Promise<ColumnType[]> => {
22+
// 칼럼 목록 조회
23+
export const getColumns = async ({ dashboardId }: { dashboardId: number }) => {
2724
const res = await axiosInstance.get(apiRoutes.columns(), {
2825
params: {
2926
dashboardId,
@@ -32,7 +29,8 @@ export const getColumns = async ({
3229

3330
return res.data;
3431
};
35-
// 칼럼 수정
32+
33+
// 칼럼 수정
3634
export const updateColumn = async ({
3735
columnId,
3836
title,
@@ -46,8 +44,22 @@ export const updateColumn = async ({
4644
return res.data;
4745
};
4846

49-
// 칼럼 삭제
47+
// 칼럼 삭제
5048
export const deleteColumn = async ({ columnId }: { columnId: number }) => {
5149
const res = await axiosInstance.delete(apiRoutes.columnDetail(columnId));
5250
return res;
5351
};
52+
53+
export const getColumn = async ({
54+
dashboardId,
55+
}: {
56+
dashboardId: number;
57+
columnId: number;
58+
}) => {
59+
const res = await axiosInstance.get(apiRoutes.columns(), {
60+
params: {
61+
dashboardId,
62+
},
63+
});
64+
return res.data.data;
65+
};

src/components/columnCard/Column.tsx

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
// Column.tsx
12
import { useEffect, useState, useRef } from "react";
23
import Image from "next/image";
3-
import { CardType, ColumnType } from "@/types/task";
4+
import { CardType } from "@/types/task";
45
import TaskModal from "@/components/modalInput/TaskModal";
56
import { TodoButton, ShortTodoButton } from "@/components/button/TodoButton";
67
import ColumnDeleteModal from "@/components/columnCard/ColumnDeleteModal";
@@ -23,7 +24,6 @@ type ColumnProps = {
2324
createdByMe: boolean;
2425
columnDelete: (columnId: number) => void;
2526
fetchColumnsAndCards: () => void;
26-
columns: ColumnType[];
2727
};
2828

2929
export default function Column({
@@ -34,7 +34,6 @@ export default function Column({
3434
createdByMe,
3535
columnDelete,
3636
fetchColumnsAndCards,
37-
columns,
3837
}: ColumnProps) {
3938
const { canEditColumns } = useDashboardPermission(dashboardId, createdByMe);
4039

@@ -57,8 +56,10 @@ export default function Column({
5756

5857
const maxColumnTitleLength = 15;
5958

59+
// 카드리스트의 스크롤을 칼럼 영역으로 이동
6060
const scrollRef = useRef<HTMLDivElement | null>(null);
6161

62+
// ✅ 멤버 불러오기
6263
useEffect(() => {
6364
const fetchMembers = async () => {
6465
try {
@@ -85,6 +86,7 @@ export default function Column({
8586
toast.error("칼럼 제목을 입력해 주세요.");
8687
return;
8788
}
89+
setIsColumnModalOpen(false);
8890

8991
try {
9092
const updated = await updateColumn({ columnId, title: newTitle });
@@ -131,17 +133,23 @@ export default function Column({
131133
{/* 칼럼 헤더 */}
132134
<div className="shrink-0 mb-2">
133135
<div className="flex items-center justify-between">
134-
{/* 타이틀 + 개수 */}
136+
{/* 왼쪽: 타이틀 + 카드 개수 */}
135137
<div className="flex items-center gap-2">
136138
<Image src="/svgs/ellipse.svg" alt="circle" width={8} height={8} />
137-
<h2 className="text-black3 text-[16px] md:text-[18px] font-bold break-words sm:max-w-none max-w-[90px]">
139+
<h2
140+
className="text-black3 text-[16px] md:text-[18px] font-bold
141+
break-words sm:max-w-none max-w-[90px]"
142+
>
138143
{columnTitle}
139144
</h2>
140-
<span className="flex items-center justify-center leading-none w-[20px] h-[20px] bg-white text-[var(--primary)] font-14m rounded-[4px]">
145+
<span
146+
className="flex items-center justify-center leading-none
147+
w-[20px] h-[20px] bg-white text-[var(--primary)] font-14m rounded-[4px]"
148+
>
141149
{tasks.length}
142150
</span>
143151
</div>
144-
{/* 버튼 */}
152+
{/* 오른쪽: 생성 버튼 + 설정 버튼 */}
145153
<div className="flex items-center gap-2">
146154
<div
147155
onClick={() => {
@@ -191,8 +199,9 @@ export default function Column({
191199
</div>
192200
</div>
193201

194-
{/* 카드 리스트 */}
202+
{/* 스크롤바 컨테이너 */}
195203
<div className="flex flex-col lg:pl-[21px] overflow-y-auto w-full lg:w-[357px] rounded-md bg-[#F5F2FC]">
204+
{/* 카드 리스트 */}
196205
<div
197206
className="flex-1 overflow-y-auto overflow-x-hidden"
198207
style={{ scrollbarGutter: "stable" }}
@@ -208,7 +217,7 @@ export default function Column({
208217
</div>
209218
</div>
210219

211-
{/* 카드 생성 */}
220+
{/* 카드 생성 모달 */}
212221
{isTaskModalOpen && (
213222
<TaskModal
214223
mode="create"
@@ -217,18 +226,14 @@ export default function Column({
217226
dashboardId={dashboardId}
218227
columnId={columnId}
219228
members={members}
220-
columns={columns}
221229
initialData={{
222230
status: columnTitle,
223231
}}
224-
onSubmit={() => {
225-
fetchColumnsAndCards();
226-
setIsTaskModalOpen(false);
227-
}}
232+
onSubmit={fetchColumnsAndCards}
228233
/>
229234
)}
230235

231-
{/* 칼럼 수정 */}
236+
{/* 칼럼 관리 모달 */}
232237
{isColumnModalOpen && (
233238
<FormModal
234239
title="칼럼 이름 수정"
@@ -260,25 +265,25 @@ export default function Column({
260265
/>
261266
)}
262267

268+
{/* 칼럼 삭제 확인 모달 */}
263269
<ColumnDeleteModal
264270
isOpen={isDeleteModalOpen}
265271
onClose={() => setIsDeleteModalOpen(false)}
266272
onDelete={handleDeleteColumn}
267273
/>
268274

269-
{/* 카드 상세 */}
275+
{/* 카드 상세 모달 */}
270276
{isCardDetailModalOpen && selectedCard && (
271277
<CardDetailModal
272278
card={selectedCard}
273279
currentUserId={selectedCard.assignee.id}
274280
dashboardId={dashboardId}
275-
createdByMe={createdByMe}
276281
onClose={() => {
277282
setIsCardDetailModalOpen(false);
278283
setSelectedCard(null);
279284
}}
280285
onChangeCard={fetchColumnsAndCards}
281-
columns={columns}
286+
createdByMe={createdByMe}
282287
/>
283288
)}
284289
</div>

src/components/modalDashboard/CardDetailModal.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { useCardDetailState } from "@/hooks/useCardDetailState";
1212
import { useCardDetail } from "@/hooks/useCardDetail";
1313
import { getCardDetail } from "@/api/card";
1414
import type { CardDetailType } from "@/types/cards";
15-
import type { ColumnType } from "@/types/task";
1615

1716
interface CardDetailModalProps {
1817
card: CardDetailType;
@@ -21,8 +20,6 @@ interface CardDetailModalProps {
2120
createdByMe: boolean;
2221
onClose: () => void;
2322
onChangeCard?: () => void;
24-
columns: ColumnType[];
25-
currentUserId?: number;
2623
}
2724

2825
export default function CardDetailPage({
@@ -31,7 +28,6 @@ export default function CardDetailPage({
3128
createdByMe,
3229
onClose,
3330
onChangeCard,
34-
columns,
3531
}: CardDetailModalProps) {
3632
const { canEditCards } = useDashboardPermission(dashboardId, createdByMe);
3733
const { cardData, setCardData, columnName, members } = useCardDetailState(
@@ -153,7 +149,6 @@ export default function CardDetailPage({
153149
</div>
154150
</div>
155151

156-
{/* 수정 모달 */}
157152
{isEditModalOpen && (
158153
<TaskModal
159154
isOpen={true}
@@ -162,7 +157,6 @@ export default function CardDetailPage({
162157
cardId={cardData.id}
163158
dashboardId={dashboardId}
164159
members={members}
165-
columns={columns}
166160
onClose={() => setIsEditModalOpen(false)}
167161
onSubmit={async () => {
168162
try {
@@ -177,8 +171,7 @@ export default function CardDetailPage({
177171
}
178172
}}
179173
initialData={{
180-
status:
181-
columns.find((col) => col.id === cardData.columnId)?.title ?? "",
174+
status: columnName,
182175
assignee: cardData.assignee.nickname,
183176
title: cardData.title,
184177
description: cardData.description,

src/components/modalDashboard/UpdateComment.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// ✅ UpdateComment.tsx
12
import { useState } from "react";
23
import { useQueryClient } from "@tanstack/react-query";
34
import { deleteComment, updateComment } from "@/api/comment";

src/components/modalDashboard/formatDate.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// src/utils/formatDate.ts (혹은 components 폴더 내)
2+
13
export default function formatDate(
24
dateString: string,
35
includeTime: boolean = true,

src/components/modalInput/AssigneeSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from "react";
2-
import RandomProfile from "@/components/common/RandomProfile";
2+
import RandomProfile from "../common/RandomProfile";
33

44
interface User {
55
id: number;

src/components/modalInput/CardInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ export default function CardInput({
4141
className
4242
)}
4343
style={{
44-
overflowY: "auto",
44+
overflowY: "auto", // 내용이 넘치면 스크롤 생성
4545
wordWrap: "break-word",
4646
whiteSpace: "pre-wrap",
47-
boxSizing: "border-box",
47+
boxSizing: "border-box", // padding과 border를 높이에 포함
4848
}}
4949
/>
5050
{hasButton && (

src/components/modalInput/ModalImage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface ModalImageProps {
88
label: string;
99
columnId: number;
1010
defaultImageUrl?: string;
11-
onImageSelect: (imageUrl: string) => void;
11+
onImageSelect: (imageUrl: string) => void; // ✅ string만 넘김
1212
}
1313

1414
export default function ModalImage({
@@ -43,7 +43,7 @@ export default function ModalImage({
4343
};
4444
reader.readAsDataURL(file);
4545

46-
// 업로드 후 URL 전달
46+
// 업로드 후 URL 전달
4747
try {
4848
const imageUrl = await uploadCardImage({
4949
columnId,

src/components/modalInput/ModalTextarea.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface ModalTextareaProps {
66
required?: boolean;
77
isButton: boolean;
88
small?: boolean;
9-
defaultValue?: string;
9+
defaultValue?: string; // ✅ 추가됨
1010
onTextChange: (value: string) => void;
1111
onButtonClick?: () => void;
1212
}
@@ -35,6 +35,7 @@ export default function ModalTextarea({
3535
}
3636
};
3737

38+
// ✅ 초기 defaultValue 기준으로 height 조절
3839
useEffect(() => {
3940
const textarea = textareaRef.current;
4041
if (textarea) {
@@ -47,7 +48,7 @@ export default function ModalTextarea({
4748
<div className="inline-flex flex-col items-start gap-2.5 w-full">
4849
<label
4950
htmlFor="comment"
50-
className="font-medium text-black3 text-[14px] sm:text-[18px]"
51+
className="font-medium text-black3 text-[16px] sm:text-[18px]"
5152
>
5253
{label} {required && <span className="text-[var(--primary)]"> *</span>}
5354
</label>
@@ -70,7 +71,7 @@ export default function ModalTextarea({
7071
onChange={handleTextareaChange}
7172
className={`
7273
w-full resize-none rounded-md border-none px-4 py-3
73-
text-black3 text-[14px] sm:text-[16px] font:normal
74+
text-black3 text-[16px] sm:text-[18px] font:normal
7475
outline-none bg-transparent overflow-hidden
7576
${small ? "h-[50px]" : "min-h-[110px]"}
7677
`}

0 commit comments

Comments
 (0)