Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
refactor: description string to react node (#704)
Maximilian Kaske9bd546e59303
diff --git a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/layout.tsx b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/layout.tsxindex 1eeda2bc7..7ccc70be5 100644--- a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/layout.tsx+++ b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/layout.tsx@@ -1,7 +1,10 @@import { notFound } from "next/navigation";+import { Badge } from "@openstatus/ui";+import { Header } from "@/components/dashboard/header";import AppPageWithSidebarLayout from "@/components/layout/app-page-with-sidebar-layout";+import { StatusDotWithTooltip } from "@/components/monitor/status-dot-with-tooltip";import { api } from "@/trpc/server";export default async function Layout({@@ -23,7 +26,27 @@ export default async function Layout({return (<AppPageWithSidebarLayout id="monitors">- <Header title={monitor.name} description={monitor.url} />+ <Header+ title={monitor.name}+ description={+ <div className="text-muted-foreground flex items-center gap-2">+ <span>{monitor.url}</span>+ <span className="text-muted-foreground/50 text-xs">•</span>+ <StatusDotWithTooltip+ active={monitor.active}+ status={monitor.status}+ />+ <span className="text-muted-foreground/50 text-xs">•</span>+ <Badge className="inline-flex" variant="secondary">+ {monitor.method}+ </Badge>+ <span className="text-muted-foreground/50 text-xs">•</span>+ <span className="text-sm">+ every <code>{monitor.periodicity}</code>+ </span>+ </div>+ }+ />{children}</AppPageWithSidebarLayout>);diff --git a/apps/web/src/components/dashboard/header.tsx b/apps/web/src/components/dashboard/header.tsxindex 9f8c73a05..57a4af36b 100644--- a/apps/web/src/components/dashboard/header.tsx+++ b/apps/web/src/components/dashboard/header.tsx@@ -4,7 +4,7 @@ import { cn } from "@/lib/utils";interface HeaderProps extends React.HTMLAttributes<HTMLDivElement> {title?: string;- description?: string | null;+ description?: React.ReactNode;actions?: React.ReactNode | React.ReactNode[];}@@ -21,9 +21,11 @@ function Header({ title, description, className, actions }: HeaderProps) {><div className="flex min-w-0 flex-col gap-1"><h1 className="font-cal text-3xl">{title}</h1>- {description ? (+ {typeof description === "string" ? (<p className="text-muted-foreground">{description}</p>- ) : null}+ ) : (+ description+ )}</div>{actions ? (<div className="flex flex-1 items-center justify-end gap-2">diff --git a/apps/web/src/components/data-table/monitor/columns.tsx b/apps/web/src/components/data-table/monitor/columns.tsxindex 743b3606a..ee507adc0 100644--- a/apps/web/src/components/data-table/monitor/columns.tsx+++ b/apps/web/src/components/data-table/monitor/columns.tsx@@ -17,7 +17,7 @@ import {TooltipTrigger,} from "@openstatus/ui";-import { StatusDot } from "@/components/monitor/status-dot";+import { StatusDotWithTooltip } from "@/components/monitor/status-dot-with-tooltip";import { Bar } from "@/components/tracker/tracker";import { DataTableRowActions } from "./data-table-row-actions";@@ -37,7 +37,7 @@ export const columns: ColumnDef<{href={`./monitors/${row.original.monitor.id}/overview`}className="group flex max-w-[150px] items-center gap-2 md:max-w-[250px]">- <StatusDot active={active} status={status} />+ <StatusDotWithTooltip active={active} status={status} /><span className="truncate group-hover:underline">{name}</span></Link>);diff --git a/apps/web/src/components/monitor/status-dot-with-tooltip.tsx b/apps/web/src/components/monitor/status-dot-with-tooltip.tsxnew file mode 100644index 000000000..51dd7fe74--- /dev/null+++ b/apps/web/src/components/monitor/status-dot-with-tooltip.tsx@@ -0,0 +1,34 @@+import type { Monitor } from "@openstatus/db/src/schema";+import {+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from "@openstatus/ui";++import { StatusDot } from "./status-dot";++export interface StatusDotWithTooltipProps+ extends Pick<Monitor, "active" | "status"> {}++export function StatusDotWithTooltip({+ status,+ active,+}: StatusDotWithTooltipProps) {+ return (+ <TooltipProvider delayDuration={50}>+ <Tooltip>+ <TooltipTrigger>+ <StatusDot {...{ status, active }} />+ </TooltipTrigger>+ <TooltipContent>+ {active+ ? status === "active"+ ? "Monitor is active"+ : "Monitor has failed"+ : "Monitor is inactive"}+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ );+}diff --git a/apps/web/src/components/monitor/status-dot.tsx b/apps/web/src/components/monitor/status-dot.tsxindex 2d7928de4..0f92e9ffa 100644--- a/apps/web/src/components/monitor/status-dot.tsx+++ b/apps/web/src/components/monitor/status-dot.tsx@@ -1,9 +1,8 @@import type { Monitor } from "@openstatus/db/src/schema";-export function StatusDot({- active,- status,-}: Pick<Monitor, "active" | "status">) {+export interface StatusDotProps extends Pick<Monitor, "active" | "status"> {}++export function StatusDot({ active, status }: StatusDotProps) {if (!active) {return (<span className="relative flex h-2 w-2">