Files
aitbc/apps/explorer-web/src/pages/addresses.ts
oib 9b9c5beb23 ```
chore: enhance .gitignore and remove obsolete documentation files

- Reorganize .gitignore with categorized sections for better maintainability
- Add comprehensive ignore patterns for Python, Node.js, databases, logs, and build artifacts
- Add project-specific ignore rules for coordinator, explorer, and deployment files
- Remove outdated documentation: BITCOIN-WALLET-SETUP.md, LOCAL_ASSETS_SUMMARY.md, README-CONTAINER-DEPLOYMENT.md, README-DOMAIN-DEPLOYMENT.md
```
2026-01-24 14:44:51 +01:00

74 lines
2.2 KiB
TypeScript

import { fetchAddresses } from "../lib/mockData";
import type { AddressSummary } from "../lib/models";
export const addressesTitle = "Addresses";
export function renderAddressesPage(): string {
return `
<section class="addresses">
<header class="section-header">
<h2>Address Lookup</h2>
<p class="lead">Live address data from the AITBC coordinator API.</p>
</header>
<form class="addresses__search" aria-label="Search for an address">
<label class="addresses__label" for="address-input">Address</label>
<div class="addresses__input-group">
<input id="address-input" name="address" type="search" placeholder="0x..." disabled />
<button type="submit" disabled>Search</button>
</div>
<p class="placeholder">Searching will be enabled after integrating the coordinator/blockchain node endpoints.</p>
</form>
<section class="addresses__details">
<h3>Recent Activity</h3>
<table class="table addresses__table">
<thead>
<tr>
<th scope="col">Address</th>
<th scope="col">Balance</th>
<th scope="col">Tx Count</th>
<th scope="col">Last Active</th>
</tr>
</thead>
<tbody id="addresses-table-body">
<tr>
<td class="placeholder" colspan="4">Loading addresses…</td>
</tr>
</tbody>
</table>
</section>
</section>
`;
}
export async function initAddressesPage(): Promise<void> {
const tbody = document.querySelector<HTMLTableSectionElement>(
"#addresses-table-body",
);
if (!tbody) {
return;
}
const addresses = await fetchAddresses();
if (!addresses || addresses.length === 0) {
tbody.innerHTML = `
<tr>
<td class="placeholder" colspan="4">No addresses available.</td>
</tr>
`;
return;
}
tbody.innerHTML = addresses.map(renderAddressRow).join("");
}
function renderAddressRow(address: AddressSummary): string {
return `
<tr>
<td><code>${address.address}</code></td>
<td>${address.balance}</td>
<td>${address.txCount}</td>
<td>${new Date(address.lastActive).toLocaleString()}</td>
</tr>
`;
}