@@ -42,6 +46,12 @@ export function CreateEventButtonGroup() {
Create Maintenance
+ {incidentsEnabled ? (
+
setIncidentOpen(true)}>
+
+ Declare Incident
+
+ ) : null}
@@ -49,6 +59,10 @@ export function CreateEventButtonGroup() {
open={maintenanceOpen}
onOpenChange={setMaintenanceOpen}
/>
+ {/* Mounted on demand: the sheet fetches integrations as soon as it renders. */}
+ {incidentsEnabled && incidentOpen ? (
+
+ ) : null}
);
}
diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/breadcrumb.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/breadcrumb.tsx
index 6ae97cfa..f9deb367 100644
--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/breadcrumb.tsx
+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/breadcrumb.tsx
@@ -5,17 +5,33 @@ import { useQuery } from "@tanstack/react-query";
import { useParams, usePathname } from "next/navigation";
import { NavBreadcrumb } from "@/components/nav/nav-breadcrumb";
+import { useHydrated } from "@/hooks/use-hydrated";
import { useTRPC } from "@/lib/trpc/client";
import { STATUS_PAGE_TABS } from "./constants";
export function Breadcrumb() {
- const { id } = useParams<{ id: string }>();
+ // The entity crumb depends on data the page hydrates after this layout
+ // streamed, so it is only rendered on the client.
+ const hydrated = useHydrated();
+ const { id, reportId, maintenanceId } = useParams<{
+ id: string;
+ reportId?: string;
+ maintenanceId?: string;
+ }>();
const pathname = usePathname();
const trpc = useTRPC();
const { data: statusPage } = useQuery(
trpc.page.get.queryOptions({ id: Number.parseInt(id) }),
);
+ const { data: report } = useQuery({
+ ...trpc.statusReport.get.queryOptions({ id: Number(reportId) }),
+ enabled: reportId !== undefined,
+ });
+ const { data: maintenance } = useQuery({
+ ...trpc.maintenance.get.queryOptions({ id: Number(maintenanceId) }),
+ enabled: maintenanceId !== undefined,
+ });
if (!statusPage) return null;
@@ -23,6 +39,8 @@ export function Breadcrumb() {
const currentTab = STATUS_PAGE_TABS.find((tab) =>
segments.includes(tab.value),
);
+ const onDetail = reportId !== undefined || maintenanceId !== undefined;
+ const entity = hydrated ? (report?.title ?? maintenance?.title) : undefined;
return (