mirror of
https://github.com/Permissionless-Software-Foundation/psf-memo.git
synced 2026-09-21 16:52:01 -07:00
Keep the like/tip modal open after a successful like and show a broadcast result instead of closing: the success message, the like transaction id, and a link to that transaction on bch.loping.net that opens in a new tab. The like count and filled heart update immediately, and dismissing the result closes the modal. The result state lives on the testable LikeTipPage controller; a server-renderable LikeResult component backs the modal and the acceptance adapter, with acceptance step handlers for the new wording. By coder.
21 lines
722 B
JavaScript
21 lines
722 B
JavaScript
/*
|
|
Acceptance rendering adapter for the like broadcast result.
|
|
|
|
Renders the same LikeResult component the browser uses to a static HTML
|
|
string, so acceptance assertions can inspect the success message, the like
|
|
transaction id, and the block explorer link without running a browser.
|
|
*/
|
|
|
|
'use strict'
|
|
|
|
const React = require('react')
|
|
const ReactDOMServer = require('react-dom/server')
|
|
const LikeResult = require('../../src/components/post-feed/like-result')
|
|
|
|
function renderLikeResult ({ txid = '', message = '', explorerUrl = '' } = {}) {
|
|
const element = React.createElement(LikeResult, { txid, message, explorerUrl })
|
|
return ReactDOMServer.renderToStaticMarkup(element)
|
|
}
|
|
|
|
module.exports = { renderLikeResult }
|