From 79e79097ae76e3f954c76fbc0fe4c0c8b72fa295 Mon Sep 17 00:00:00 2001 From: Felix Faerber Date: Thu, 17 Sep 2026 14:27:48 +0300 Subject: [PATCH] drop the /bee page It showed node health, addresses, topology, wallet, stamps and chain state -- the same ground bee-manager covers at stamps.ffaerber.duckdns.org, and covers better: bucket maps, top-up and dilute actions, the action ledger, alerting. Two views of one node drift apart, and the weaker one is the one people find first, from the gateway's own nav. Route, component and nav entry go together. The gateway's /bee/stats endpoint is left alone: nothing else in this app called it, but it is a public API route and removing it is a decision about the API, not about this page. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01CYFnHida4AdiNDek2pzgXx --- app/components/nav.tsx | 1 - app/routes.ts | 1 - app/routes/bee.tsx | 209 ----------------------------------------- 3 files changed, 211 deletions(-) delete mode 100644 app/routes/bee.tsx diff --git a/app/components/nav.tsx b/app/components/nav.tsx index b2427aa..ef7e53b 100644 --- a/app/components/nav.tsx +++ b/app/components/nav.tsx @@ -3,7 +3,6 @@ import { NavLink } from 'react-router'; const ITEMS = [ { to: '/chat', label: 'Chat' }, { to: '/account', label: 'Account' }, - { to: '/bee', label: 'Bee' }, ]; export function Nav() { diff --git a/app/routes.ts b/app/routes.ts index e68063d..9e3d0c5 100644 --- a/app/routes.ts +++ b/app/routes.ts @@ -7,5 +7,4 @@ export default [ route('login', 'routes/login.tsx'), route('account', 'routes/account.tsx'), route('chat', 'routes/chat.tsx'), - route('bee', 'routes/bee.tsx'), ] satisfies RouteConfig; diff --git a/app/routes/bee.tsx b/app/routes/bee.tsx deleted file mode 100644 index 40536ac..0000000 --- a/app/routes/bee.tsx +++ /dev/null @@ -1,209 +0,0 @@ -import { useEffect, useState } from 'react'; -import { Nav } from '~/components/nav'; - -const API_URL = import.meta.env.VITE_API_URL ?? 'https://api.t4t-gateway.com'; - -type Health = { status: string; version: string; apiVersion: string }; -type Addresses = { - overlay: string; - ethereum: string; - publicKey: string; - pssPublicKey: string; - underlay: string[]; -}; -type Topology = { - connected: number; - population: number; - depth: number; - reachability: string; - networkAvailability: string; -}; -type Wallet = { - bzz: string; - xdai: string; - walletAddress: string; - chainID: number; -}; -type Stamp = { - batchID: string; - label: string; - depth: number; - amount: string; - usable: boolean; - usageText: string; - durationDays: number; -}; -type ChainState = { block: number; chainTip: number; currentPrice: number }; - -type Stats = { - health: Health | null; - addresses: Addresses | null; - topology: Topology | null; - wallet: Wallet | null; - stamps: Stamp[] | null; - chain: ChainState | null; -}; - -export function meta() { - return [{ title: 'Bee · t4t Gateway' }]; -} - -async function fetchStats(): Promise { - const token = localStorage.getItem('jwt'); - if (!token) throw new Error('Not authenticated'); - const res = await fetch(`${API_URL}/bee/stats`, { - headers: { Authorization: `Bearer ${token}` }, - }); - if (res.status === 401) { - localStorage.removeItem('jwt'); - window.location.href = '/login'; - throw new Error('Unauthorized'); - } - const body = await res.json(); - if (!res.ok) throw new Error(body?.error ?? `Request failed (${res.status})`); - return body as Stats; -} - -function Card({ title, children }: { title: string; children: React.ReactNode }) { - return ( -
-

{title}

-
{children}
-
- ); -} - -function Row({ label, value }: { label: string; value: React.ReactNode }) { - return ( -
- {label} - {value} -
- ); -} - -export default function BeePage() { - const [stats, setStats] = useState(null); - const [error, setError] = useState(null); - const [loading, setLoading] = useState(true); - - useEffect(() => { - if (typeof window === 'undefined') return; - if (!localStorage.getItem('jwt')) { - window.location.href = '/login'; - return; - } - fetchStats() - .then((s) => setStats(s)) - .catch((err) => setError(err instanceof Error ? err.message : 'Unknown error')) - .finally(() => setLoading(false)); - }, []); - - if (loading) { - return ( - <> -