1- import version from "./version" ;
21import ReactMarkdown from "react-markdown" ;
32import C13nImage from "../components/content-pages/markdown/c13n-image" ;
43import c13nLink from "../components/content-pages/markdown/c13n-link" ;
54import c13nLinkRef from "../components/content-pages/markdown/c13n-link-ref" ;
65import c13nText from "../components/content-pages/markdown/c13n-text" ;
76import c13nInlineCode from "../components/content-pages/markdown/c13n-inline-code" ;
87
9- import { checkPayreq } from "../utils/payreq/payreq-tracker" ;
8+ import { checkPayreq , registerPaidPayreq } from "../utils/payreq/payreq-tracker" ;
9+ import { appendToChatHistory } from "../utils/discussion-utils" ;
1010
1111import { NotificationManager } from "react-notifications" ;
1212
@@ -18,7 +18,7 @@ import messageClient from "../services/messageServices";
1818import React from "react" ;
1919
2020const cryptoUtils = require ( "../utils/crypto-utils" ) ;
21- var lightningPayReq = require ( 'bolt11' ) ;
21+ const lightningPayReq = require ( 'bolt11' ) ;
2222
2323/**
2424 * The markdown renderers.
@@ -162,7 +162,7 @@ const c13nPpToDom = (props, payloadObj, myMessage) => {
162162 myMessage ? ' receive' : ' pay'
163163 } < b > { cryptoUtils . msatToCurrentCryptoUnit ( props , invoiceObj ?. millisatoshis ) } { props . selectedCryptoUnit } </ b > </ h3 >
164164 {
165- myMessage ? checkPayreq ( payloadObj . c )
165+ myMessage ? checkMyPayreq ( payloadObj . c )
166166 ?
167167 < h2 style = { { color : 'green' } } > < b > Paid < CheckOutlined /> </ b > </ h2 >
168168 :
@@ -191,6 +191,9 @@ const c13nPpToDom = (props, payloadObj, myMessage) => {
191191 }
192192 if ( res ) {
193193 console . log ( res ) ;
194+ props . selectedDiscussion . lastMsgId = res . sentMessage . id ;
195+ props . selectedDiscussion . lastReadMsgId = res . sentMessage . id ;
196+ appendToChatHistory ( props , res . sentMessage ) ;
194197 }
195198 }
196199 ) ;
@@ -276,24 +279,30 @@ const c13nPpToDom = (props, payloadObj, myMessage) => {
276279 </ div >
277280 ) ;
278281 case "payreq_pay" :
282+ registerPaidPayreq ( payloadObj . c ) ;
279283 return (
280284 < div
281285 style = { {
282- fontSize : '20px ' ,
286+ fontSize : '16px ' ,
283287 border : '2px solid gray' ,
284288 borderRadius : '5px' ,
285289 padding : '15px'
286290 } }
287291 >
288292 Paid
289- < b >
293+ < b
294+ style = { {
295+ paddingLeft : "5px" ,
296+ fontSize : "14px"
297+ } }
298+ >
290299 { `${ payloadObj ?. c ?. substring (
291300 0 ,
292301 5
293302 ) } ...${ payloadObj ?. c ?. substring (
294303 payloadObj ?. c ?. length - 5 ,
295304 payloadObj ?. c ?. length
296- ) } : `}
305+ ) } `}
297306 </ b >
298307 </ div >
299308 ) ;
0 commit comments