lthn.io/app/Mod/Explorer/Views/index.blade.php
Claude 333ce446de
feat(explorer): recent blocks list with clickable links
- Explorer index shows last 15 blocks with height, type, time, diff, hash
- All heights and hashes link to block detail page
- Block detail: prev hash links to previous block, reward shown
- Stats cards link to block/aliases pages
- Previous/Next navigation with block numbers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 03:49:22 +01:00

75 lines
3.6 KiB
PHP

@extends('lethean::layout')
@section('title', 'Explorer')
@section('content')
<div class="section">
<h2>Block Explorer</h2>
<form method="get" action="/explorer/search" style="margin-bottom: 1.5rem; display: flex; gap: 0.5rem;">
<input type="text" name="q" placeholder="Search by block height, hash, or tx hash..."
style="flex: 1; padding: 0.5rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; color: var(--text); font-size: 0.9rem;">
<button type="submit" class="api-link" style="margin-top: 0;">Search</button>
</form>
<div class="stats">
<div class="stat">
<a href="/explorer/block/{{ ($info['height'] ?? 1) - 1 }}" style="text-decoration: none;">
<div class="value">{{ number_format($info['height'] ?? 0) }}</div>
<div class="label">Height</div>
</a>
</div>
<div class="stat">
<div class="value">{{ number_format($info['tx_count'] ?? 0) }}</div>
<div class="label">Transactions</div>
</div>
<div class="stat">
<a href="/explorer/aliases" style="text-decoration: none;">
<div class="value">{{ number_format($info['alias_count'] ?? 0) }}</div>
<div class="label">Names</div>
</a>
</div>
<div class="stat">
<div class="value">{{ number_format(($info['height'] ?? 0) + 10000000) }}</div>
<div class="label">Supply (LTHN)</div>
</div>
</div>
<h3 style="margin-top: 2rem; margin-bottom: 1rem;">Recent Blocks</h3>
<table style="width: 100%; border-collapse: collapse;">
<tr style="border-bottom: 1px solid var(--border); text-align: left;">
<th style="padding: 0.75rem; color: var(--muted); font-size: 0.8rem; text-transform: uppercase;">Height</th>
<th style="padding: 0.75rem; color: var(--muted); font-size: 0.8rem; text-transform: uppercase;">Type</th>
<th style="padding: 0.75rem; color: var(--muted); font-size: 0.8rem; text-transform: uppercase;">Time</th>
<th style="padding: 0.75rem; color: var(--muted); font-size: 0.8rem; text-transform: uppercase;">Difficulty</th>
<th style="padding: 0.75rem; color: var(--muted); font-size: 0.8rem; text-transform: uppercase;">Hash</th>
</tr>
@foreach($blocks as $block)
@php
$isPos = $block['is_pos_block'] ?? false;
$h = $block['height'] ?? 0;
@endphp
<tr style="border-bottom: 1px solid var(--border);">
<td style="padding: 0.75rem;">
<a href="/explorer/block/{{ $h }}" style="font-weight: 600;">{{ number_format($h) }}</a>
</td>
<td style="padding: 0.75rem;">
<span class="badge {{ $isPos ? 'badge-amber' : 'badge-green' }}">{{ $isPos ? 'PoS' : 'PoW' }}</span>
</td>
<td style="padding: 0.75rem; color: var(--muted); font-size: 0.85rem;">
{{ isset($block['timestamp']) ? date('H:i:s', $block['timestamp']) : '' }}
</td>
<td style="padding: 0.75rem;">{{ number_format($block['difficulty'] ?? 0) }}</td>
<td style="padding: 0.75rem;">
<a href="/explorer/block/{{ $block['hash'] ?? '' }}" style="font-family: monospace; font-size: 0.75rem;">{{ substr($block['hash'] ?? '', 0, 16) }}...</a>
</td>
</tr>
@endforeach
</table>
<div style="margin-top: 1.5rem; display: flex; gap: 1.5rem;">
<a href="/explorer/aliases">View all names &rarr;</a>
<a href="/names">Name directory &rarr;</a>
</div>
</div>
@endsection