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
```
This commit is contained in:
oib
2026-01-24 14:44:51 +01:00
parent 99bf335970
commit 9b9c5beb23
214 changed files with 25558 additions and 171 deletions

View File

@@ -1,4 +1,4 @@
import { CONFIG, type DataMode } from "../config";
import { config, type DataMode } from "../config";
import { getDataMode, setDataMode } from "../lib/mockData";
const LABELS: Record<DataMode, string> = {
@@ -44,7 +44,7 @@ function renderControls(mode: DataMode): string {
<select data-mode-select>
${options}
</select>
<small>${mode === "mock" ? "Static JSON samples" : `Coordinator API (${CONFIG.apiBaseUrl})`}</small>
<small>${mode === "mock" ? "Static JSON samples" : `Coordinator API (${config.apiBaseUrl})`}</small>
</label>
`;
}

View File

@@ -6,11 +6,11 @@ export interface ExplorerConfig {
apiBaseUrl: string;
}
export const CONFIG: ExplorerConfig = {
export const config = {
// Base URL for the coordinator API
apiBaseUrl: "https://aitbc.bubuit.net/api",
apiBaseUrl: import.meta.env.VITE_COORDINATOR_API ?? 'https://aitbc.bubuit.net/api',
// Base path for mock data files (used by fetchMock)
mockBasePath: "/explorer/mock",
mockBasePath: '/explorer/mock',
// Default data mode: "live" or "mock"
dataMode: "live" as "live" | "mock",
};
dataMode: 'live', // Changed from 'mock' to 'live'
} as const;

View File

@@ -1,4 +1,4 @@
import { CONFIG, type DataMode } from "../config";
import { config, type DataMode } from "../config";
import { notifyError } from "../components/notifications";
import type {
BlockListResponse,
@@ -29,9 +29,20 @@ function loadStoredMode(): DataMode | null {
return null;
}
const initialMode = loadStoredMode() ?? CONFIG.dataMode;
// Force live mode - ignore stale localStorage
const storedMode = loadStoredMode();
const initialMode = storedMode === "mock" ? "live" : (storedMode ?? config.dataMode);
let currentMode: DataMode = initialMode;
// Clear any cached mock mode preference
if (storedMode === "mock" && typeof window !== "undefined") {
try {
window.localStorage.setItem(STORAGE_KEY, "live");
} catch (error) {
console.warn("[Explorer] Failed to update cached mode", error);
}
}
function syncDocumentMode(mode: DataMode): void {
if (typeof document !== "undefined") {
document.documentElement.dataset.mode = mode;
@@ -63,7 +74,7 @@ export async function fetchBlocks(): Promise<BlockSummary[]> {
}
try {
const response = await fetch(`${CONFIG.apiBaseUrl}/explorer/blocks`);
const response = await fetch(`${config.apiBaseUrl}/explorer/blocks`);
if (!response.ok) {
throw new Error(`Failed to fetch blocks: ${response.status} ${response.statusText}`);
}
@@ -87,7 +98,7 @@ export async function fetchTransactions(): Promise<TransactionSummary[]> {
}
try {
const response = await fetch(`${CONFIG.apiBaseUrl}/explorer/transactions`);
const response = await fetch(`${config.apiBaseUrl}/explorer/transactions`);
if (!response.ok) {
throw new Error(`Failed to fetch transactions: ${response.status} ${response.statusText}`);
}
@@ -111,7 +122,7 @@ export async function fetchAddresses(): Promise<AddressSummary[]> {
}
try {
const response = await fetch(`${CONFIG.apiBaseUrl}/explorer/addresses`);
const response = await fetch(`${config.apiBaseUrl}/explorer/addresses`);
if (!response.ok) {
throw new Error(`Failed to fetch addresses: ${response.status} ${response.statusText}`);
}
@@ -135,7 +146,7 @@ export async function fetchReceipts(): Promise<ReceiptSummary[]> {
}
try {
const response = await fetch(`${CONFIG.apiBaseUrl}/explorer/receipts`);
const response = await fetch(`${config.apiBaseUrl}/explorer/receipts`);
if (!response.ok) {
throw new Error(`Failed to fetch receipts: ${response.status} ${response.statusText}`);
}
@@ -153,7 +164,7 @@ export async function fetchReceipts(): Promise<ReceiptSummary[]> {
}
async function fetchMock<T>(resource: string): Promise<T> {
const url = `${CONFIG.mockBasePath}/${resource}.json`;
const url = `${config.mockBasePath}/${resource}.json`;
try {
const response = await fetch(url);
if (!response.ok) {

View File

@@ -41,13 +41,26 @@ export interface AddressListResponse {
export interface ReceiptSummary {
receiptId: string;
jobId?: string;
miner: string;
coordinator: string;
issuedAt: string;
status: string;
payload?: {
job_id?: string;
provider?: string;
client?: string;
units?: number;
unit_type?: string;
unit_price?: number;
price?: number;
minerSignature?: string;
coordinatorSignature?: string;
signature?: {
alg?: string;
key_id?: string;
sig?: string;
};
};
}

View File

@@ -8,8 +8,6 @@ import { blocksTitle, renderBlocksPage, initBlocksPage } from "./pages/blocks";
import { transactionsTitle, renderTransactionsPage, initTransactionsPage } from "./pages/transactions";
import { addressesTitle, renderAddressesPage, initAddressesPage } from "./pages/addresses";
import { receiptsTitle, renderReceiptsPage, initReceiptsPage } from "./pages/receipts";
import { initDataModeToggle } from "./components/dataModeToggle";
import { getDataMode } from "./lib/mockData";
import { initNotifications } from "./components/notifications";
type PageConfig = {
@@ -68,7 +66,6 @@ function render(): void {
${siteFooter()}
`;
initDataModeToggle(render);
void page?.init?.();
}

View File

@@ -8,7 +8,7 @@ export function renderAddressesPage(): string {
<section class="addresses">
<header class="section-header">
<h2>Address Lookup</h2>
<p class="lead">Enter an account address to view recent transactions, balances, and receipt history (mock results shown below).</p>
<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>
@@ -52,7 +52,7 @@ export async function initAddressesPage(): Promise<void> {
if (!addresses || addresses.length === 0) {
tbody.innerHTML = `
<tr>
<td class="placeholder" colspan="4">No mock addresses available.</td>
<td class="placeholder" colspan="4">No addresses available.</td>
</tr>
`;
return;

View File

@@ -8,7 +8,7 @@ export function renderBlocksPage(): string {
<section class="blocks">
<header class="section-header">
<h2>Recent Blocks</h2>
<p class="lead">This view lists blocks pulled from the coordinator or blockchain node (mock data shown for now).</p>
<p class="lead">Live blockchain data from the AITBC coordinator API.</p>
</header>
<table class="table blocks__table">
<thead>
@@ -42,7 +42,7 @@ export async function initBlocksPage(): Promise<void> {
if (!blocks || blocks.length === 0) {
tbody.innerHTML = `
<tr>
<td class="placeholder" colspan="5">No mock blocks available.</td>
<td class="placeholder" colspan="5">No blocks available.</td>
</tr>
`;
return;

View File

@@ -9,7 +9,7 @@ export const overviewTitle = "Network Overview";
export function renderOverviewPage(): string {
return `
<section class="overview">
<p class="lead">High-level summaries of recent blocks, transactions, and receipts will appear here.</p>
<p class="lead">Real-time AITBC network statistics and activity.</p>
<div class="overview__grid">
<article class="card">
<h3>Latest Block</h3>
@@ -54,21 +54,22 @@ export async function initOverviewPage(): Promise<void> {
`;
} else {
blockStats.innerHTML = `
<li class="placeholder">No blocks available. Try switching data mode.</li>
<li class="placeholder">No blocks available.</li>
`;
}
}
const txStats = document.querySelector<HTMLUListElement>("#overview-transaction-stats");
if (txStats) {
if (transactions && transactions.length > 0) {
const succeeded = transactions.filter((tx) => tx.status === "Succeeded");
const succeeded = transactions.filter((tx) => tx.status === "Succeeded" || tx.status === "Completed");
const running = transactions.filter((tx) => tx.status === "Running");
txStats.innerHTML = `
<li><strong>Total Mock Tx:</strong> ${transactions.length}</li>
<li><strong>Succeeded:</strong> ${succeeded.length}</li>
<li><strong>Pending:</strong> ${transactions.length - succeeded.length}</li>
<li><strong>Total:</strong> ${transactions.length}</li>
<li><strong>Completed:</strong> ${succeeded.length}</li>
<li><strong>Running:</strong> ${running.length}</li>
`;
} else {
txStats.innerHTML = `<li class="placeholder">No transactions available. Try switching data mode.</li>`;
txStats.innerHTML = `<li class="placeholder">No transactions available.</li>`;
}
}

View File

@@ -8,7 +8,7 @@ export function renderReceiptsPage(): string {
<section class="receipts">
<header class="section-header">
<h2>Receipt History</h2>
<p class="lead">Mock receipts from the coordinator history are displayed below; live lookup will arrive with API wiring.</p>
<p class="lead">Live receipt data from the AITBC coordinator API.</p>
</header>
<div class="receipts__controls">
<label class="receipts__label" for="job-id-input">Job ID</label>
@@ -54,7 +54,7 @@ export async function initReceiptsPage(): Promise<void> {
if (!receipts || receipts.length === 0) {
tbody.innerHTML = `
<tr>
<td class="placeholder" colspan="6">No mock receipts available.</td>
<td class="placeholder" colspan="6">No receipts available.</td>
</tr>
`;
return;
@@ -64,14 +64,18 @@ export async function initReceiptsPage(): Promise<void> {
}
function renderReceiptRow(receipt: ReceiptSummary): string {
// Get jobId from receipt or from payload
const jobId = receipt.jobId || receipt.payload?.job_id || "N/A";
const jobIdDisplay = jobId !== "N/A" ? jobId.slice(0, 16) + "…" : "N/A";
return `
<tr>
<td><code>N/A</code></td>
<td><code>${receipt.receiptId}</code></td>
<td><code title="${jobId}">${jobIdDisplay}</code></td>
<td><code title="${receipt.receiptId}">${receipt.receiptId.slice(0, 16)}</code></td>
<td>${receipt.miner}</td>
<td>${receipt.coordinator}</td>
<td>${new Date(receipt.issuedAt).toLocaleString()}</td>
<td>${receipt.status}</td>
<td><span class="status-badge status-${receipt.status.toLowerCase()}">${receipt.status}</span></td>
</tr>
`;
}

View File

@@ -10,7 +10,7 @@ export function renderTransactionsPage(): string {
<section class="transactions">
<header class="section-header">
<h2>Recent Transactions</h2>
<p class="lead">Mock data is shown below until coordinator or node APIs are wired up.</p>
<p class="lead">Latest transactions on the AITBC network.</p>
</header>
<table class="table transactions__table">
<thead>
@@ -45,7 +45,7 @@ export async function initTransactionsPage(): Promise<void> {
if (!transactions || transactions.length === 0) {
tbody.innerHTML = `
<tr>
<td class="placeholder" colspan="6">No mock transactions available.</td>
<td class="placeholder" colspan="6">No transactions available.</td>
</tr>
`;
return;