@@ -4,16 +4,15 @@ import React, { useEffect, useState } from 'react';
4
4
import { StatusBadge } from '../statusBadge/StatusBadge' ;
5
5
import { MdOutlineDeliveryDining } from 'react-icons/md' ;
6
6
import { FaMapLocationDot } from 'react-icons/fa6' ;
7
-
7
+ import { motion } from 'framer-motion' ;
8
8
import { TiDeleteOutline } from 'react-icons/ti' ;
9
9
import { useAppDispatch } from '@/hooks' ;
10
-
11
10
import Notification from '../modal/Notification' ;
12
-
13
11
import Link from 'next/link' ;
14
12
import MapModal from '../modal/MapModal' ;
15
13
import { updateDelivery } from '@/redux/features/deliveries/deliveriesThunk' ;
16
14
15
+
17
16
interface CardProps {
18
17
deliveryID : string ;
19
18
deliveryAddress : string ;
@@ -56,6 +55,8 @@ export const DeliveryCard: React.FC<CardProps> = ({
56
55
} , [ ] ) ;
57
56
58
57
const dispatch = useAppDispatch ( ) ;
58
+ const router = useRouter ( ) ;
59
+
59
60
60
61
const handleDelete = ( ) => {
61
62
if ( status === 'pending' ) {
@@ -80,24 +81,28 @@ export const DeliveryCard: React.FC<CardProps> = ({
80
81
< div className = 'bg-white border border-primary rounded-2xl p-1 flex justify-center items-center space-x-2 text-primary relative h-[90px] mb-2' >
81
82
< Link href = { `detailed-view/${ deliveryID } ` } >
82
83
< div className = 'ml-1 w-1/8' >
83
- < span className = { colorMap [ status ] } >
84
- < MdOutlineDeliveryDining size = { 40 } />
85
- </ span >
84
+ < motion . div whileHover = { { scale : 1.1 } } >
85
+ < span className = { colorMap [ status ] } >
86
+ < MdOutlineDeliveryDining size = { 40 } />
87
+ </ span >
88
+ </ motion . div >
86
89
</ div >
87
90
</ Link >
88
91
< div className = 'flex-grow flex-col space-y-1 border-l border-dashed border-gray-400 mx-1 px-2 relative group' >
89
92
< div className = 'flex justify-between items-start' >
90
93
< h3 className = 'text-sm md:text-lg font-semibold' >
91
94
{ deliveryIdFriendly }
92
95
</ h3 >
93
- < span className = { colorMap [ status ] } >
94
- < FaMapLocationDot
95
- size = { 20 }
96
- color = '#22577A'
97
- className = 'ml-2 mr-32 md:mr-60 text-gray-500 cursor-pointer'
98
- onClick = { ( ) => setShowMapModal ( true ) }
99
- />
100
- </ span >
96
+ < motion . div whileHover = { { scale : 1.1 } } >
97
+ < span className = { colorMap [ status ] } >
98
+ < FaMapLocationDot
99
+ size = { 20 }
100
+ color = '#22577A'
101
+ className = 'ml-2 mr-32 md:mr-60 text-gray-500 cursor-pointer'
102
+ onClick = { ( ) => setShowMapModal ( true ) }
103
+ />
104
+ </ span >
105
+ </ motion . div >
101
106
</ div >
102
107
103
108
< div className = 'text-sm md:text-lg mr-[80px]' >
@@ -110,17 +115,26 @@ export const DeliveryCard: React.FC<CardProps> = ({
110
115
</ div >
111
116
</ div >
112
117
</ div >
113
- < div className = 'flex flex-col align-bottom absolute top-4 right-1' >
118
+ < div className = 'flex flex-col align-bottom absolute top-4 z-10 right-1' >
114
119
< StatusBadge status = { status } />
120
+
121
+ { ( status === 'pending' || status === 'on-course' ) && (
122
+
115
123
{ status = = = 'pending' || status === 'on-course' ? (
124
+
116
125
< div className = 'mt-2 flex flex-col justify-end' >
117
- < button
118
- className = 'flex items-center justify-end text-sm md:text-lg text-red-500 hover:text-red-700'
119
- onClick = { ( ) => setShowModal ( true ) }
120
- >
121
- Cancel
122
- < TiDeleteOutline color = 'red' size = { 30 } />
123
- </ button >
126
+ < motion . div whileHover = { { scale : 1.1 } } >
127
+ < button
128
+ className = 'flex items-center justify-end text-sm md:text-lg text-red-500 hover:text-red-700'
129
+ onClick = { ( ) => setShowModal ( true ) }
130
+ >
131
+ { status === 'pending'
132
+ ? 'Cancel'
133
+ : 'Postpone' }
134
+
135
+ < TiDeleteOutline color = 'red' size = { 30 } />
136
+ </ button >
137
+ </ motion . div >
124
138
</ div >
125
139
) : (
126
140
< > </ >
@@ -130,10 +144,11 @@ export const DeliveryCard: React.FC<CardProps> = ({
130
144
131
145
< Notification
132
146
showModal = { showModal}
147
+
133
148
buttonText = { buttonText}
134
149
message = { message}
135
150
isSuccess = { false}
136
- onNotSuccess = { handleDelete }
151
+ onNotSuccess = { handleAction }
137
152
onCloseModal = { ( ) => setShowModal ( false ) }
138
153
/ >
139
154
< MapModal
0 commit comments