Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
"use client";
import { ExternalLink } from "@openstatus/icons";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@openstatus/ui/components/ui/tooltip";
import { useCopyToClipboard } from "@openstatus/ui/hooks/use-copy-to-clipboard";
import { useQuery } from "@tanstack/react-query";
import { useParams } from "next/navigation";
import { Link } from "@/components/common/link";
import { TableCellEmpty } from "@/components/data-table/table-cell-empty";
import { TableCellLink } from "@/components/data-table/table-cell-link";
import { configurationLabels } from "@/components/forms/status-page/form-configuration";
import { SidebarRight } from "@/components/nav/sidebar-right";
import { getPageUrl } from "@/data/status-pages.client";
import { useTRPC } from "@/lib/trpc/client";
export function Sidebar() {
const { id } = useParams<{ id: string }>();
const trpc = useTRPC();
const { data: statusPage } = useQuery(
trpc.page.get.queryOptions({ id: Number.parseInt(id) }),
);
const { copy } = useCopyToClipboard();
if (!statusPage) return null;
const BADGE_URL = `${getPageUrl(statusPage)}/badge/v2`;
return (
<SidebarRight
header="Status Page"
metadata={[
{
label: "Overview",
items: [
{
label: "Slug",
value: (
<Link href={getPageUrl(statusPage)} target="_blank">
{statusPage.slug}
</Link>
),
},
{
label: "Access Type",
value: statusPage.accessType,
},
{
label: "Domain",
value: statusPage.customDomain || (
<TableCellEmpty>No domain</TableCellEmpty>
),
},
{
label: "Favicon",
value: statusPage.icon ? (
<div className="bg-muted size-4 overflow-hidden rounded border">
<img src={statusPage.icon} alt="favicon" />
</div>
) : (
<TableCellEmpty>No favicon</TableCellEmpty>
),
},
{
label: "Badge",
value: (
<TooltipProvider>
<Tooltip>
<TooltipTrigger className="align-middle">
<img
className="h-5 rounded-sm border"
src={BADGE_URL}
alt="badge"
/>
</TooltipTrigger>
<TooltipContent
className="cursor-pointer"
side="left"
onClick={() => copy(BADGE_URL, { withToast: true })}
>
{BADGE_URL}
</TooltipContent>
</Tooltip>
</TooltipProvider>
),
},
],
},
{
label: "Configuration",
items: [
{
label: "Theme",
value: statusPage.configuration?.theme ?? (
<TableCellEmpty>Default</TableCellEmpty>
),
},
{
label: "Status source",
value: statusPage.configuration?.type ? (
configurationLabels.type[statusPage.configuration.type]
) : (
<TableCellEmpty>Default</TableCellEmpty>
),
},
{
label: "Card shows",
value: statusPage.configuration?.value ? (
configurationLabels.value[statusPage.configuration.value]
) : (
<TableCellEmpty>Default</TableCellEmpty>
),
},
{
label: "Show Uptime",
value: statusPage.configuration?.uptime ? "Yes" : "No",
},
],
},
{
label: "Monitors",
emptyMessage: "No monitors attached",
items: statusPage.pageComponents.flatMap((component) => {
const arr = [];
arr.push({
label: "Name",
value: (
<TableCellLink
href={`/status-pages/${statusPage.id}/components`}
value={component.name}
/>
),
});
arr.push({
label: "Type",
value: component.type,
isNested: true,
});
return arr;
}),
},
]}
footerButton={{
onClick: () =>
typeof window !== "undefined" &&
window.open(getPageUrl(statusPage), "_blank"),
children: (
<>
<ExternalLink />
<span>Visit Status Page</span>
</>
),
}}
/>
);
}