Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
chore: update dashboard folder and layout (#28)
Maximilian Kaske08cff6f933e7
diff --git a/apps/web/.env.example b/apps/web/.env.exampleindex 7e129d07c..eb730d874 100644--- a/apps/web/.env.example+++ b/apps/web/.env.example@@ -3,10 +3,10 @@ NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=CLERK_SECRET_KEY=CLERK_WEBHOOK_SECRET=-NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in-NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up-NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/-NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/+NEXT_PUBLIC_CLERK_SIGN_IN_URL=/app/sign-in+NEXT_PUBLIC_CLERK_SIGN_UP_URL=/app/sign-up+NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/app+NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/app# TinyBirdTINY_BIRD_API_KEY=@@ -23,3 +23,6 @@ QSTASH_NEXT_SIGNING_KEY=QSTASH_TOKEN=RESEND_API_KEY='api-key'++# Solves 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY', see https://github.com/nextauthjs/next-auth/issues/3580+# NODE_TLS_REJECT_UNAUTHORIZED="0"\ No newline at end of filediff --git a/apps/web/src/app/app/(auth)/layout.tsx b/apps/web/src/app/app/(auth)/layout.tsxnew file mode 100644index 000000000..b3126c686--- /dev/null+++ b/apps/web/src/app/app/(auth)/layout.tsx@@ -0,0 +1,43 @@+import * as React from "react";++// TODO: update description++export default function AuthLayout({+ children,+}: {+ children: React.ReactNode;+}) {+ return (+ <div className="grid min-h-screen grid-cols-1 md:grid-cols-2 xl:grid-cols-3">+ <aside className="border-border col-span-1 flex w-full items-center justify-center border p-3 backdrop-blur-[2px] md:p-6">+ <div className="w-full max-w-lg text-left">+ <h1 className="font-cal text-foreground mb-3 text-2xl">+ Open Source Status Page+ </h1>+ <p className="text-muted-foreground">+ Create your own status page within a couple of minutes. You are+ developer and want to know how it works? <br />+ Check out{" "}+ <a+ href="https://github.com/mxkaske/openstatus"+ target="_blank"+ rel="noreferrer"+ className="text-foreground underline underline-offset-4 hover:no-underline"+ >+ GitHub+ </a>{" "}+ and let us know your use case!+ </p>+ {/* Add Demo tracker here? */}+ <div className="h-12" />+ <p className="text-muted-foreground text-right text-sm font-light">+ *your data is safe+ </p>+ </div>+ </aside>+ <main className="container col-span-1 mx-auto flex items-center justify-center md:col-span-1 xl:col-span-2">+ {children}+ </main>+ </div>+ );+}diff --git a/apps/web/src/app/sign-in/[[...sign-in]]/page.tsx b/apps/web/src/app/app/(auth)/sign-in/[[...sign-in]]/page.tsxsimilarity index 100%rename from apps/web/src/app/sign-in/[[...sign-in]]/page.tsxrename to apps/web/src/app/app/(auth)/sign-in/[[...sign-in]]/page.tsxdiff --git a/apps/web/src/app/sign-up/[[...sign-up]]/page.tsx b/apps/web/src/app/app/(auth)/sign-up/[[...sign-up]]/page.tsxsimilarity index 100%rename from apps/web/src/app/sign-up/[[...sign-up]]/page.tsxrename to apps/web/src/app/app/(auth)/sign-up/[[...sign-up]]/page.tsxdiff --git a/apps/web/src/app/app/(dashboard)/endpoint/page.tsx b/apps/web/src/app/app/(dashboard)/endpoint/page.tsxnew file mode 100644index 000000000..e01a3bb9a--- /dev/null+++ b/apps/web/src/app/app/(dashboard)/endpoint/page.tsx@@ -0,0 +1,11 @@+import * as React from "react";++import { Header } from "@/components/header";++export default function EndpointPage() {+ return (+ <div>+ <Header title="Endpoint" description="Overview of all your sites." />+ </div>+ );+}diff --git a/apps/web/src/app/app/(dashboard)/incident/page.tsx b/apps/web/src/app/app/(dashboard)/incident/page.tsxnew file mode 100644index 000000000..e367a10eb--- /dev/null+++ b/apps/web/src/app/app/(dashboard)/incident/page.tsx@@ -0,0 +1,11 @@+import * as React from "react";++import { Header } from "@/components/header";++export default function IncidentPage() {+ return (+ <div>+ <Header title="Monitor" description="Overview of all the responses." />+ </div>+ );+}diff --git a/apps/web/src/app/app/(dashboard)/layout.tsx b/apps/web/src/app/app/(dashboard)/layout.tsxnew file mode 100644index 000000000..5b451e702--- /dev/null+++ b/apps/web/src/app/app/(dashboard)/layout.tsx@@ -0,0 +1,30 @@+import * as React from "react";++import { AppHeader } from "@/components/layout/app-header";+import { AppMenu } from "@/components/layout/app-menu";+import { AppSidebar } from "@/components/layout/app-sidebar";+import { Footer } from "@/components/layout/footer";++export default function AppLayout({ children }: { children: React.ReactNode }) {+ return (+ <div className="container mx-auto flex min-h-screen w-full flex-col items-center justify-center space-y-6 p-4 md:p-8">+ <AppHeader />+ <div className="flex w-full flex-1 gap-6 md:gap-8">+ <aside className="border-border hidden rounded-lg border p-3 backdrop-blur-[2px] md:block md:p-6">+ <nav>+ <AppSidebar />+ </nav>+ </aside>+ <main className="z-10 flex w-full flex-1 flex-col items-start justify-center">+ <div className="border-border relative w-full flex-1 rounded-lg border p-3 backdrop-blur-[2px] md:p-6">+ <nav className="absolute right-4 top-4 block md:hidden">+ <AppMenu />+ </nav>+ {children}+ </div>+ </main>+ </div>+ <Footer />+ </div>+ );+}diff --git a/apps/web/src/app/app/(dashboard)/monitor/page.tsx b/apps/web/src/app/app/(dashboard)/monitor/page.tsxnew file mode 100644index 000000000..9e108426d--- /dev/null+++ b/apps/web/src/app/app/(dashboard)/monitor/page.tsx@@ -0,0 +1,11 @@+import * as React from "react";++import { Header } from "@/components/header";++export default function MonitorPage() {+ return (+ <div>+ <Header title="Monitor" description="Overview of all the responses." />+ </div>+ );+}diff --git a/apps/web/src/app/app/(dashboard)/page.tsx b/apps/web/src/app/app/(dashboard)/page.tsxnew file mode 100644index 000000000..a69f85c95--- /dev/null+++ b/apps/web/src/app/app/(dashboard)/page.tsx@@ -0,0 +1,14 @@+import * as React from "react";+import { auth, currentUser } from "@clerk/nextjs";++import { Header } from "@/components/header";++export default async function AppPage() {+ const user = await currentUser();+ console.log({ user });+ return (+ <div>+ <Header title="App" description="Overview of all your websites" />+ </div>+ );+}diff --git a/apps/web/src/components/header.tsx b/apps/web/src/components/header.tsxnew file mode 100644index 000000000..8b4e12ac6--- /dev/null+++ b/apps/web/src/components/header.tsx@@ -0,0 +1,17 @@+import { cn } from "@/lib/utils";++interface HeaderProps extends React.HTMLAttributes<HTMLDivElement> {+ title: string;+ description?: string | null;+}++export function Header({ title, description, className }: HeaderProps) {+ return (+ <div className={cn("grid gap-1", className)}>+ <h1 className="font-cal text-3xl">{title}</h1>+ {description ? (+ <p className="text-muted-foreground">{description}</p>+ ) : null}+ </div>+ );+}diff --git a/apps/web/src/components/icons.tsx b/apps/web/src/components/icons.tsxnew file mode 100644index 000000000..c74426089--- /dev/null+++ b/apps/web/src/components/icons.tsx@@ -0,0 +1,12 @@+import { Activity, LayoutDashboard, Link, Siren } from "lucide-react";+import type { Icon as LucideIcon, LucideProps } from "lucide-react";++export type Icon = LucideIcon;+export type ValidIcon = keyof typeof Icons;++export const Icons = {+ activity: Activity,+ "layout-dashboard": LayoutDashboard,+ link: Link,+ siren: Siren,+} as const;diff --git a/apps/web/src/components/layout/app-header.tsx b/apps/web/src/components/layout/app-header.tsxnew file mode 100644index 000000000..8c5835d8d--- /dev/null+++ b/apps/web/src/components/layout/app-header.tsx@@ -0,0 +1,16 @@+import Link from "next/link";+import { UserButton } from "@clerk/nextjs";++export function AppHeader() {+ return (+ <header className="z-10 flex w-full items-center justify-between">+ <Link+ href="/"+ className="font-cal text-muted-foreground hover:text-foreground text-lg"+ >+ openstatus+ </Link>+ <UserButton />+ </header>+ );+}diff --git a/apps/web/src/components/layout/app-menu.tsx b/apps/web/src/components/layout/app-menu.tsxnew file mode 100644index 000000000..9523bfc01--- /dev/null+++ b/apps/web/src/components/layout/app-menu.tsx@@ -0,0 +1,32 @@+import { Menu } from "lucide-react";++import { Button } from "../ui/button";+import {+ Sheet,+ SheetContent,+ SheetDescription,+ SheetHeader,+ SheetTitle,+ SheetTrigger,+} from "../ui/sheet";+import { AppSidebar } from "./app-sidebar";++export function AppMenu() {+ return (+ <Sheet>+ <SheetTrigger asChild>+ <Button size="icon" variant="outline">+ <Menu className="h-6 w-6" />+ </Button>+ </SheetTrigger>+ <SheetContent>+ <SheetHeader>+ <SheetTitle>Navigation</SheetTitle>+ <SheetDescription>+ <AppSidebar />+ </SheetDescription>+ </SheetHeader>+ </SheetContent>+ </Sheet>+ );+}diff --git a/apps/web/src/components/layout/app-sidebar.tsx b/apps/web/src/components/layout/app-sidebar.tsxnew file mode 100644index 000000000..dc6eafbb7--- /dev/null+++ b/apps/web/src/components/layout/app-sidebar.tsx@@ -0,0 +1,35 @@+"use client";++import Link from "next/link";+import { usePathname } from "next/navigation";++import { pagesConfig } from "@/config/pages";+import { cn } from "@/lib/utils";+import { Icons } from "../icons";++export function AppSidebar() {+ const pathname = usePathname();+ return (+ <ul className="grid gap-1">+ {pagesConfig.map(({ title, href, icon, disabled }) => {+ const Icon = Icons[icon];+ return (+ <li key={title} className="w-full">+ <Link+ href={href}+ className={cn(+ "hover:bg-muted/50 hover:text-foreground text-muted-foreground group -mx-2 flex w-full min-w-[200px] items-center rounded-md border border-transparent px-3 py-1",+ pathname === href &&+ "bg-muted/50 border-border text-foreground",+ disabled && "pointer-events-none opacity-60",+ )}+ >+ <Icon className={cn("mr-2 h-4 w-4")} />+ {title}+ </Link>+ </li>+ );+ })}+ </ul>+ );+}diff --git a/apps/web/src/components/ui/sheet.tsx b/apps/web/src/components/ui/sheet.tsxnew file mode 100644index 000000000..7a07dfdbb--- /dev/null+++ b/apps/web/src/components/ui/sheet.tsx@@ -0,0 +1,145 @@+"use client";++import * as React from "react";+import * as SheetPrimitive from "@radix-ui/react-dialog";+import { cva } from "class-variance-authority";+import type { VariantProps } from "class-variance-authority";+import { X } from "lucide-react";++import { cn } from "@/lib/utils";++const Sheet = SheetPrimitive.Root;++const SheetTrigger = SheetPrimitive.Trigger;++const SheetClose = SheetPrimitive.Close;++const SheetPortal = ({+ className,+ ...props+}: SheetPrimitive.DialogPortalProps) => (+ <SheetPrimitive.Portal className={cn(className)} {...props} />+);+SheetPortal.displayName = SheetPrimitive.Portal.displayName;++const SheetOverlay = React.forwardRef<+ React.ElementRef<typeof SheetPrimitive.Overlay>,+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>+>(({ className, ...props }, ref) => (+ <SheetPrimitive.Overlay+ className={cn(+ "bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm",+ className,+ )}+ {...props}+ ref={ref}+ />+));+SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;++const sheetVariants = cva(+ "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",+ {+ variants: {+ side: {+ top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",+ bottom:+ "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",+ left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",+ right:+ "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",+ },+ },+ defaultVariants: {+ side: "right",+ },+ },+);++interface SheetContentProps+ extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,+ VariantProps<typeof sheetVariants> {}++const SheetContent = React.forwardRef<+ React.ElementRef<typeof SheetPrimitive.Content>,+ SheetContentProps+>(({ side = "right", className, children, ...props }, ref) => (+ <SheetPortal>+ <SheetOverlay />+ <SheetPrimitive.Content+ ref={ref}+ className={cn(sheetVariants({ side }), className)}+ {...props}+ >+ {children}+ <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none">+ <X className="h-4 w-4" />+ <span className="sr-only">Close</span>+ </SheetPrimitive.Close>+ </SheetPrimitive.Content>+ </SheetPortal>+));+SheetContent.displayName = SheetPrimitive.Content.displayName;++const SheetHeader = ({+ className,+ ...props+}: React.HTMLAttributes<HTMLDivElement>) => (+ <div+ className={cn(+ "flex flex-col space-y-2 text-center sm:text-left",+ className,+ )}+ {...props}+ />+);+SheetHeader.displayName = "SheetHeader";++const SheetFooter = ({+ className,+ ...props+}: React.HTMLAttributes<HTMLDivElement>) => (+ <div+ className={cn(+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",+ className,+ )}+ {...props}+ />+);+SheetFooter.displayName = "SheetFooter";++const SheetTitle = React.forwardRef<+ React.ElementRef<typeof SheetPrimitive.Title>,+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>+>(({ className, ...props }, ref) => (+ <SheetPrimitive.Title+ ref={ref}+ className={cn("text-foreground text-lg font-semibold", className)}+ {...props}+ />+));+SheetTitle.displayName = SheetPrimitive.Title.displayName;++const SheetDescription = React.forwardRef<+ React.ElementRef<typeof SheetPrimitive.Description>,+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>+>(({ className, ...props }, ref) => (+ <SheetPrimitive.Description+ ref={ref}+ className={cn("text-muted-foreground text-sm", className)}+ {...props}+ />+));+SheetDescription.displayName = SheetPrimitive.Description.displayName;++export {+ Sheet,+ SheetTrigger,+ SheetClose,+ SheetContent,+ SheetHeader,+ SheetFooter,+ SheetTitle,+ SheetDescription,+};diff --git a/apps/web/src/config/pages.ts b/apps/web/src/config/pages.tsnew file mode 100644index 000000000..0671f5d70--- /dev/null+++ b/apps/web/src/config/pages.ts@@ -0,0 +1,38 @@+import type { ValidIcon } from "@/components/icons";++type Page = {+ title: string;+ description: string;+ href: string;+ icon: ValidIcon;+ disabled?: boolean;+};++export const pagesConfig = [+ {+ title: "Dashboard",+ description: "Get an overview of what's hot.",+ href: "/app",+ icon: "layout-dashboard",+ },+ {+ title: "Endpoint",+ description: "Keep track of all your endpoints.",+ href: "/app/endpoint",+ icon: "link",+ },+ {+ title: "Monitor",+ description: "Check all the responses in one place.",+ href: "/app/monitor",+ icon: "activity",+ },+ {+ title: "Incident",+ description: "War room where you handle the incidents.",+ href: "/app/incident",+ icon: "siren",+ disabled: true,+ },+ // ...+] satisfies Page[];