import { useMemo, useState } from 'react'; import { CheckCircle2, KeyRound, Link2, MonitorCog, Save, Server, ShieldCheck, } from 'lucide-react'; import { Badge } from '@/components/ui/Badge'; import { Button } from '@/components/ui/Button'; import { Card } from '@/components/ui/Card'; import { getSettings, saveSettings, } from '@/services/apiClient'; const DEFAULT_OVERLAY_ROUTE = '198.19.0.0/16'; const DEFAULT_ROUTER_IP = '198.51.100.1'; const DEFAULT_CONTROLLER_IP = '198.51.100.10'; const DEFAULT_PLC_IP = '198.51.100.50'; const DEFAULT_FIRMWARE = 'openwrt-23.05.5-zbt-we826-16m-litoral-golden-sysupgrade.bin'; export function BackendSettings() { const [settings, setSettings] = useState(getSettings()); const [saved, setSaved] = useState(false); const backendHost = useMemo(() => { try { return new URL(settings.backendUrl).host; } catch { return 'Invalid backend URL'; } }, [settings.backendUrl]); function handleSave() { saveSettings(settings); setSaved(true); window.setTimeout(() => { setSaved(false); }, 2500); } return (

Workstation

Local technician console configuration for router provisioning.

{saved ? 'Saved' : 'Local Config'}

Backend Connectivity

API endpoint used for VPN IP assignment and peer registration.

setSettings({ ...settings, backendUrl: event.target.value, }) } className="w-full rounded-2xl border border-white/10 bg-slate-950/80 py-4 pl-11 pr-4 font-mono text-sm text-white outline-none transition placeholder:text-slate-600 focus:border-blue-500/50 focus:bg-slate-950" placeholder="http://localhost:8080" />
setSettings({ ...settings, apiKey: event.target.value, }) } className="w-full rounded-2xl border border-white/10 bg-slate-950/80 py-4 pl-11 pr-4 font-mono text-sm text-white outline-none transition placeholder:text-slate-600 focus:border-blue-500/50 focus:bg-slate-950" placeholder="dev-api-key" />

Connected Target

{backendHost}

Ready

Provisioning Baseline

Read-only production values.

Production Profile

OpenWrt 23.05 baseline, ZBT-WE826 16M target, fw4/nftables firewall, LuCI over WireGuard, stable LAN topology and automated VPS peer registration.

OpenWrt 23.05 WireGuard fw4/nftables
{saved && (
Workstation configuration saved.
)}
); } function InfoRow({ label, value, }: { label: string; value: string; }) { return (

{label}

{value}

); }