From ebe05820c94e82f0cb47956b153b9d2de340a065 Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Wed, 21 Feb 2024 11:02:53 -0300 Subject: [PATCH] fix(site): fix web terminal bottom overflow (#12228) --- site/src/pages/TerminalPage/TerminalPage.tsx | 129 +++---------------- 1 file changed, 16 insertions(+), 113 deletions(-) diff --git a/site/src/pages/TerminalPage/TerminalPage.tsx b/site/src/pages/TerminalPage/TerminalPage.tsx index a453b76ee0..312200d24d 100644 --- a/site/src/pages/TerminalPage/TerminalPage.tsx +++ b/site/src/pages/TerminalPage/TerminalPage.tsx @@ -1,4 +1,4 @@ -import { type Interpolation, type Theme, useTheme } from "@emotion/react"; +import { type Interpolation, type Theme } from "@emotion/react"; import { type FC, useCallback, useEffect, useRef, useState } from "react"; import { Helmet } from "react-helmet-async"; import { useNavigate, useParams, useSearchParams } from "react-router-dom"; @@ -13,9 +13,6 @@ import "xterm/css/xterm.css"; import { MONOSPACE_FONT_FAMILY } from "theme/constants"; import { pageTitle } from "utils/page"; import { useProxy } from "contexts/ProxyContext"; -import type { Region } from "api/typesGenerated"; -import { getLatencyColor } from "utils/latency"; -import { ProxyStatusLatency } from "components/ProxyStatusLatency/ProxyStatusLatency"; import { openMaybePortForwardedURL } from "utils/portForward"; import { terminalWebsocketUrl } from "utils/terminal"; import { getMatchingAgentOrFirst } from "utils/workspace"; @@ -28,11 +25,6 @@ import { import { useQuery } from "react-query"; import { deploymentConfig } from "api/queries/deployment"; import { workspaceByOwnerAndName } from "api/queries/workspaces"; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "components/Popover/Popover"; import { ThemeOverride } from "contexts/ThemeProvider"; import themes from "theme"; @@ -57,6 +49,7 @@ const TerminalPage: FC = () => { "connected" | "disconnected" | "initializing" >("initializing"); const [searchParams] = useSearchParams(); + const isDebugging = searchParams.has("debug"); // The reconnection token is a unique token that identifies // a terminal session. It's generated by the client to reduce // a round-trip, and must be a UUIDv4. @@ -316,126 +309,36 @@ const TerminalPage: FC = () => { prevLifecycleState.current === "starting" && } {terminalState === "disconnected" && }
- {selectedProxy && latency && ( - - )}
- - ); -}; -interface BottomBarProps { - proxy: Region; - latency?: number; -} - -const BottomBar: FC = ({ proxy, latency }) => { - const theme = useTheme(); - const color = getLatencyColor(theme, latency); - - return ( -
- - - - - -
- Selected proxy -
-
-
-
- -
- {proxy.display_name} -
- -
-
-
-
+ Latency: {latency.latencyMS.toFixed(0)}ms + + )} + ); }; const styles = { terminal: (theme) => ({ - width: "100vw", + width: "100%", overflow: "hidden", backgroundColor: theme.palette.background.paper, flex: 1, // These styles attempt to mimic the VS Code scrollbar. "& .xterm": { padding: 4, - width: "100vw", - height: "100vh", + width: "100%", + height: "100%", }, "& .xterm-viewport": { // This is required to force full-width on the terminal.