Skip to content

Commit

Permalink
Add status header to homepage (ordinals#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Oct 5, 2022
1 parent 49308f0 commit e9a7c4b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,12 +1054,14 @@ mod tests {
".*<title>Ordinals</title>.*<h1>Ordinals</h1>
<nav>.*</nav>
.*
<h2>Latest Blocks</h2>
<h2>Status</h2>
<dl>
<dt>cycle</dt><dd>0</dd>
<dt>epoch</dt><dd>0</dd>
<dt>period</dt><dd>0</dd>
<dt>block</dt><dd>1</dd>
</dl>
<h2>Latest Blocks</h2>
<ol start=1 reversed class='blocks monospace'>
<li><a href=/block/[[:xdigit:]]{64} class=uncommon>[[:xdigit:]]{64}</a></li>
<li><a href=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/block/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f class=mythic>000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f</a></li>
Expand Down
4 changes: 3 additions & 1 deletion src/subcommand/server/templates/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ mod tests {
<nav>.*</nav>
<h2>Search</h2>
<form action=/search method=get>.*</form>
<h2>Latest Blocks</h2>
<h2>Status</h2>
<dl>
<dt>cycle</dt><dd>1</dd>
<dt>epoch</dt><dd>6</dd>
<dt>period</dt><dd>625</dd>
<dt>block</dt><dd>1260001</dd>
</dl>
<h2>Latest Blocks</h2>
<ol start=1260001 reversed class='blocks monospace'>
<li><a href=/block/1{64} class=uncommon>1{64}</a></li>
<li><a href=/block/0{64} class=legendary>0{64}</a></li>
Expand Down
4 changes: 3 additions & 1 deletion templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ <h2>Search</h2>
<input autocapitalize=off autocomplete=off autocorrect=off autofocus name=query spellcheck=false type=text>
<input type=submit>
</form>
<h2>Latest Blocks</h2>
%% if let Some(starting_ordinal) = self.starting_ordinal {
<h2>Status</h2>
<dl>
<dt>cycle</dt><dd>{{starting_ordinal.cycle()}}</dd>
<dt>epoch</dt><dd>{{starting_ordinal.epoch()}}</dd>
<dt>period</dt><dd>{{starting_ordinal.period()}}</dd>
<dt>block</dt><dd>{{starting_ordinal.height()}}</dd>
</dl>
%% }
<h2>Latest Blocks</h2>
<ol start={{self.last}} reversed class='blocks monospace'>
%% for (rarity, hash) in &self.blocks {
<li><a href=/block/{{hash}} class={{rarity}}>{{hash}}</a></li>
Expand Down

0 comments on commit e9a7c4b

Please sign in to comment.