11import { useEffect , useState } from "react" ;
22import Image from "next/image" ;
33import { CardType } from "@/types/task" ;
4+ import { CardDetailType } from "@/types/cards" ;
45import Card from "./Card" ;
56import TodoModal from "@/components/modalInput/ToDoModal" ;
67import TodoButton from "@/components/button/TodoButton" ;
@@ -9,6 +10,7 @@ import ColumnDeleteModal from "@/components/columnCard/ColumnDeleteModal";
910import { updateColumn , deleteColumn } from "@/api/columns" ;
1011import { getDashboardMembers } from "@/api/card" ;
1112import { MemberType } from "@/types/users" ;
13+ import CardDetailModal from "../modalDashboard/CardDetailModal" ;
1214import { TEAM_ID } from "@/constants/team" ;
1315
1416type ColumnProps = {
@@ -31,8 +33,12 @@ export default function Column({
3133 const [ members , setMembers ] = useState <
3234 { id : number ; userId : number ; nickname : string } [ ]
3335 > ( [ ] ) ;
36+ const [ selectedCard , setSelectedCard ] = useState < CardDetailType | null > ( null ) ;
37+
38+ const handleCloseDetailModal = ( ) => {
39+ setSelectedCard ( null ) ;
40+ } ;
3441
35- // ✅ 멤버 불러오기
3642 useEffect ( ( ) => {
3743 const fetchMembers = async ( ) => {
3844 try {
@@ -125,12 +131,35 @@ export default function Column({
125131 typeof window !== "undefined" && window . innerWidth < 768 ;
126132 if ( isMobile && index > 0 ) return null ;
127133 return (
128- < Card
134+ < div
129135 key = { task . id }
130- { ...task }
131- imageUrl = { task . imageUrl }
132- assignee = { task . assignee }
133- />
136+ onClick = { ( ) =>
137+ setSelectedCard ( {
138+ id : task . id ,
139+ title : task . title ,
140+ tags : task . tags ,
141+ dueDate : task . dueDate ,
142+ assignee : {
143+ ...task . assignee ,
144+ profileImageUrl : task . assignee . profileImageUrl ?? "" ,
145+ } ,
146+ imageUrl : task . imageUrl ?? null ,
147+ description : task . description ?? "" ,
148+ columnId : task . columnId ,
149+ dashboardId : task . dashboardId ,
150+ status : columnTitle ,
151+ createdAt : new Date ( ) . toISOString ( ) ,
152+ updatedAt : new Date ( ) . toISOString ( ) ,
153+ } )
154+ }
155+ >
156+ < Card
157+ key = { task . id }
158+ { ...task }
159+ imageUrl = { task . imageUrl }
160+ assignee = { task . assignee }
161+ />
162+ </ div >
134163 ) ;
135164 } ) }
136165 </ div >
@@ -166,6 +195,14 @@ export default function Column({
166195 onClose = { ( ) => setIsDeleteModalOpen ( false ) }
167196 onDelete = { handleDeleteColumn }
168197 />
198+ { selectedCard && (
199+ < CardDetailModal
200+ card = { selectedCard }
201+ onClose = { handleCloseDetailModal }
202+ currentUserId = { selectedCard . assignee . id }
203+ dashboardId = { dashboardId }
204+ />
205+ ) }
169206 </ div >
170207 ) ;
171208}
0 commit comments