|
1 | 1 | import React from "react";
|
2 |
| -import { useSelector } from "react-redux"; |
| 2 | +import { useDispatch } from "react-redux"; |
| 3 | +import { |
| 4 | + refuseInvitation, |
| 5 | + acceptInvitation, |
| 6 | +} from "../../redux/modules/InvitationSlice"; |
3 | 7 |
|
4 | 8 | const InvitationCard = ({ invit }) => {
|
5 | 9 | console.log("뭘까요?", invit);
|
| 10 | + console.log("뭘까요?2", invit.invitees[0].username); |
| 11 | + |
| 12 | + const dispatch = useDispatch(); |
| 13 | + |
| 14 | + const onRefuseHanddler = (e) => { |
| 15 | + e.stopPropagation(); |
| 16 | + const result = window.confirm("거절?"); |
| 17 | + if (result) { |
| 18 | + return dispatch(refuseInvitation(invit.eventId)); |
| 19 | + } |
| 20 | + }; |
| 21 | + |
| 22 | + const onAcceptHanddler = (e) => { |
| 23 | + e.stopPropagation(); |
| 24 | + const result = window.confirm("수락?"); |
| 25 | + if (result) { |
| 26 | + return dispatch(acceptInvitation(invit.eventId)); |
| 27 | + } |
| 28 | + }; |
6 | 29 |
|
7 | 30 | return (
|
8 | 31 | <div>
|
9 |
| - <div className="rounded-[10px] mx-[20px] w-[335px] h-[184px] bg-gray-500"> |
10 |
| - <div className="flex gap-[50px] relative top-[16px] "> |
11 |
| - <div className="flex ml-[23px] gap-[20px]"> |
| 32 | + <div className="rounded-[10px] my-[10px] mx-[20px] w-[335px] h-[184px] bg-gray-500"> |
| 33 | + <div className="flex gap-[50px] relative top-[16px]"> |
| 34 | + <div className="flex ml-[23px] gap-[20px]"> |
12 | 35 | <span className="text-sm">{invit.date}</span>
|
13 | 36 | <span className="text-sm">{invit.time}</span>
|
14 | 37 | </div>
|
15 |
| - <span className="text-sm">from.{invit.invitees.username}</span> |
| 38 | + {invit.invitees.map((invitees) => { |
| 39 | + console.log("이름 맵", invitees); |
| 40 | + return <span className="text-sm">from.{invitees.username}</span>; |
| 41 | + })} |
16 | 42 | </div>
|
17 |
| - <div className="ml-[23px] relative top-[20px]"> |
18 |
| - <div className="p-2 text-md"> |
19 |
| - 일이삼사오육칠팔구십일이삼사오육칠팔구십 |
20 |
| - </div> |
| 43 | + <div className="mx-[23px] relative top-[20px]"> |
| 44 | + <div className="h-[58px] truncate text-md">{invit.subject}</div> |
21 | 45 | </div>
|
22 |
| - <div className="flex relative top-[44px] h-[57px] text-center items-center border-t-[1px] border-[#BBD7FF] border-solid"> |
23 |
| - <div className="flex items-center justify-center flex-1 h-full text-center text-md"> |
| 46 | + <div className="flex relative top-[50px] h-[57px] text-center items-center border-t-[1px] border-[#BBD7FF] border-solid"> |
| 47 | + <div |
| 48 | + onClick={onRefuseHanddler} |
| 49 | + className="flex items-center justify-center flex-1 h-full text-center text-md" |
| 50 | + > |
24 | 51 | 거절
|
25 | 52 | </div>
|
26 |
| - <div className="flex text-center justify-center items-center flex-1 border-l-[1px] h-full border-[#BBD7FF] border-solid text-md"> |
| 53 | + <div |
| 54 | + onClick={onAcceptHanddler} |
| 55 | + className="flex text-center justify-center items-center flex-1 border-l-[1px] h-full border-[#BBD7FF] border-solid text-md" |
| 56 | + > |
27 | 57 | 수락
|
28 | 58 | </div>
|
29 | 59 | </div>
|
|
0 commit comments