Show a brief publishing note that fades out after a few seconds.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -37,16 +37,8 @@ export interface MintRef {
|
||||
}
|
||||
|
||||
export interface CardOptions {
|
||||
/** Adds the "propagating to relays" note, for a review published in this session. */
|
||||
/** Adds the transient publishing note for a review published in this session. */
|
||||
propagating?: boolean;
|
||||
/**
|
||||
* How many relays took it, when the review was published in this session.
|
||||
*
|
||||
* Only said out loud when some relay refused: "published to 2 of 4" is a fact the
|
||||
* author can act on (try again later, and it is already on the network), where a
|
||||
* clean 4 of 4 is just noise on the card.
|
||||
*/
|
||||
publishedTo?: { accepted: number; total: number } | null;
|
||||
/** Adds a link to the mint being reviewed. */
|
||||
mint?: MintRef | null;
|
||||
/**
|
||||
@@ -303,15 +295,9 @@ function actionsHtml(review: LoadedReview, f: Formatters, options: CardOptions):
|
||||
/* ---------- the card ---------- */
|
||||
|
||||
export function reviewHtml(review: LoadedReview, f: Formatters, options: CardOptions = {}): string {
|
||||
// The note pulses gently while the review is still in flight. It stops the moment
|
||||
// the relays echo the review back, because then the card is redrawn without it.
|
||||
const relays = options.publishedTo;
|
||||
const partial =
|
||||
relays && relays.accepted < relays.total
|
||||
? f.t('reviews.publishedPartial', { accepted: relays.accepted, total: relays.total })
|
||||
: f.t('reviews.published');
|
||||
// The note pulses gently for a few seconds after a review is published.
|
||||
const propagating = options.propagating
|
||||
? `<p class="rev-note propagating">${escapeHtml(partial)} ${escapeHtml(f.t('reviews.propagating'))}</p>`
|
||||
? `<p class="rev-note propagating">${escapeHtml(f.t('reviews.propagating'))}</p>`
|
||||
: '';
|
||||
|
||||
// The anchor id only for real event ids, so `#review-{id}` deep links resolve and
|
||||
|
||||
Reference in New Issue
Block a user