diff --git a/frontend/components/containers/interactive-session.tsx b/frontend/components/containers/interactive-session.tsx index 5312f32..f5e3c15 100644 --- a/frontend/components/containers/interactive-session.tsx +++ b/frontend/components/containers/interactive-session.tsx @@ -1,4 +1,3 @@ -import { View, Text } from "react-native"; import React from "react"; import Terminal from "./terminal"; import { BASE_WS_URL } from "@/lib/api"; @@ -19,7 +18,9 @@ const InteractiveSession = ({ type, options }: Props) => { serverId: options.serverId, token: "token", }); - return ; + return ( + + ); default: throw new Error("Unknown interactive session type"); diff --git a/frontend/components/containers/terminal.tsx b/frontend/components/containers/terminal.tsx index b38c19e..0defd70 100644 --- a/frontend/components/containers/terminal.tsx +++ b/frontend/components/containers/terminal.tsx @@ -26,20 +26,33 @@ const Keys = { Tab: "\x09", }; -type TerminalProps = ComponentPropsWithoutRef & { +type XTermJsProps = { + client: "xtermjs"; wsUrl: string; }; -const Terminal = ({ wsUrl, style, ...props }: TerminalProps) => { - const ref = React.useRef(null); +type TerminalProps = ComponentPropsWithoutRef & XTermJsProps; + +const Terminal = ({ client, style, ...props }: TerminalProps) => { + const xtermRef = React.useRef(null); const send = (data: string) => { - ref.current?.send(data); + switch (client) { + case "xtermjs": + xtermRef.current?.send(data); + break; + } }; return ( - + {client === "xtermjs" && ( + + )}