Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
feat: theme sidebar (#1489)
Maximilian Kaskec0d3ebc26a62
diff --git a/apps/status-page/src/app/(public)/client.tsx b/apps/status-page/src/app/(public)/client.tsxindex 9789193aa..335f754f2 100644--- a/apps/status-page/src/app/(public)/client.tsx+++ b/apps/status-page/src/app/(public)/client.tsx@@ -18,6 +18,15 @@ import {StatusTitle,} from "@/components/status-page/status";import { StatusBanner } from "@/components/status-page/status-banner";+import {+ StatusEvent,+ StatusEventAffected,+ StatusEventAffectedBadge,+ StatusEventContent,+ StatusEventDate,+ StatusEventTimelineReport,+ StatusEventTitle,+} from "@/components/status-page/status-events";import { StatusMonitor } from "@/components/status-page/status-monitor";import { ThemePalettePicker } from "@/components/themes/theme-palette-picker";import { ThemeSelect } from "@/components/themes/theme-select";@@ -54,8 +63,7 @@ const MAIN_COLORS = [export function Client() {const { resolvedTheme } = useTheme();const [isMounted, setIsMounted] = useState(false);- const [searchParams, setSearchParams] = useQueryStates(searchParamsParsers);- const { q, t } = searchParams;+ const [{ q, t }, setSearchParams] = useQueryStates(searchParamsParsers);const theme = t ? THEMES[t as keyof typeof THEMES] : undefined;useEffect(() => {@@ -92,7 +100,7 @@ export function Client() {{theme?.name}</div><div className="sm:p-8">- <ThemePlaygroundMonitor className="scale-80 sm:scale-100" />+ <ThemePlaygroundStatus className="scale-80 sm:scale-100" /></div></div></div>@@ -110,7 +118,7 @@ export function Client() {/><ThemePalettePicker /></div>- <ul className="grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3">+ <ul className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3">{THEME_KEYS.filter((k) => {const theme = THEMES[k];return (@@ -147,15 +155,15 @@ export function Client() {style={style as React.CSSProperties}inert>- <ThemePlaygroundMonitor className="pointer-events-none scale-80" />+ <ThemePlaygroundStatus className="pointer-events-none scale-80" /></div>) : (<Skeleton className="absolute h-full w-full" />)}</div><div className="flex items-start justify-between gap-2">- <div className="space-y-0.5">- <div className="font-medium text-foreground text-sm leading-none">+ <div className="space-y-0.5 truncate">+ <div className="font-medium text-foreground text-sm leading-none truncate">{theme.name}</div><div className="font-mono text-xs">@@ -248,11 +256,6 @@ export function Client() {<Separator /><Section><div className="prose dark:prose-invert prose-sm max-w-none">- <blockquote>- Ideally, we would allow you to customize your theme with a{" "}- <code>ThemePalettePicker</code> component to easily test and export- your theme. Contributions are welcome!- </blockquote><p>Why don't we allow custom css styles to be overridden and onlysupport themes?@@ -273,7 +276,7 @@ export function Client() {);}-function ThemePlaygroundMonitor({+function ThemePlaygroundStatus({className,...props}: React.ComponentProps<"div"> & {}) {@@ -307,3 +310,42 @@ function ThemePlaygroundMonitor({</div>);}++// NOTE: we could add a tabs component here to switch between status and events+function ThemePlaygroundEvents({+ className,+ ...props+}: React.ComponentProps<"div"> & {}) {+ const trpc = useTRPC();+ const { data: report } = useQuery(+ trpc.statusPage.getNoopReport.queryOptions(),+ );+ const firstUpdate = report?.statusReportUpdates[0];++ if (!firstUpdate || !report) return null;++ return (+ <div className={cn("h-full w-full", className)} {...props}>+ <Status variant="success">+ <StatusEvent>+ <StatusEventDate date={firstUpdate.date} className="lg:flex-row" />+ <StatusEventContent hoverable={false}>+ <StatusEventTitle className="inline-flex gap-1">+ {report.title}+ </StatusEventTitle>+ {report.monitorsToStatusReports.length > 0 ? (+ <StatusEventAffected>+ {report.monitorsToStatusReports.map((affected) => (+ <StatusEventAffectedBadge key={affected.monitor.id}>+ {affected.monitor.name}+ </StatusEventAffectedBadge>+ ))}+ </StatusEventAffected>+ ) : null}+ <StatusEventTimelineReport updates={report.statusReportUpdates} />+ </StatusEventContent>+ </StatusEvent>+ </Status>+ </div>+ );+}diff --git a/apps/status-page/src/app/(public)/layout.tsx b/apps/status-page/src/app/(public)/layout.tsxindex 3619b5734..acea87b14 100644--- a/apps/status-page/src/app/(public)/layout.tsx+++ b/apps/status-page/src/app/(public)/layout.tsx@@ -1,8 +1,17 @@import { Link } from "@/components/common/link";import { ThemeProvider } from "@/components/themes/theme-provider";+import {+ SidebarTrigger,+ ThemeSidebar,+} from "@/components/themes/theme-sidebar";+import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";import { Toaster } from "@/components/ui/sonner";import { generateThemeStyles } from "@openstatus/theme-store";import PlausibleProvider from "next-plausible";+import { Suspense } from "react";++const SIDEBAR_WIDTH = "20rem";+const SIDEBAR_WIDTH_MOBILE = "18rem";export default async function Layout({children,@@ -17,12 +26,28 @@ export default async function Layout({dangerouslySetInnerHTML={{ __html: generateThemeStyles() }}/><ThemeProvider attribute="class" enableSystem disableTransitionOnChange>- <main>{children}</main>- <footer className="flex items-center justify-center gap-4 p-4 text-center font-mono text-muted-foreground text-sm">- <p>- powered by <Link href="https://openstatus.dev">openstatus</Link>- </p>- </footer>+ <SidebarProvider+ defaultOpen={false}+ style={+ {+ "--sidebar-width": SIDEBAR_WIDTH,+ "--sidebar-width-mobile": SIDEBAR_WIDTH_MOBILE,+ } as React.CSSProperties+ }+ >+ <SidebarInset className="relative">+ <SidebarTrigger className="absolute top-2 right-2" />+ <main className="mx-auto">{children}</main>+ <footer className="flex items-center justify-center gap-4 p-4 text-center font-mono text-muted-foreground text-sm">+ <p>+ powered by <Link href="https://openstatus.dev">openstatus</Link>+ </p>+ </footer>+ </SidebarInset>+ <Suspense>+ <ThemeSidebar />+ </Suspense>+ </SidebarProvider><Toaster richColors expand /></ThemeProvider></PlausibleProvider>diff --git a/apps/status-page/src/app/(public)/search-params.ts b/apps/status-page/src/app/(public)/search-params.tsindex 5992eaf53..a654f245c 100644--- a/apps/status-page/src/app/(public)/search-params.ts+++ b/apps/status-page/src/app/(public)/search-params.ts@@ -1,13 +1,15 @@import { THEME_KEYS } from "@openstatus/theme-store";import {createSearchParamsCache,+ parseAsBoolean,parseAsString,parseAsStringEnum,} from "nuqs/server";export const searchParamsParsers = {- q: parseAsString,- t: parseAsStringEnum(THEME_KEYS).withDefault("default"),+ q: parseAsString, // q = query+ t: parseAsStringEnum(THEME_KEYS).withDefault("default"), // t = theme+ b: parseAsBoolean.withDefault(false), // b = builder};export const searchParamsCache = createSearchParamsCache(searchParamsParsers);diff --git a/apps/status-page/src/components/status-page/floating-button.tsx b/apps/status-page/src/components/status-page/floating-button.tsxindex f39b5d720..9b93763bd 100644--- a/apps/status-page/src/components/status-page/floating-button.tsx+++ b/apps/status-page/src/components/status-page/floating-button.tsx@@ -28,6 +28,7 @@ import { cn } from "@/lib/utils";import {THEMES,THEME_KEYS,+ type ThemeDefinition,generateThemeStyles,} from "@openstatus/theme-store";import { Check, ChevronsUpDown, Settings } from "lucide-react";@@ -340,15 +341,24 @@ export function FloatingButton({);}-export function recomputeStyles(newTheme: CommunityTheme) {+export function recomputeStyles(+ newTheme: CommunityTheme,+ overrides?: Partial<ThemeDefinition>,+) {// FIXME: only on prod, we have two style elements with the same id// we need to get rid of all of them except the one we want to update- const allThemeStyles = document.querySelectorAll("style[id='theme-styles']");- allThemeStyles.forEach((style, index) => {- if (index === 0) {- style.textContent = generateThemeStyles(newTheme);- } else {- style.remove();- }- });+ try {+ const allThemeStyles = document.querySelectorAll(+ "style[id='theme-styles']",+ );+ allThemeStyles.forEach((style, index) => {+ if (index === 0) {+ style.textContent = generateThemeStyles(newTheme, overrides);+ } else {+ style.remove();+ }+ });+ } catch (error) {+ console.error(error);+ }}diff --git a/apps/status-page/src/components/themes/theme-palette-picker.tsx b/apps/status-page/src/components/themes/theme-palette-picker.tsxindex 0df48669a..e9ecdf771 100644--- a/apps/status-page/src/components/themes/theme-palette-picker.tsx+++ b/apps/status-page/src/components/themes/theme-palette-picker.tsx@@ -1,35 +1,32 @@+"use client";++import { Button } from "@/components/ui/button";+import { Kbd, KbdGroup } from "@/components/ui/kbd";+import { useSidebar } from "@/components/ui/sidebar";import {- Popover,- PopoverContent,- PopoverTrigger,-} from "@/components/ui/popover";+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/components/ui/tooltip";import { Palette } from "lucide-react";-import {- EmptyStateContainer,- EmptyStateDescription,- EmptyStateTitle,-} from "../content/empty-state";-import { Button } from "../ui/button";export function ThemePalettePicker() {+ const { toggleSidebar } = useSidebar();return (- <Popover>- <PopoverTrigger asChild>- <Button size="icon" variant="outline">+ <Tooltip>+ <TooltipTrigger asChild>+ <Button size="icon" variant="outline" onClick={toggleSidebar}><Palette className="size-4" /></Button>- </PopoverTrigger>- <PopoverContent side="bottom" align="end" className="w-90">- <EmptyStateContainer>- <EmptyStateTitle>- Help us ship an epic palette picker!- </EmptyStateTitle>- <EmptyStateDescription>- We are looking for contributions to build an epic palette picker to- help others generate and export their own themes.- </EmptyStateDescription>- </EmptyStateContainer>- </PopoverContent>- </Popover>+ </TooltipTrigger>+ <TooltipContent className="flex items-center gap-2">+ Toggle Sidebar{" "}+ <KbdGroup>+ <Kbd>⌘</Kbd>+ <span>+</span>+ <Kbd>B</Kbd>+ </KbdGroup>+ </TooltipContent>+ </Tooltip>);}diff --git a/apps/status-page/src/components/themes/theme-sidebar.tsx b/apps/status-page/src/components/themes/theme-sidebar.tsxnew file mode 100644index 000000000..e45a28e1d--- /dev/null+++ b/apps/status-page/src/components/themes/theme-sidebar.tsx@@ -0,0 +1,449 @@+"use client";++import { searchParamsParsers } from "@/app/(public)/search-params";+import { recomputeStyles } from "@/components/status-page/floating-button";+import { Button } from "@/components/ui/button";+import { ButtonGroup, ButtonGroupText } from "@/components/ui/button-group";+import { Checkbox } from "@/components/ui/checkbox";+import {+ Collapsible,+ CollapsibleContent,+ CollapsibleTrigger,+} from "@/components/ui/collapsible";+import { InputGroup, InputGroupInput } from "@/components/ui/input-group";+import { Kbd, KbdGroup } from "@/components/ui/kbd";+import { Label } from "@/components/ui/label";+import {+ Sidebar,+ SidebarContent,+ SidebarFooter,+ SidebarGroup,+ SidebarGroupContent,+ SidebarGroupLabel,+ SidebarHeader,+ SidebarMenu,+ SidebarMenuButton,+ SidebarMenuItem,+ useSidebar,+} from "@/components/ui/sidebar";+import { Skeleton } from "@/components/ui/skeleton";+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/components/ui/tooltip";+import { useCopyToClipboard } from "@/hooks/use-copy-to-clipboard";+import { useDebounce } from "@/hooks/use-debounce";+import { cn } from "@/lib/utils";+import {+ THEMES,+ type Theme,+ type ThemeKey,+ type ThemeVarName,+} from "@openstatus/theme-store";+import {+ Check,+ ChevronDown,+ Copy,+ PanelRightIcon,+ RotateCcw,+} from "lucide-react";+import { useTheme } from "next-themes";+import { useQueryStates } from "nuqs";+import { useEffect, useState } from "react";++type ThemeBuilderColor = {+ label: string;+ type: "color";+ values: { id: ThemeVarName; label: string }[];+};++type ThemeBuilderCheckbox = {+ label: string;+ type: "checkbox";+ values: { id: ThemeVarName; label: string }[];+ options: { value: string; label: boolean }[];+};++const THEME_BUILDER_INFO = {+ id: {+ label: "ID",+ id: "id",+ type: "text",+ },+ name: {+ label: "Name",+ id: "name",+ type: "text",+ },+ author: {+ label: "Author",+ id: "author.name",+ type: "text",+ },+ authorUrl: {+ label: "Link",+ id: "author.url",+ type: "text",+ },+} as const;++const THEME_STYLE_BUILDER = {+ base: {+ label: "Base Colors",+ type: "color",+ values: [+ { id: "--foreground", label: "Foreground" },+ { id: "--background", label: "Background" },+ // consider linking both border and input to the same color+ { id: "--border", label: "Border" },+ { id: "--input", label: "Input" },+ ],+ },+ status: {+ label: "Status Colors",+ type: "color",+ values: [+ { id: "--success", label: "Operational" },+ { id: "--destructive", label: "Error" },+ { id: "--warning", label: "Degraded" },+ { id: "--info", label: "Maintenance" },+ ],+ },+ brand: {+ label: "Brand Colors",+ type: "color",+ values: [+ { id: "--primary", label: "Primary" },+ { id: "--primary-foreground", label: "Primary Foreground" },+ // consider linking both secondary, muted, accent to the same color+ { id: "--secondary", label: "Secondary" },+ { id: "--muted", label: "Muted" },+ { id: "--muted-foreground", label: "Muted Foreground" },+ { id: "--accent", label: "Accent" },+ { id: "--accent-foreground", label: "Accent Foreground" },+ ],+ },+ "border-radius": {+ label: "Border Radius",+ type: "checkbox",+ values: [{ id: "--radius", label: "Border Radius" }],+ options: [+ { value: "0rem", label: false },+ { value: "0.625rem", label: true },+ ],+ },+} satisfies Record<string, ThemeBuilderColor | ThemeBuilderCheckbox>;++// Helper function to get nested property value from an object+// biome-ignore lint/suspicious/noExplicitAny: <explanation>+function getNestedValue(obj: any, path: string): string | undefined {+ const keys = path.split(".");+ let value = obj;+ for (const key of keys) {+ if (value === undefined || value === null) return undefined;+ value = value[key];+ }+ return value;+}++export function ThemeSidebar(props: React.ComponentProps<typeof Sidebar>) {+ const [{ t, b }, setSearchParams] = useQueryStates(searchParamsParsers);+ const [newTheme, setNewTheme] = useState<Theme>(THEMES[t]);+ const { resolvedTheme, setTheme } = useTheme();+ const { copy, isCopied } = useCopyToClipboard();+ const [isMounted, setIsMounted] = useState(false);+ const debouncedNewTheme = useDebounce(newTheme, 100);+ const { setOpen } = useSidebar();++ useEffect(() => {+ setIsMounted(true);+ }, []);++ useEffect(() => {+ setNewTheme(THEMES[t]);+ }, [t]);++ useEffect(() => {+ if (b) {+ setOpen(true);+ setSearchParams({ b: null });+ }+ }, [b, setOpen, setSearchParams]);++ useEffect(() => {+ if (!resolvedTheme || !isMounted) return;+ recomputeStyles(debouncedNewTheme.id as ThemeKey, { ...debouncedNewTheme });+ }, [resolvedTheme, isMounted, debouncedNewTheme]);++ return (+ <Sidebar side="right" {...props}>+ <SidebarHeader className="border-border border-b px-3 font-medium">+ <div className="flex items-center justify-between gap-2">+ <div>Theme Builder</div>+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ variant="ghost"+ size="icon"+ className="size-7"+ onClick={() => setNewTheme(THEMES[t])}+ >+ <span className="sr-only">Reset</span>+ <RotateCcw />+ </Button>+ </TooltipTrigger>+ <TooltipContent side="left">+ <p>Reset theme</p>+ </TooltipContent>+ </Tooltip>+ </div>+ </SidebarHeader>+ <SidebarContent>+ <Collapsible key="info" defaultOpen className="group/collapsible">+ <SidebarGroup className="pt-2 pb-0">+ <SidebarGroupLabel asChild>+ <CollapsibleTrigger>+ Information+ <ChevronDown className="ml-auto transition-transform group-data-[state=open]/collapsible:rotate-180" />+ </CollapsibleTrigger>+ </SidebarGroupLabel>+ <CollapsibleContent>+ <SidebarGroupContent>+ <SidebarMenu>+ {Object.entries(THEME_BUILDER_INFO).map(([key, config]) => (+ <SidebarMenuItem key={key}>+ <SidebarMenuButton asChild>+ <div>+ <ButtonGroup className="w-full">+ <ButtonGroupText className="w-24">+ <Label htmlFor={config.id}>{config.label}</Label>+ </ButtonGroupText>+ <InputGroup className="h-7">+ <InputGroupInput+ id={config.id}+ defaultValue={+ newTheme+ ? getNestedValue(newTheme, config.id)+ : ""+ }+ />+ </InputGroup>+ </ButtonGroup>+ </div>+ </SidebarMenuButton>+ </SidebarMenuItem>+ ))}+ </SidebarMenu>+ </SidebarGroupContent>+ </CollapsibleContent>+ </SidebarGroup>+ </Collapsible>+ <SidebarGroup className="py-0">+ <SidebarGroupLabel>Theme Mode</SidebarGroupLabel>+ <SidebarGroupContent>+ <SidebarMenu>+ <SidebarMenuItem>+ <SidebarMenuButton asChild>+ <div>+ {!isMounted ? (+ <Skeleton className="h-8 w-full" />+ ) : (+ <Tabs+ value={resolvedTheme}+ onValueChange={(value) =>+ setTheme(value as "light" | "dark")+ }+ className="w-full"+ >+ <TabsList className="h-8 w-full">+ <TabsTrigger value="light">Light</TabsTrigger>+ <TabsTrigger value="dark">Dark</TabsTrigger>+ </TabsList>+ </Tabs>+ )}+ </div>+ </SidebarMenuButton>+ </SidebarMenuItem>+ </SidebarMenu>+ </SidebarGroupContent>+ </SidebarGroup>+ {Object.entries(THEME_STYLE_BUILDER).map(([key, config], index) => (+ <Collapsible key={key} defaultOpen className="group/collapsible">+ <SidebarGroup+ className={cn(+ index !== Object.entries(THEME_STYLE_BUILDER).length - 1+ ? "py-0"+ : "pt-0",+ )}+ >+ <SidebarGroupLabel asChild>+ <CollapsibleTrigger>+ {config.label}+ <ChevronDown className="ml-auto transition-transform group-data-[state=open]/collapsible:rotate-180" />+ </CollapsibleTrigger>+ </SidebarGroupLabel>+ <CollapsibleContent>+ <SidebarGroupContent>+ <SidebarMenu>+ {config.values.map((value) => {+ return (+ <SidebarMenuItem key={value.id}>+ <SidebarMenuButton asChild>+ <div>+ <span className="truncate">{value.label}</span>+ <ThemeValueSelector+ config={config}+ id={value.id}+ theme={newTheme}+ setTheme={setNewTheme}+ isMounted={isMounted}+ />+ </div>+ </SidebarMenuButton>+ </SidebarMenuItem>+ );+ })}+ </SidebarMenu>+ </SidebarGroupContent>+ </CollapsibleContent>+ </SidebarGroup>+ </Collapsible>+ ))}+ </SidebarContent>+ <SidebarFooter className="border-border border-t">+ <Button+ size="sm"+ onClick={() => copy(JSON.stringify(newTheme), { withToast: false })}+ >+ {isCopied ? "Configuration Copied!" : "Copy Configuration"}+ {isCopied ? (+ <Check className="size-4" />+ ) : (+ <Copy className="size-4" />+ )}+ </Button>+ </SidebarFooter>+ </Sidebar>+ );+}++function ThemeValueSelector(props: {+ config: ThemeBuilderColor | ThemeBuilderCheckbox;+ id: ThemeVarName;+ theme: Theme;+ setTheme: (theme: Theme) => void;+ isMounted: boolean;+}) {+ const { resolvedTheme } = useTheme();++ if (!props.isMounted || !resolvedTheme)+ return <Skeleton className="ml-auto size-4 border border-foreground/70" />;++ const value = props.theme[resolvedTheme as "light" | "dark"][props.id];++ if (props.config.type === "color") {+ return (+ <label+ className="ml-auto size-4 rounded-full border border-foreground/70"+ style={{ backgroundColor: value }}+ htmlFor={props.id}+ >+ <input+ type="color"+ id={props.id}+ name={props.id}+ value={value}+ className="sr-only"+ onChange={(e) =>+ props.setTheme({+ ...props.theme,+ [resolvedTheme as "light" | "dark"]: {+ ...props.theme[resolvedTheme as "light" | "dark"],+ [props.id]: e.target.value,+ },+ })+ }+ />+ </label>+ );+ }++ if (props.config.type === "checkbox") {+ const { options } = props.config;+ const checked =+ options.find((option) => option.value === value)?.label ?? false;+ return (+ <label htmlFor={props.id} className="ml-auto flex items-center gap-2">+ <span className="font-mono text-muted-foreground text-xs">+ {value ??+ options.find((option) => option.label === false)?.value ??+ ""}+ </span>+ <Checkbox+ id={props.id}+ name={props.id}+ checked={checked}+ className="size-4 bg-background"+ onCheckedChange={(checked) =>+ props.setTheme({+ ...props.theme,+ [resolvedTheme as "light" | "dark"]: {+ ...props.theme[resolvedTheme as "light" | "dark"],+ [props.id]: checked+ ? options.find((option) => option.label === true)?.value ?? ""+ : options.find((option) => option.label === false)?.value ??+ "",+ },+ })+ }+ />+ </label>+ );+ }++ return (+ <span className="ml-auto font-mono text-muted-foreground text-xs">+ {value}+ </span>+ );+}++export function SidebarTrigger({+ className,+ onClick,+ ...props+}: React.ComponentProps<typeof Button>) {+ const { toggleSidebar } = useSidebar();++ return (+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ data-sidebar="trigger"+ data-slot="sidebar-trigger"+ variant="ghost"+ size="icon"+ className={cn("size-7", className)}+ onClick={(event) => {+ onClick?.(event);+ toggleSidebar();+ }}+ {...props}+ >+ <PanelRightIcon />+ <span className="sr-only">Toggle Sidebar</span>+ </Button>+ </TooltipTrigger>+ <TooltipContent side="left" className="flex items-center gap-2">+ Toggle Sidebar{" "}+ <KbdGroup>+ <Kbd>⌘</Kbd>+ <span>+</span>+ <Kbd>B</Kbd>+ </KbdGroup>+ </TooltipContent>+ </Tooltip>+ );+}diff --git a/apps/status-page/src/components/ui/button-group.tsx b/apps/status-page/src/components/ui/button-group.tsxnew file mode 100644index 000000000..16dd752e2--- /dev/null+++ b/apps/status-page/src/components/ui/button-group.tsx@@ -0,0 +1,83 @@+import { Slot } from "@radix-ui/react-slot";+import { type VariantProps, cva } from "class-variance-authority";++import { Separator } from "@/components/ui/separator";+import { cn } from "@/lib/utils";++const buttonGroupVariants = cva(+ "flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",+ {+ variants: {+ orientation: {+ horizontal:+ "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",+ vertical:+ "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",+ },+ },+ defaultVariants: {+ orientation: "horizontal",+ },+ },+);++function ButtonGroup({+ className,+ orientation,+ ...props+}: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {+ return (+ <div+ role="group"+ data-slot="button-group"+ data-orientation={orientation}+ className={cn(buttonGroupVariants({ orientation }), className)}+ {...props}+ />+ );+}++function ButtonGroupText({+ className,+ asChild = false,+ ...props+}: React.ComponentProps<"div"> & {+ asChild?: boolean;+}) {+ const Comp = asChild ? Slot : "div";++ return (+ <Comp+ className={cn(+ "flex items-center gap-2 rounded-md border bg-muted px-4 font-medium text-sm shadow-xs [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none",+ className,+ )}+ {...props}+ />+ );+}++function ButtonGroupSeparator({+ className,+ orientation = "vertical",+ ...props+}: React.ComponentProps<typeof Separator>) {+ return (+ <Separator+ data-slot="button-group-separator"+ orientation={orientation}+ className={cn(+ "!m-0 relative self-stretch bg-input data-[orientation=vertical]:h-auto",+ className,+ )}+ {...props}+ />+ );+}++export {+ ButtonGroup,+ ButtonGroupSeparator,+ ButtonGroupText,+ buttonGroupVariants,+};diff --git a/apps/status-page/src/components/ui/checkbox.tsx b/apps/status-page/src/components/ui/checkbox.tsxindex 26fdc1db1..1630f0dcd 100644--- a/apps/status-page/src/components/ui/checkbox.tsx+++ b/apps/status-page/src/components/ui/checkbox.tsx@@ -14,7 +14,7 @@ function Checkbox({<CheckboxPrimitive.Rootdata-slot="checkbox"className={cn(- "peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:data-[state=checked]:bg-primary dark:aria-invalid:ring-destructive/40",+ "peer size-4 shrink-0 rounded-xs border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:data-[state=checked]:bg-primary dark:aria-invalid:ring-destructive/40",className,)}{...props}diff --git a/apps/status-page/src/components/ui/input-group.tsx b/apps/status-page/src/components/ui/input-group.tsxnew file mode 100644index 000000000..8253c159c--- /dev/null+++ b/apps/status-page/src/components/ui/input-group.tsx@@ -0,0 +1,170 @@+"use client";++import { type VariantProps, cva } from "class-variance-authority";+import type * as React from "react";++import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";+import { Textarea } from "@/components/ui/textarea";+import { cn } from "@/lib/utils";++function InputGroup({ className, ...props }: React.ComponentProps<"div">) {+ return (+ <div+ data-slot="input-group"+ role="group"+ className={cn(+ "group/input-group relative flex w-full items-center rounded-md border border-input shadow-xs outline-none transition-[color,box-shadow] dark:bg-input/30",+ "h-9 min-w-0 has-[>textarea]:h-auto",++ // Variants based on alignment.+ "has-[>[data-align=inline-start]]:[&>input]:pl-2",+ "has-[>[data-align=inline-end]]:[&>input]:pr-2",+ "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",+ "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",++ // Focus state.+ "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50",++ // Error state.+ "has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",++ className,+ )}+ {...props}+ />+ );+}++const inputGroupAddonVariants = cva(+ "text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",+ {+ variants: {+ align: {+ "inline-start":+ "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",+ "inline-end":+ "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",+ "block-start":+ "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",+ "block-end":+ "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5",+ },+ },+ defaultVariants: {+ align: "inline-start",+ },+ },+);++function InputGroupAddon({+ className,+ align = "inline-start",+ ...props+}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {+ return (+ <div+ role="group"+ data-slot="input-group-addon"+ data-align={align}+ className={cn(inputGroupAddonVariants({ align }), className)}+ onClick={(e) => {+ if ((e.target as HTMLElement).closest("button")) {+ return;+ }+ e.currentTarget.parentElement?.querySelector("input")?.focus();+ }}+ {...props}+ />+ );+}++const inputGroupButtonVariants = cva(+ "text-sm shadow-none flex gap-2 items-center",+ {+ variants: {+ size: {+ xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",+ sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",+ "icon-xs":+ "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",+ "icon-sm": "size-8 p-0 has-[>svg]:p-0",+ },+ },+ defaultVariants: {+ size: "xs",+ },+ },+);++function InputGroupButton({+ className,+ type = "button",+ variant = "ghost",+ size = "xs",+ ...props+}: Omit<React.ComponentProps<typeof Button>, "size"> &+ VariantProps<typeof inputGroupButtonVariants>) {+ return (+ <Button+ type={type}+ data-size={size}+ variant={variant}+ className={cn(inputGroupButtonVariants({ size }), className)}+ {...props}+ />+ );+}++function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {+ return (+ <span+ className={cn(+ "flex items-center gap-2 text-muted-foreground text-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none",+ className,+ )}+ {...props}+ />+ );+}++function InputGroupInput({+ className,+ ...props+}: React.ComponentProps<"input">) {+ return (+ <Input+ data-slot="input-group-control"+ className={cn(+ "flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",+ className,+ )}+ {...props}+ />+ );+}++function InputGroupTextarea({+ className,+ ...props+}: React.ComponentProps<"textarea">) {+ return (+ <Textarea+ data-slot="input-group-control"+ className={cn(+ "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",+ className,+ )}+ {...props}+ />+ );+}++export {+ InputGroup,+ InputGroupAddon,+ InputGroupButton,+ InputGroupText,+ InputGroupInput,+ InputGroupTextarea,+};diff --git a/apps/status-page/src/components/ui/kbd.tsx b/apps/status-page/src/components/ui/kbd.tsxnew file mode 100644index 000000000..8f12a685a--- /dev/null+++ b/apps/status-page/src/components/ui/kbd.tsx@@ -0,0 +1,28 @@+import { cn } from "@/lib/utils";++function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {+ return (+ <kbd+ data-slot="kbd"+ className={cn(+ "pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded-sm bg-muted px-1 font-medium font-sans text-muted-foreground text-xs",+ "[&_svg:not([class*='size-'])]:size-3",+ "[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",+ className,+ )}+ {...props}+ />+ );+}++function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {+ return (+ <kbd+ data-slot="kbd-group"+ className={cn("inline-flex items-center gap-1", className)}+ {...props}+ />+ );+}++export { Kbd, KbdGroup };diff --git a/packages/api/src/router/statusPage.ts b/packages/api/src/router/statusPage.tsindex 475554f36..1601d62e1 100644--- a/packages/api/src/router/statusPage.ts+++ b/packages/api/src/router/statusPage.ts@@ -413,6 +413,94 @@ export const statusPageRouter = createTRPCRouter({return _report;}),+ getNoopReport: publicProcedure.query(async () => {+ const date = new Date(new Date().setDate(new Date().getDate() - 4));++ const resolvedDate = new Date(date.setMinutes(date.getMinutes() - 81));+ const monitoringDate = new Date(date.setMinutes(date.getMinutes() - 54));+ const identifiedDate = new Date(date.setMinutes(date.getMinutes() - 32));+ const investigatingDate = new Date(date.setMinutes(date.getMinutes() - 4));++ return {+ id: 1,+ pageId: 1,+ status: "investigating" as const,+ title: "API Latency Issues",+ message: "We are currently investigating elevated API response times.",+ createdAt: new Date(new Date().setDate(new Date().getDate() - 2)),+ updatedAt: new Date(new Date().setDate(new Date().getDate() - 1)),+ monitorsToStatusReports: [+ {+ monitorId: 1,+ statusReportId: 1,+ monitor: {+ id: 1,+ jobType: "http" as const,+ periodicity: "30s" as const,+ status: "active" as const,+ active: true,+ regions: ["ams", "fra"],+ url: "https://api.example.com",+ name: "API Monitor",+ description: "Main API endpoint",+ headers: null,+ body: null,+ method: "GET" as const,+ public: true,+ deletedAt: null,+ createdAt: new Date(new Date().setDate(new Date().getDate() - 30)),+ updatedAt: new Date(new Date().setDate(new Date().getDate() - 30)),+ workspaceId: 1,+ timeout: 30000,+ degradedAfter: null,+ assertions: null,+ },+ },+ ],+ statusReportUpdates: [+ {+ id: 4,+ statusReportId: 1,+ status: "resolved" as const,+ message:+ "All systems are operating normally. The issue has been fully resolved.",+ date: resolvedDate,+ createdAt: resolvedDate,+ updatedAt: resolvedDate,+ },+ {+ id: 3,+ statusReportId: 1,+ status: "monitoring" as const,+ message:+ "We are continuing to monitor the situation to ensure that the issue is resolved.",+ date: monitoringDate,+ createdAt: monitoringDate,+ updatedAt: monitoringDate,+ },+ {+ id: 2,+ statusReportId: 1,+ status: "identified" as const,+ message: "The issue has been identified and a fix is being deployed.",+ date: identifiedDate,+ createdAt: identifiedDate,+ updatedAt: identifiedDate,+ },+ {+ id: 1,+ statusReportId: 1,+ status: "investigating" as const,+ message:+ "We are investigating reports of increased latency on our API endpoints.",+ date: investigatingDate,+ createdAt: investigatingDate,+ updatedAt: investigatingDate,+ },+ ],+ };+ }),+getMonitors: publicProcedure.input(z.object({ slug: z.string().toLowerCase() })).query(async (opts) => {diff --git a/packages/theme-store/README.md b/packages/theme-store/README.mdindex 62fa7b3d9..ae25c9670 100644--- a/packages/theme-store/README.md+++ b/packages/theme-store/README.md@@ -21,10 +21,12 @@ Community themes are predefined color schemes that users can apply to their stat## Creating a New Theme-> **Help us ship an epic palette picker!**-> We are looking for contributions to build an epic [palette picker](https://github.com/openstatusHQ/openstatus/blob/main/apps/status-page/src/components/themes/theme-palette-picker.tsx) to help others generate and export their own themes.+Want to contribute a theme?-Want to contribute a theme? Follow these steps:+We only support themes via GitHub contributions to keep a certain version control. You can:++- Configure your [themes.openstatus.dev](https://themes.openstatus.dev/?b=true) and copy the configuration+- Directly test by running it locally### 1. Run the projectdiff --git a/packages/theme-store/src/index.ts b/packages/theme-store/src/index.tsindex 35c6de81f..f24178da1 100644--- a/packages/theme-store/src/index.ts+++ b/packages/theme-store/src/index.ts@@ -2,7 +2,7 @@ export * from "./types";import { GITHUB_HIGH_CONTRAST_THEME } from "./github";import { OPENSTATUS_ROUNDED_THEME, OPENSTATUS_THEME } from "./openstatus";import { SUPABASE_THEME } from "./supabase";-import type { Theme, ThemeMap } from "./types";+import type { Theme, ThemeDefinition, ThemeMap } from "./types";import { assertUniqueThemeIds } from "./utils";const THEMES_LIST = [@@ -23,7 +23,10 @@ export const THEMES = THEMES_LIST.reduce<ThemeMap>((acc, theme) => {export const THEME_KEYS = THEMES_LIST.map((theme) => theme.id);export type ThemeKey = (typeof THEME_KEYS)[number];-export function generateThemeStyles(themeKey?: string) {+export function generateThemeStyles(+ themeKey?: string,+ overrides?: Partial<ThemeDefinition>,+) {let theme = themeKey ? THEMES[themeKey] : undefined;if (!theme) {@@ -31,10 +34,10 @@ export function generateThemeStyles(themeKey?: string) {theme = OPENSTATUS_THEME;}- const lightVars = Object.entries(theme.light)+ const lightVars = Object.entries({ ...theme.light, ...overrides?.light }).map(([key, value]) => `${key}: ${value};`).join("\n ");- const darkVars = Object.entries(theme.dark)+ const darkVars = Object.entries({ ...theme.dark, ...overrides?.dark }).map(([key, value]) => `${key}: ${value};`).join("\n ");