import { Card } from './ui/card'; import { Button } from './ui/button'; import { Server, HardDrive, Settings, Clock, CheckCircle, BookOpen, ExternalLink, Loader2, AlertCircle, Database, FolderTree } from 'lucide-react'; import { Badge } from './ui/badge'; import { useCentralStatus } from '../hooks/useCentralStatus'; import { useInstanceConfig, useInstanceContext } from '../hooks'; export function CentralComponent() { const { currentInstance } = useInstanceContext(); const { data: centralStatus, isLoading: statusLoading, error: statusError } = useCentralStatus(); const { config: fullConfig, isLoading: configLoading } = useInstanceConfig(currentInstance); const serverConfig = fullConfig?.server as { host?: string; port?: number } | undefined; const formatUptime = (seconds?: number) => { if (!seconds) return 'Unknown'; const days = Math.floor(seconds / 86400); const hours = Math.floor((seconds % 86400) / 3600); const minutes = Math.floor((seconds % 3600) / 60); const secs = Math.floor(seconds % 60); const parts = []; if (days > 0) parts.push(`${days}d`); if (hours > 0) parts.push(`${hours}h`); if (minutes > 0) parts.push(`${minutes}m`); if (secs > 0 || parts.length === 0) parts.push(`${secs}s`); return parts.join(' '); }; // Show error state if (statusError) { return (

Error Loading Central Status

{(statusError as Error)?.message || 'An error occurred'}

); } return (
{/* Educational Intro Section */}

What is the Central Service?

The Central Service is the "brain" of your personal cloud. It acts as the main coordinator that manages all the different services running on your network. Think of it like the control tower at an airport - it keeps track of what's happening, routes traffic between services, and ensures everything works together smoothly.

This service handles configuration management, service discovery, and provides the web interface you're using right now.

Central Service Status

Monitor the Wild Central server

{centralStatus && ( {centralStatus.status === 'running' ? 'Running' : centralStatus.status} )}
{statusLoading || configLoading ? (
) : (
{/* Server Information */}

Server Information

Version
{centralStatus?.version || 'Unknown'}
Uptime
{formatUptime(centralStatus?.uptimeSeconds)}
Instances
{centralStatus?.instances.count || 0} configured
{centralStatus?.instances.names && centralStatus.instances.names.length > 0 && (
{centralStatus.instances.names.join(', ')}
)}
Setup Files
{centralStatus?.setupFiles || 'Unknown'}
{/* Configuration */}

Configuration

Server Host
{serverConfig?.host || '0.0.0.0'}
Server Port
{serverConfig?.port || 5055}
Data Directory
{centralStatus?.dataDir || '/var/lib/wild-central'}
Apps Directory
{centralStatus?.appsDir || '/opt/wild-cloud/apps'}
)}
); }