refactor: remove unsued files

This commit is contained in:
Mauricio Siu
2024-12-14 22:46:01 -06:00
parent e643255a67
commit d20f86ffe1
15 changed files with 106 additions and 680 deletions
@@ -11,7 +11,7 @@ import { api } from "@/utils/api";
import dynamic from "next/dynamic";
import type React from "react";
const Terminal = dynamic(() => import("./terminal").then((e) => e.Terminal), {
const Terminal = dynamic(async () => (await import("./terminal")).Terminal, {
ssr: false,
});
@@ -4,6 +4,7 @@ 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;
@@ -20,13 +21,11 @@ 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: "#19191A",
background: "transparent",
},
});
const addonFit = new FitAddon();
@@ -42,15 +41,17 @@ 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">
<div className="w-full h-full bg-input rounded-lg p-2 ">
<div className="flex flex-col gap-4 w-full">
<div className="w-full h-full border rounded-lg p-2 min-h-[50vh]">
<div id={id} ref={termRef} className="rounded-xl" />
</div>
</div>