import { useState } from 'react'; import { Card } from './ui/card'; import { Button } from './ui/button'; import { Badge } from './ui/badge'; import { AppWindow, Database, Globe, Shield, BarChart3, MessageSquare, Plus, Search, Settings, ExternalLink, CheckCircle, AlertCircle, Clock, Download, Trash2, BookOpen } from 'lucide-react'; interface AppsComponentProps { onComplete?: () => void; } interface Application { id: string; name: string; description: string; category: 'database' | 'web' | 'security' | 'monitoring' | 'communication' | 'storage'; status: 'available' | 'installing' | 'running' | 'error' | 'stopped'; version?: string; namespace?: string; replicas?: number; resources?: { cpu: string; memory: string; }; urls?: string[]; } export function AppsComponent({ onComplete }: AppsComponentProps) { const [applications, setApplications] = useState([ { id: 'postgres', name: 'PostgreSQL', description: 'Reliable, high-performance SQL database', category: 'database', status: 'running', version: 'v15.4', namespace: 'default', replicas: 1, resources: { cpu: '500m', memory: '1Gi' }, urls: ['postgres://postgres.wildcloud.local:5432'], }, { id: 'redis', name: 'Redis', description: 'In-memory data structure store', category: 'database', status: 'running', version: 'v7.2', namespace: 'default', replicas: 1, resources: { cpu: '250m', memory: '512Mi' }, }, { id: 'traefik-dashboard', name: 'Traefik Dashboard', description: 'Load balancer and reverse proxy dashboard', category: 'web', status: 'running', version: 'v3.0', namespace: 'kube-system', urls: ['https://traefik.wildcloud.local'], }, { id: 'grafana', name: 'Grafana', description: 'Monitoring and observability dashboards', category: 'monitoring', status: 'installing', version: 'v10.2', namespace: 'monitoring', }, { id: 'prometheus', name: 'Prometheus', description: 'Time-series monitoring and alerting', category: 'monitoring', status: 'running', version: 'v2.45', namespace: 'monitoring', replicas: 1, resources: { cpu: '1000m', memory: '2Gi' }, }, { id: 'vault', name: 'HashiCorp Vault', description: 'Secrets management and encryption', category: 'security', status: 'available', version: 'v1.15', }, { id: 'minio', name: 'MinIO', description: 'High-performance object storage', category: 'storage', status: 'available', version: 'RELEASE.2023-12-07', }, ]); const [searchTerm, setSearchTerm] = useState(''); const [selectedCategory, setSelectedCategory] = useState('all'); const getStatusIcon = (status: Application['status']) => { switch (status) { case 'running': return ; case 'error': return ; case 'installing': return ; case 'stopped': return ; default: return ; } }; const getStatusBadge = (status: Application['status']) => { const variants = { available: 'secondary', installing: 'default', running: 'success', error: 'destructive', stopped: 'warning', } as const; const labels = { available: 'Available', installing: 'Installing', running: 'Running', error: 'Error', stopped: 'Stopped', }; return ( {labels[status]} ); }; const getCategoryIcon = (category: Application['category']) => { switch (category) { case 'database': return ; case 'web': return ; case 'security': return ; case 'monitoring': return ; case 'communication': return ; case 'storage': return ; default: return ; } }; const handleAppAction = (appId: string, action: 'install' | 'start' | 'stop' | 'delete' | 'configure') => { console.log(`${action} app: ${appId}`); }; const categories = ['all', 'database', 'web', 'security', 'monitoring', 'communication', 'storage']; const filteredApps = applications.filter(app => { const matchesSearch = app.name.toLowerCase().includes(searchTerm.toLowerCase()) || app.description.toLowerCase().includes(searchTerm.toLowerCase()); const matchesCategory = selectedCategory === 'all' || app.category === selectedCategory; return matchesSearch && matchesCategory; }); const runningApps = applications.filter(app => app.status === 'running').length; return (
{/* Educational Intro Section */}

What are Apps in your Personal Cloud?

Apps are the useful programs that make your personal cloud valuable - like having a personal Netflix (media server), Google Drive (file storage), or Gmail (email server) running on your own hardware. Instead of relying on big tech companies, you control your data and services.

Your cluster can run databases, web servers, photo galleries, password managers, backup services, and much more. Each app runs in its own secure container, so they don't interfere with each other and can be easily managed.

App Management

Install and manage applications on your Kubernetes cluster

setSearchTerm(e.target.value)} className="w-full pl-10 pr-4 py-2 border rounded-lg bg-background" />
{categories.map(category => ( ))}
{runningApps} applications running • {applications.length} total available
{filteredApps.map((app) => (
{getCategoryIcon(app.category)}

{app.name}

{app.version && ( {app.version} )} {getStatusIcon(app.status)}

{app.description}

{app.status === 'running' && (
{app.namespace && (
Namespace: {app.namespace}
)} {app.replicas && (
Replicas: {app.replicas}
)} {app.resources && (
Resources: {app.resources.cpu} CPU, {app.resources.memory} RAM
)} {app.urls && app.urls.length > 0 && (
URLs: {app.urls.map((url, index) => ( ))}
)}
)}
{getStatusBadge(app.status)}
{app.status === 'available' && ( )} {app.status === 'running' && ( <> )} {app.status === 'stopped' && ( )} {(app.status === 'running' || app.status === 'stopped') && ( )}
))}
{filteredApps.length === 0 && (

No applications found

{searchTerm || selectedCategory !== 'all' ? 'Try adjusting your search or category filter' : 'Install your first application to get started' }

)}
); }