Revert "refactor: remove unsued files"

This reverts commit d20f86ffe1.
This commit is contained in:
Mauricio Siu
2024-12-14 23:05:19 -06:00
parent d20f86ffe1
commit fc2b0abdb1
15 changed files with 681 additions and 107 deletions
@@ -11,7 +11,7 @@ import { api } from "@/utils/api";
import dynamic from "next/dynamic";
import type React from "react";
const Terminal = dynamic(async () => (await import("./terminal")).Terminal, {
const Terminal = dynamic(() => import("./terminal").then((e) => e.Terminal), {
ssr: false,
});
@@ -4,7 +4,6 @@ import { useEffect, useRef } from "react";
import { FitAddon } from "xterm-addon-fit";
import "@xterm/xterm/css/xterm.css";
import { AttachAddon } from "@xterm/addon-attach";
import { WebLinksAddon } from "@xterm/addon-web-links";
interface Props {
id: string;
@@ -21,11 +20,13 @@ export const Terminal: React.FC<Props> = ({ id, serverId }) => {
}
const term = new XTerm({
cursorBlink: true,
cols: 80,
rows: 30,
lineHeight: 1.4,
convertEol: true,
theme: {
cursor: "transparent",
background: "transparent",
background: "#19191A",
},
});
const addonFit = new FitAddon();
@@ -41,17 +42,15 @@ export const Terminal: React.FC<Props> = ({ id, serverId }) => {
term.open(termRef.current);
term.loadAddon(addonFit);
term.loadAddon(addonAttach);
term.loadAddon(new WebLinksAddon());
addonFit.fit();
return () => {
ws.readyState === WebSocket.OPEN && ws.close();
};
}, [id, serverId]);
return (
<div className="flex flex-col gap-4 w-full">
<div className="w-full h-full border rounded-lg p-2 min-h-[50vh]">
<div className="flex flex-col gap-4">
<div className="w-full h-full bg-input rounded-lg p-2 ">
<div id={id} ref={termRef} className="rounded-xl" />
</div>
</div>