consensus/cmd/web/views/tpl_shares.qtpl
DataHoarder 55661a12da
All checks were successful
continuous-integration/drone/push Build is passing
WIP: Bootstrap-based responsive interface, CSS only
2024-03-20 13:37:26 +01:00

96 lines
4.9 KiB
Plaintext

{% import "git.gammaspectra.live/P2Pool/p2pool-observer/cmd/index" %}
{% func TemplateShares(ctx *GlobalRequestContext, shares []*index.SideBlock, isMiner bool, efforts *[]float64) %}
{% code shares = slice_modulo(shares, 12) %}
<div class="container">
<div class="row">
<div class="row row-cols-1 row-cols-sm-2 row-cols-lg-3 row-cols-xl-4 row-cols-xxl-6 gx-0 gy-2">
{% for i, s := range shares %}
<div class="col">
<div class="card h-100 rounded-0 {% if s.MinedMainAtHeight %}text-bg-success{% endif %}">
<div class="card-header p-1 container text-center">
<div class="row row-cols-2 g-0">
<div class="col" title="{%= hex(ctx, s.TemplateId) %}">
<strong><a href="/share/{%= hex(ctx, s.TemplateId) %}">#{%dul s.SideHeight %}</a></strong>
</div>
<div class="col" title="{%= hex(ctx, s.MainId) %}">
{% if s.MinedMainAtHeight %}
<small class="text-body-secondary">
<a href="/b/{%s benc(s.MainHeight) %}">
<img src="/assets/monero-symbol.svg" alt="Monero" width="21" height="21" class="d-inline-block align-text-top"/>
<span class="d-inline-block align-text-top">{%dul s.MainHeight %}</span>
</a>
</small>
{% else %}
<small class="text-body-secondary">{%dul s.MainHeight %}</small>
{% endif %}
</div>
</div>
</div>
<div class="card-body p-1 container text-center">
<div class="row gy-1 gx-0">
{% if !isMiner %}
{%= TemplateGridMinerWithClass(ctx, s.MinerAddress, s.MinerAlias, "col col-12 found-by", 4, "Found by ") %}
{% endif %}
<div class="col col-12">
P2Pool Id <span class="mono smaller"><a href="/share/{%= hex(ctx, s.TemplateId) %}" title="{%= hex(ctx, s.TemplateId) %}">{%= shorten(ctx, s.TemplateId, 6) %}</a></span>
</div>
<div class="col col-12">
Mined by <strong>{%= software_info(s.SoftwareId, s.SoftwareVersion) %}</strong>
</div>
<div class="col col-12" title="{%dul side_block_weight(s, s.SideHeight, ctx.Consensus.ChainWindowSize, ctx.Consensus) %}">
Weight {%s si_units(side_block_weight(s, s.SideHeight, ctx.Consensus.ChainWindowSize, ctx.Consensus), 2) %}
</div>
<div class="col col-12" title="Valuation">
<strong>{%= side_block_valuation(s, ctx.Consensus) %}</strong>
</div>
<div class="col col-12 btn-group btn-group-sm">
{% if s.MinedMainAtHeight %}
<a class="btn btn-primary" href="/c/{%s benc(s.SideHeight) %}">Coinbase</a>
<a class="btn btn-primary" href="/share/{%= hex(ctx, s.TemplateId) %}">Details</a>
{% else %}
<a class="btn btn-outline-secondary" href="/share/{%= hex(ctx, s.TemplateId) %}">Details</a>
{% endif %}
</div>
</div>
</div>
<div class="card-footer p-0 container text-center">
{% if efforts == nil %}
<div class="row row-cols-1 g-0">
{% else %}
<div class="row row-cols-2 g-0">
{% endif %}
<div class="col" title="{%s utc_date(s.Timestamp) %}">
<small class="text-body-secondary">{%s time_elapsed_short(s.Timestamp) %}</small>
</div>
{% if efforts != nil %}
{% if effort := (*efforts)[i]; effort >= 0 %}
<div class="col" style="font-weight: bolder; color: {%s effort_color(effort) %}" title="Estimated Effort">
<small>{%f.1 effort %}%</small>
</div>
{% else %}
<div class="col">
<strong>-</strong>
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endfunc %}