From 4dbcd4661b4c98ff811191e167a3d8f5311cbe0a Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 22 Oct 2024 15:46:42 -0700 Subject: [PATCH] Only show rune mint progress while rune is mintable --- src/templates/rune.rs | 43 +++++++++++++++++++++++++++++++++++++++++++ tests/lib.rs | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/templates/rune.rs b/src/templates/rune.rs index e82ce3db15..3d1671b70d 100644 --- a/src/templates/rune.rs +++ b/src/templates/rune.rs @@ -10,6 +10,10 @@ pub struct RuneHtml { impl RuneHtml { fn mint_progress(&self) -> Option { + if !self.mintable { + return None; + } + let cap = self.entry.terms?.cap?; if cap == 0 { @@ -284,6 +288,45 @@ mod tests { }), }, ".* +
mintable
+
false
+ .*" + ); + + assert_regex_match!( + RuneHtml { + entry: RuneEntry { + block: 0, + burned: 0, + divisibility: 0, + etching: Txid::all_zeros(), + mints: 5555, + terms: Some(Terms { + cap: Some(10000), + offset: (None, None), + height: (None, None), + amount: None, + }), + number: 0, + premine: 0, + spaced_rune: SpacedRune { + rune: Rune(0), + spacers: 0 + }, + symbol: None, + timestamp: 0, + turbo: false, + }, + id: RuneId { block: 0, tx: 0 }, + mintable: true, + parent: Some(InscriptionId { + txid: Txid::all_zeros(), + index: 0, + }), + }, + ".* +
mintable
+
true
progress
55.55%
.*" ); diff --git a/tests/lib.rs b/tests/lib.rs index 6f1df9cef9..e6f9647103 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -327,7 +327,7 @@ fn batch(core: &mockcore::Handle, ord: &TestServer, batchfile: batch::File) -> E mint_definition.push("
mintable
".into()); mint_definition.push(format!("
{mintable}
")); - if terms.cap > 0 { + if mintable { mint_definition.push("
progress
".into()); mint_definition.push("
0%
".into()); }