From 05be758754807a8266cc122b99eefd9b83a2a123 Mon Sep 17 00:00:00 2001 From: Jaime Idolpx Date: Wed, 10 Jun 2026 20:01:42 -0400 Subject: [PATCH] feat(serial-console): add SerialConsolePage component with WebSocket support --- package.json | 2 + src/app/App.tsx | 15 +- src/app/components/SerialConsolePage.tsx | 190 +++++++++++++++++++++++ 3 files changed, 204 insertions(+), 3 deletions(-) create mode 100644 src/app/components/SerialConsolePage.tsx diff --git a/package.json b/package.json index e9d7a34..4097793 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,8 @@ "@types/parallax-js": "^3.1.3", "@types/react-syntax-highlighter": "^15.5.13", "@uiw/react-codemirror": "^4.25.10", + "@xterm/addon-fit": "^0.11.0", + "@xterm/xterm": "^6.0.0", "canvas-confetti": "1.9.4", "class-variance-authority": "0.7.1", "clsx": "2.1.1", diff --git a/src/app/App.tsx b/src/app/App.tsx index b708978..cbbc4fc 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -1,5 +1,5 @@ import { lazy, Suspense, useEffect, useState } from 'react'; -import { Cpu, Settings, Wifi, Network, HardDrive, Activity, Search, Wrench, User, LogOut, Bell, FileText, AppWindow, Folder, Edit, Eye, Database, Upload, Download, Code2, LayoutList, Image, ChevronLeft, Loader2, Terminal, Link, Printer, Maximize2, Minimize2 } from 'lucide-react'; +import { Cpu, Settings, Wifi, Network, HardDrive, Activity, Search, Wrench, User, LogOut, Bell, FileText, AppWindow, Folder, Edit, Eye, Database, Upload, Download, Code2, LayoutList, Image, ChevronLeft, Loader2, Terminal, Link, Printer, Maximize2, Minimize2, Info } from 'lucide-react'; import { Toaster, toast } from 'sonner'; import StatusPage from './components/StatusPage'; import DevicesPage from './components/DevicesPage'; @@ -17,7 +17,9 @@ import { WsProvider } from './ws'; // Three.js lives only in RealityOverridePage — keep lazy so it doesn't load on startup. // CodeMirror/syntax-highlighter/ReactMarkdown live in MediaViewerEditor — lazy-loaded // inside MediaManager when the user first opens a file to view or edit. +// xterm.js lives only in SerialConsolePage — keep lazy. const RealityOverridePage = lazy(() => import('./components/RealityOverridePage')); +const SerialConsolePage = lazy(() => import('./components/SerialConsolePage')); type Page = 'status' | 'devices' | 'iec' | 'network' | 'general' | 'tools' | 'apps' | AppId; @@ -176,7 +178,7 @@ export default function App() { config={config} setConfig={setConfig} />, - 'serial-console': setCurrentPage('apps')} />, + 'serial-console': setCurrentPage('apps')} />, 'directory-editor': setCurrentPage('apps')} />, 'sector-editor': setCurrentPage('apps')} />, 'bam-editor': setCurrentPage('apps')} />, @@ -273,7 +275,7 @@ function AppPage({ title, onBack }: { title: string; onBack: () => void }) { className="w-full px-4 py-2 text-left hover:bg-neutral-50 flex items-center gap-2" > - Settings + Preferences +
+ + Serial Console +
+ +
+ + {statusLabel} +
+ + + + +
+ + {/* Terminal */} +
+
+ ); +}