Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
chore: dashboard loading state (#2545)
Maximilian Kaske10fd7ff6cb41
diff --git a/apps/dashboard/src/app/(dashboard)/layout.tsx b/apps/dashboard/src/app/(dashboard)/layout.tsxindex 499cac3c4..b7b9fbb72 100644--- a/apps/dashboard/src/app/(dashboard)/layout.tsx+++ b/apps/dashboard/src/app/(dashboard)/layout.tsx@@ -49,6 +49,7 @@ async function HydrateSidebar({ children }: { children: React.ReactNode }) {await Promise.all([queryClient.prefetchQuery(trpc.page.list.queryOptions()),queryClient.prefetchQuery(trpc.monitor.list.queryOptions()),+ queryClient.prefetchQuery(trpc.notification.list.queryOptions()),queryClient.prefetchQuery(trpc.workspace.get.queryOptions()),queryClient.prefetchQuery(trpc.workspace.list.queryOptions()),queryClient.prefetchQuery(trpc.user.get.queryOptions()),diff --git a/apps/dashboard/src/app/(dashboard)/monitors/[id]/edit/layout.tsx b/apps/dashboard/src/app/(dashboard)/monitors/[id]/edit/layout.tsxindex a0d468874..7132fc6b9 100644--- a/apps/dashboard/src/app/(dashboard)/monitors/[id]/edit/layout.tsx+++ b/apps/dashboard/src/app/(dashboard)/monitors/[id]/edit/layout.tsx@@ -9,7 +9,6 @@ export default async function Layout({await Promise.all([queryClient.prefetchQuery(trpc.monitorTag.list.queryOptions()),queryClient.prefetchQuery(trpc.privateLocation.list.queryOptions()),- queryClient.prefetchQuery(trpc.notification.list.queryOptions()),]);return <HydrateClient>{children}</HydrateClient>;diff --git a/apps/dashboard/src/app/(dashboard)/notifications/layout.tsx b/apps/dashboard/src/app/(dashboard)/notifications/layout.tsxindex dce979381..3b3dc63c2 100644--- a/apps/dashboard/src/app/(dashboard)/notifications/layout.tsx+++ b/apps/dashboard/src/app/(dashboard)/notifications/layout.tsx@@ -4,7 +4,7 @@ import {AppHeaderContent,} from "@/components/nav/app-header";import { AppSidebarTrigger } from "@/components/nav/app-sidebar";-import { HydrateClient, getQueryClient, trpc } from "@/lib/trpc/server";+import { HydrateClient } from "@/lib/trpc/server";import { Breadcrumb } from "./breadcrumb";import { NavActions } from "./nav-actions";@@ -14,8 +14,6 @@ export default async function Layout({}: {children: React.ReactNode;}) {- const queryClient = getQueryClient();- await queryClient.prefetchQuery(trpc.notification.list.queryOptions());return (<HydrateClient><AppHeader>diff --git a/apps/dashboard/src/app/(dashboard)/overview/layout.tsx b/apps/dashboard/src/app/(dashboard)/overview/layout.tsxindex 988a11e2c..b7c410f40 100644--- a/apps/dashboard/src/app/(dashboard)/overview/layout.tsx+++ b/apps/dashboard/src/app/(dashboard)/overview/layout.tsx@@ -16,8 +16,6 @@ export default async function Layout({}) {const queryClient = getQueryClient();- // inputs must match page.tsx's queries exactly — a differing input misses the cache- // `monitor.list` / `page.list` come from the root layout's sidebar prefetch.await Promise.all([queryClient.prefetchQuery(trpc.incident.list.queryOptions()),queryClient.prefetchQuery(trpc.statusReport.list.queryOptions({})),diff --git a/apps/dashboard/src/app/(dashboard)/page.tsx b/apps/dashboard/src/app/(dashboard)/page.tsxindex 2d0fb1d66..8cd2e9aa1 100644--- a/apps/dashboard/src/app/(dashboard)/page.tsx+++ b/apps/dashboard/src/app/(dashboard)/page.tsx@@ -1,5 +1,8 @@import { redirect } from "next/navigation";+import RootLoading from "../loading";+export default function Page() {redirect("/overview");+ return <RootLoading />;}diff --git a/apps/dashboard/src/app/(dashboard)/settings/integrations/layout.tsx b/apps/dashboard/src/app/(dashboard)/settings/integrations/layout.tsxindex dbc79ae90..7ea6ecf4d 100644--- a/apps/dashboard/src/app/(dashboard)/settings/integrations/layout.tsx+++ b/apps/dashboard/src/app/(dashboard)/settings/integrations/layout.tsx@@ -16,10 +16,7 @@ export default async function Layout({children: React.ReactNode;}) {const queryClient = getQueryClient();- await Promise.all([- queryClient.prefetchQuery(trpc.integrationRouter.list.queryOptions()),- queryClient.prefetchQuery(trpc.workspace.get.queryOptions()),- ]);+ await queryClient.prefetchQuery(trpc.integrationRouter.list.queryOptions());return (<HydrateClient>diff --git a/apps/dashboard/src/app/(dashboard)/settings/private-locations/layout.tsx b/apps/dashboard/src/app/(dashboard)/settings/private-locations/layout.tsxindex f33fb7f33..d2ab92c0e 100644--- a/apps/dashboard/src/app/(dashboard)/settings/private-locations/layout.tsx+++ b/apps/dashboard/src/app/(dashboard)/settings/private-locations/layout.tsx@@ -16,10 +16,7 @@ export default async function Layout({children: React.ReactNode;}) {const queryClient = getQueryClient();- await Promise.all([- queryClient.prefetchQuery(trpc.notification.list.queryOptions()),- queryClient.prefetchQuery(trpc.privateLocation.list.queryOptions()),- ]);+ await queryClient.prefetchQuery(trpc.privateLocation.list.queryOptions());return (<HydrateClient><div>diff --git a/apps/dashboard/src/app/(dashboard)/settings/sso/layout.tsx b/apps/dashboard/src/app/(dashboard)/settings/sso/layout.tsxindex 36b8d7cb4..558cf78d0 100644--- a/apps/dashboard/src/app/(dashboard)/settings/sso/layout.tsx+++ b/apps/dashboard/src/app/(dashboard)/settings/sso/layout.tsx@@ -4,20 +4,13 @@ import {AppHeaderContent,} from "@/components/nav/app-header";import { AppSidebarTrigger } from "@/components/nav/app-sidebar";-import { HydrateClient, getQueryClient, trpc } from "@/lib/trpc/server";+import { HydrateClient } from "@/lib/trpc/server";import { Tabs } from "../tabs";import { Breadcrumb } from "./breadcrumb";import { NavActions } from "./nav-actions";-export default async function Layout({- children,-}: {- children: React.ReactNode;-}) {- const queryClient = getQueryClient();- await queryClient.prefetchQuery(trpc.workspace.get.queryOptions());-+export default function Layout({ children }: { children: React.ReactNode }) {return (<HydrateClient><div>diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/components/layout.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/components/layout.tsxindex 485029f79..147ed517b 100644--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/components/layout.tsx+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/components/layout.tsx@@ -18,14 +18,9 @@ export default async function Layout({const { id } = await params;const queryClient = getQueryClient();- await Promise.all([- queryClient.prefetchQuery(- trpc.page.get.queryOptions({ id: Number.parseInt(id) }),- ),- queryClient.prefetchQuery(- trpc.pageComponent.list.queryOptions({ pageId: Number.parseInt(id) }),- ),- ]);+ await queryClient.prefetchQuery(+ trpc.pageComponent.list.queryOptions({ pageId: Number.parseInt(id) }),+ );const defaultOpen = await getSidebarDefaultOpen(RIGHT_SIDEBAR_COOKIE, false);return (diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/edit/layout.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/edit/layout.tsxnew file mode 100644index 000000000..a40341a7d--- /dev/null+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/edit/layout.tsx@@ -0,0 +1,9 @@+import { HydrateClient } from "@/lib/trpc/server";++export default async function Layout({+ children,+}: {+ children: React.ReactNode;+}) {+ return <HydrateClient>{children}</HydrateClient>;+}diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/layout.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/layout.tsxindex 485029f79..4309af29d 100644--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/layout.tsx+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/layout.tsx@@ -4,28 +4,16 @@ import {RIGHT_SIDEBAR_COOKIE,getSidebarDefaultOpen,} from "@/lib/sidebar-cookie";-import { HydrateClient, getQueryClient, trpc } from "@/lib/trpc/server";+import { HydrateClient } from "@/lib/trpc/server";import { Sidebar } from "../sidebar";export default async function Layout({children,- params,}: {children: React.ReactNode;params: Promise<{ id: string }>;}) {- const { id } = await params;- const queryClient = getQueryClient();-- await Promise.all([- queryClient.prefetchQuery(- trpc.page.get.queryOptions({ id: Number.parseInt(id) }),- ),- queryClient.prefetchQuery(- trpc.pageComponent.list.queryOptions({ pageId: Number.parseInt(id) }),- ),- ]);const defaultOpen = await getSidebarDefaultOpen(RIGHT_SIDEBAR_COOKIE, false);return (diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/[reportId]/layout.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/[reportId]/layout.tsxindex 5b2d27ade..598562540 100644--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/[reportId]/layout.tsx+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/[reportId]/layout.tsx@@ -7,14 +7,9 @@ export default async function Layout({children: React.ReactNode;params: Promise<{ id: string; reportId: string }>;}) {- const { id, reportId } = await params;- await Promise.all([- fetchQueryOrNotFound(- trpc.statusReport.get.queryOptions({ id: Number.parseInt(reportId) }),- ),- fetchQueryOrNotFound(- trpc.page.get.queryOptions({ id: Number.parseInt(id) }),- ),- ]);+ const { reportId } = await params;+ await fetchQueryOrNotFound(+ trpc.statusReport.get.queryOptions({ id: Number.parseInt(reportId) }),+ );return <HydrateClient>{children}</HydrateClient>;}diff --git a/apps/dashboard/src/app/globals.css b/apps/dashboard/src/app/globals.cssindex a175fd6ce..4130e0bde 100644--- a/apps/dashboard/src/app/globals.css+++ b/apps/dashboard/src/app/globals.css@@ -8,6 +8,21 @@@theme {--breakpoint-xs: 30rem;++ /* A 0.3s hold, then a 0.3s half-turn, on repeat. The mark is symmetric under+ * a half turn, so every cycle ends where it visually began and the loop never+ * jumps. ease-in-out because a linear turn that stops dead looks broken. */+ --animate-spin-half: spin-half 0.6s ease-in-out infinite;++ @keyframes spin-half {+ 0%,+ 50% {+ transform: rotate(0deg);+ }+ 100% {+ transform: rotate(180deg);+ }+ }}@theme inline {diff --git a/apps/dashboard/src/app/loading.tsx b/apps/dashboard/src/app/loading.tsxnew file mode 100644index 000000000..394d8e117--- /dev/null+++ b/apps/dashboard/src/app/loading.tsx@@ -0,0 +1,10 @@+import { OpenStatusIcon } from "@openstatus/icons/brand";++export default function RootLoading() {+ return (+ <div className="flex min-h-svh w-full items-center justify-center">+ <OpenStatusIcon className="animate-spin-half text-foreground size-12" />+ <span className="sr-only">Loading</span>+ </div>+ );+}diff --git a/packages/icons/src/brand/index.tsx b/packages/icons/src/brand/index.tsxindex f831a897f..cc46bd571 100644--- a/packages/icons/src/brand/index.tsx+++ b/packages/icons/src/brand/index.tsx@@ -21,3 +21,4 @@ export * from "./x";export * from "./linkedin";export * from "./bluesky";export * from "./youtube";+export * from "./openstatus";diff --git a/packages/icons/src/brand/openstatus.tsx b/packages/icons/src/brand/openstatus.tsxnew file mode 100644index 000000000..da4b076f8--- /dev/null+++ b/packages/icons/src/brand/openstatus.tsx@@ -0,0 +1,29 @@+export function OpenStatusIcon(props: React.ComponentProps<"svg">) {+ return (+ <svg+ role="img"+ viewBox="0 0 330 330"+ xmlns="http://www.w3.org/2000/svg"+ fill="currentColor"+ {...props}+ >+ <title>openstatus</title>+ {/* Bars are punched out rather than filled, so the mark sits on any+ * background. The id is static: duplicate instances resolve to the first+ * definition, which is identical. */}+ <mask+ id="openstatus-mark"+ maskUnits="userSpaceOnUse"+ x="0"+ y="0"+ width="330"+ height="330"+ >+ <circle cx="165" cy="165" r="165" fill="white" />+ <path d="M330 96H122V111H330V96Z" fill="black" />+ <path d="M208 219H0V234H208V219Z" fill="black" />+ </mask>+ <circle cx="165" cy="165" r="165" mask="url(#openstatus-mark)" />+ </svg>+ );+}