'use client'
import { useEffect, useState } from 'react'
import { Settings, Server, Key, Globe, Cpu, Save, CheckCircle } from 'lucide-react'
interface SettingsData {
gatewayUrl?: string
ollamaUrl?: string
tunnelId?: string
cloudflareAccountId?: string
cloudflareToken?: string
vercelToken?: string
vercelOrgId?: string
piNodes?: Array<{ name: string; ip: string; role: string; capacity: number }>
}
function Field({ label, value, onChange, placeholder, type = 'text', mono = false }: any) {
return (
onChange(e.target.value)}
placeholder={placeholder}
style={{ width: '100%', background: 'rgba(255,255,255,0.06)', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8, padding: '10px 14px', color: '#fff', fontSize: 13, outline: 'none', boxSizing: 'border-box', fontFamily: mono ? 'monospace' : 'inherit' }}
/>
)
}
function Section({ title, icon: Icon, color = '#FF1D6C', children }: any) {
return (
)
}
export default function SettingsPage() {
const [data, setData] = useState({})
const [saved, setSaved] = useState(false)
const [loading, setLoading] = useState(true)
useEffect(() => {
fetch('/api/settings').then(r => r.json()).then(d => { setData(d); setLoading(false) }).catch(() => setLoading(false))
}, [])
const update = (key: string) => (val: string) => setData((d: any) => ({ ...d, [key]: val }))
const handleSave = async () => {
await fetch('/api/settings', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
setSaved(true)
setTimeout(() => setSaved(false), 3000)
}
if (loading) return Loading settings…
return (
Settings
BlackRoad OS configuration
{(data.piNodes ?? [
{ name: 'aria64', ip: '192.168.4.38', role: 'primary', capacity: 22500 },
{ name: 'blackroad-pi', ip: '192.168.4.64', role: 'secondary', capacity: 7500 },
{ name: 'alice', ip: '192.168.4.49', role: 'mesh', capacity: 5000 },
{ name: 'cecilia', ip: '192.168.4.89', role: 'ai', capacity: 5000 },
]).map(node => (
{node.name}
{node.ip}
{node.role} · {node.capacity.toLocaleString()} slots
))}
Edit Pi nodes in ~/.cloudflared/config.yml
)
}