import { Box, FolderSearch, LayoutDashboard, Monitor, Network, Server, Settings, Terminal, User, Activity, TerminalSquare, } from "lucide-react"; import { useTranslation } from "react-i18next"; import { CommandHistoryProvider } from "@/features/terminal/command-history/CommandHistoryContext"; import { Terminal as TerminalFeature } from "@/features/terminal/Terminal"; import { FileManager } from "@/features/file-manager/FileManager"; import { DockerManager } from "@/features/docker/DockerManager"; import { ServerStats } from "@/features/server-stats/ServerStats"; import GuacamoleApp from "@/features/guacamole/GuacamoleApp"; import { DashboardTab } from "@/dashboard/DashboardTab"; import { TunnelTab } from "@/features/tunnel/TunnelTab"; import type { Tab, TabType, Host } from "@/types/ui-types"; import type { SSHHost } from "@/types"; function hostToSSHHost(h: Host): SSHHost { return { id: parseInt(h.id, 10), name: h.name, ip: h.ip, port: h.port, username: h.username, folder: h.folder ?? "", tags: h.tags ?? [], pin: h.pin ?? false, authType: h.authType, password: h.password, key: h.key, keyPassword: h.keyPassword, keyType: h.keyType, credentialId: h.credentialId ? parseInt(h.credentialId, 10) : undefined, terminalConfig: h.terminalConfig, enableTerminal: h.enableTerminal ?? false, enableTunnel: h.enableTunnel ?? false, enableFileManager: h.enableFileManager ?? false, enableDocker: h.enableDocker ?? false, showTerminalInSidebar: true, showFileManagerInSidebar: true, showTunnelInSidebar: true, showDockerInSidebar: true, showServerStatsInSidebar: true, defaultPath: h.defaultPath ?? "", tunnelConnections: [], connectionType: "ssh", createdAt: "", updatedAt: "", } as SSHHost; } function EmptyState({ icon: Icon, messageKey, }: { icon: React.ElementType; messageKey: string; }) { const { t } = useTranslation(); return (
{t(messageKey)}
); } export function tabIcon(type: TabType) { switch (type) { case "dashboard": return ; case "terminal": return ; case "rdp": return ; case "vnc": return ; case "telnet": return ; case "stats": return ; case "files": return ; case "host-manager": return ; case "user-profile": return ; case "admin-settings": return ; case "docker": return ; case "tunnel": return ; } } export function renderTabContent( tab: Tab, onOpenSingletonTab?: (type: TabType) => void, onOpenTab?: (host: Host, type: TabType) => void, ) { const { host, label } = tab; switch (tab.type) { case "dashboard": return ( ); case "terminal": if (!host) return ( ); return ( {}} /> ); case "files": if (!host) return ( ); return ; case "docker": if (!host) return ; return ( ); case "stats": if (!host) return ( ); return ( ); case "tunnel": return ; case "rdp": case "vnc": case "telnet": if (!host) return ( ); return ; case "host-manager": case "user-profile": case "admin-settings": return null; } }