diff --git a/site/src/modules/workspaces/WorkspaceTiming/Chart/Tooltip.tsx b/site/src/modules/workspaces/WorkspaceTiming/Chart/Tooltip.tsx deleted file mode 100644 index ad86ce9d59..0000000000 --- a/site/src/modules/workspaces/WorkspaceTiming/Chart/Tooltip.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { css } from "@emotion/css"; -import { type Interpolation, type Theme, useTheme } from "@emotion/react"; -import MUITooltip, { - type TooltipProps as MUITooltipProps, -} from "@mui/material/Tooltip"; -import { ExternalLinkIcon } from "lucide-react"; -import type { FC, HTMLProps } from "react"; -import { Link, type LinkProps } from "react-router"; - -export type TooltipProps = MUITooltipProps; - -export const Tooltip: FC = (props) => { - const theme = useTheme(); - - return ( - - ); -}; - -export const TooltipTitle: FC> = (props) => { - return ; -}; - -export const TooltipShortDescription: FC> = ( - props, -) => { - return ; -}; - -export const TooltipLink: FC = (props) => { - return ( - - - {props.children} - - ); -}; - -const styles = { - tooltip: (theme) => ({ - backgroundColor: theme.palette.background.default, - border: `1px solid ${theme.palette.divider}`, - maxWidth: "max-content", - borderRadius: 8, - display: "flex", - flexDirection: "column", - fontWeight: 500, - fontSize: 12, - color: theme.palette.text.secondary, - gap: 4, - }), - title: (theme) => ({ - color: theme.palette.text.primary, - display: "block", - }), - link: (theme) => ({ - color: "inherit", - textDecoration: "none", - display: "flex", - alignItems: "center", - gap: 4, - - "&:hover": { - color: theme.palette.text.primary, - }, - - "& svg": { - width: 12, - height: 12, - }, - }), - shortDesc: { - maxWidth: 280, - }, -} satisfies Record>; diff --git a/site/src/modules/workspaces/WorkspaceTiming/ResourcesChart.tsx b/site/src/modules/workspaces/WorkspaceTiming/ResourcesChart.tsx index 143b5e51d7..e474e62626 100644 --- a/site/src/modules/workspaces/WorkspaceTiming/ResourcesChart.tsx +++ b/site/src/modules/workspaces/WorkspaceTiming/ResourcesChart.tsx @@ -1,5 +1,12 @@ import { type Theme, useTheme } from "@emotion/react"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "components/Tooltip/Tooltip"; +import { ExternalLinkIcon } from "lucide-react"; import { type FC, useState } from "react"; +import { Link } from "react-router"; import { Bar } from "./Chart/Bar"; import { Chart, @@ -10,7 +17,6 @@ import { ChartSearch, ChartToolbar, } from "./Chart/Chart"; -import { Tooltip, TooltipLink, TooltipTitle } from "./Chart/Tooltip"; import { calcDuration, calcOffset, @@ -116,23 +122,31 @@ export const ResourcesChart: FC = ({ key={t.name} yAxisLabelId={encodeURIComponent(t.name)} > - - {label} - {/* Stage boundaries should not have these links */} - {!stageBoundary && ( - view template - )} - - } - > - + + + + + +

{label}

+ {/* Stage boundaries should not have these links */} + {!stageBoundary && ( + + + view template + + )} +
{formatTime(duration)} diff --git a/site/src/modules/workspaces/WorkspaceTiming/ScriptsChart.tsx b/site/src/modules/workspaces/WorkspaceTiming/ScriptsChart.tsx index d0f6ac6045..ecf826a763 100644 --- a/site/src/modules/workspaces/WorkspaceTiming/ScriptsChart.tsx +++ b/site/src/modules/workspaces/WorkspaceTiming/ScriptsChart.tsx @@ -1,4 +1,9 @@ import { type Theme, useTheme } from "@emotion/react"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "components/Tooltip/Tooltip"; import { type FC, useState } from "react"; import { Bar } from "./Chart/Bar"; import { @@ -10,7 +15,6 @@ import { ChartSearch, ChartToolbar, } from "./Chart/Chart"; -import { Tooltip, TooltipTitle } from "./Chart/Tooltip"; import { calcDuration, calcOffset, @@ -103,19 +107,21 @@ export const ScriptsChart: FC = ({ key={t.name} yAxisLabelId={encodeURIComponent(t.name)} > - - Script exited with code {t.exitCode} - - } - > - + + + + + + Script exited with code {t.exitCode} + {formatTime(duration)} diff --git a/site/src/modules/workspaces/WorkspaceTiming/StagesChart.tsx b/site/src/modules/workspaces/WorkspaceTiming/StagesChart.tsx index 103d4717f2..a14672f6b1 100644 --- a/site/src/modules/workspaces/WorkspaceTiming/StagesChart.tsx +++ b/site/src/modules/workspaces/WorkspaceTiming/StagesChart.tsx @@ -1,16 +1,15 @@ import type { Interpolation, Theme } from "@emotion/react"; import type { TimingStage } from "api/typesGenerated"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "components/Tooltip/Tooltip"; import { CircleAlertIcon, InfoIcon } from "lucide-react"; import type { FC } from "react"; import { Bar, ClickableBar } from "./Chart/Bar"; import { Blocks } from "./Chart/Blocks"; import { Chart, ChartContent } from "./Chart/Chart"; -import { - Tooltip, - type TooltipProps, - TooltipShortDescription, - TooltipTitle, -} from "./Chart/Tooltip"; import { calcDuration, calcOffset, @@ -45,7 +44,10 @@ export type Stage = { /** * The tooltip is used to provide additional information about the stage. */ - tooltip: Omit; + tooltip: { + heading: string; + description: string; + }; }; type StageTiming = { @@ -105,11 +107,22 @@ export const StagesChart: FC = ({ > {stage.label} - - + + + + + +

+ {stage.tooltip.heading} +

+

{stage.tooltip.description}

+
@@ -219,14 +232,8 @@ export const provisioningStages: Stage[] = [ label: "init", section: "provisioning", tooltip: { - title: ( - <> - Terraform initialization - - Download providers & modules. - - - ), + heading: "Terraform initialization", + description: "Download providers & modules.", }, }, { @@ -234,15 +241,9 @@ export const provisioningStages: Stage[] = [ label: "plan", section: "provisioning", tooltip: { - title: ( - <> - Terraform plan - - Compare state of desired vs actual resources and compute changes to - be made. - - - ), + heading: "Terraform plan", + description: + "Compare state of desired vs actual resources and compute changes to be made.", }, }, { @@ -250,14 +251,9 @@ export const provisioningStages: Stage[] = [ label: "graph", section: "provisioning", tooltip: { - title: ( - <> - Terraform graph - - List all resources in plan, used to update coderd database. - - - ), + heading: "Terraform graph", + description: + "List all resources in plan, used to update coderd database.", }, }, { @@ -265,15 +261,9 @@ export const provisioningStages: Stage[] = [ label: "apply", section: "provisioning", tooltip: { - title: ( - <> - Terraform apply - - Execute Terraform plan to create/modify/delete resources into - desired states. - - - ), + heading: "Terraform apply", + description: + "Execute Terraform plan to create/modify/delete resources into desired states.", }, }, ]; @@ -285,14 +275,8 @@ export const agentStages = (section: string): Stage[] => { label: "connect", section, tooltip: { - title: ( - <> - Connect - - Establish an RPC connection with the control plane. - - - ), + heading: "Connect", + description: "Establish an RPC connection with the control plane.", }, }, { @@ -300,14 +284,8 @@ export const agentStages = (section: string): Stage[] => { label: "run startup scripts", section, tooltip: { - title: ( - <> - Run startup scripts - - Execute each agent startup script. - - - ), + heading: "Run startup scripts", + description: "Execute each agent startup script.", }, }, ];