@@ -60,6 +60,7 @@ export const ChatPrompt = ({
6060 const [ undoSentButton , setUndoSentButton ] = useState < boolean > ( false ) ;
6161 const [ audit , setAudit ] = useState < boolean > ( false ) ;
6262 const [ peerPubKey , setPeerPubKey ] = useState < string > ( ) ;
63+ const [ enableCollaborativeButton , setEnableCollaborativeButton ] = useState < boolean > ( false ) ;
6364 const [ enableDisputeButton , setEnableDisputeButton ] = useState < boolean > ( false ) ;
6465 const [ enableDisputeTime , setEnableDisputeTime ] = useState < Date > ( new Date ( order . expires_at ) ) ;
6566 const [ text , setText ] = useState < string > ( '' ) ;
@@ -92,6 +93,8 @@ export const ChatPrompt = ({
9293
9394 if ( order . status === 9 ) {
9495 // No fiat sent yet
96+ setEnableCollaborativeButton ( true ) ;
97+
9598 if ( order . is_buyer ) {
9699 setSentButton ( true ) ;
97100 setReceivedButton ( false ) ;
@@ -117,6 +120,8 @@ export const ChatPrompt = ({
117120 }
118121 } else if ( order . status === 10 ) {
119122 // Fiat has been sent already
123+ setEnableCollaborativeButton ( false ) ;
124+
120125 if ( order . is_buyer ) {
121126 setSentButton ( false ) ;
122127 setUndoSentButton ( true ) ;
@@ -301,21 +306,28 @@ export const ChatPrompt = ({
301306 </ Grid >
302307 </ Tooltip >
303308
304- < Grid item xs = { 1 } style = { { width : '100%' , marginTop : 20 } } >
305- < Button
306- fullWidth
307- onClick = { ( ) => {
308- setOpenOrderOptions ( false ) ;
309- onClickCollabCancel ( ) ;
310- } }
311- size = 'large'
312- variant = 'contained'
313- color = 'secondary'
314- startIcon = { < Handshake /> }
315- >
316- { t ( 'Collaborative Cancel' ) }
317- </ Button >
318- </ Grid >
309+ < Tooltip
310+ placement = 'top'
311+ enterTouchDelay = { 0 }
312+ title = { t ( "Orders can't be cancelled if fiat has been sent." ) }
313+ >
314+ < Grid item xs = { 1 } style = { { width : '100%' , marginTop : 20 } } >
315+ < Button
316+ fullWidth
317+ onClick = { ( ) => {
318+ setOpenOrderOptions ( false ) ;
319+ onClickCollabCancel ( ) ;
320+ } }
321+ size = 'large'
322+ variant = 'contained'
323+ color = 'secondary'
324+ startIcon = { < Handshake /> }
325+ disabled = { ! enableCollaborativeButton }
326+ >
327+ { t ( 'Collaborative Cancel' ) }
328+ </ Button >
329+ </ Grid >
330+ </ Tooltip >
319331 </ Grid >
320332 </ DialogContent >
321333 </ DialogContent >
0 commit comments