Skip to content

Open-source status page, incident response and uptime monitoring

feat: theme explorer (#1468)

Maximilian Kaske741a28032a33
diff --git a/apps/dashboard/src/components/forms/status-page/form-configuration.tsx b/apps/dashboard/src/components/forms/status-page/form-configuration.tsx
index 126b7b2d2..88602c9f7 100644
--- a/apps/dashboard/src/components/forms/status-page/form-configuration.tsx
+++ b/apps/dashboard/src/components/forms/status-page/form-configuration.tsx
@@ -14,6 +14,14 @@ import {
FormCardTitle,
} from "@/components/forms/form-card";
import { Button } from "@/components/ui/button";
+import {
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@/components/ui/command";
import {
Dialog,
DialogClose,
@@ -33,6 +41,11 @@ import {
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
import {
Select,
SelectContent,
@@ -41,10 +54,11 @@ import {
SelectValue,
} from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
+import { cn } from "@/lib/utils";
import { zodResolver } from "@hookform/resolvers/zod";
-import { THEMES, THEME_KEYS } from "@openstatus/theme-store";
+import { THEMES, THEME_KEYS, type ThemeKey } from "@openstatus/theme-store";
import { isTRPCClientError } from "@trpc/client";
-import { ArrowUpRight, Info } from "lucide-react";
+import { ArrowUpRight, Check, ChevronsUpDown, Info } from "lucide-react";
import { parseAsStringLiteral, useQueryStates } from "nuqs";
import { useForm } from "react-hook-form";
import { toast } from "sonner";
@@ -350,29 +364,62 @@ export function FormConfiguration({
render={({ field }) => (
<FormItem>
<FormLabel>Theme</FormLabel>
- <FormControl>
- <Select
- onValueChange={field.onChange}
- defaultValue={String(field.value) ?? "default"}
- >
+ <Popover>
+ <PopoverTrigger asChild>
<FormControl>
- <SelectTrigger className="w-full capitalize">
- <SelectValue placeholder="Select a theme" />
- </SelectTrigger>
+ <Button
+ id="community-theme"
+ variant="outline"
+ role="combobox"
+ className={cn(
+ "w-full justify-between",
+ !field.value && "text-muted-foreground",
+ )}
+ >
+ {THEMES[field.value as ThemeKey]?.name ||
+ "Select a theme"}
+ <ChevronsUpDown className="opacity-50" />
+ </Button>
</FormControl>
- <SelectContent>
- {Object.values(THEMES).map((theme) => (
- <SelectItem
- key={theme.id}
- value={theme.id}
- className="capitalize"
- >
- {theme.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </FormControl>
+ </PopoverTrigger>
+ <PopoverContent className="p-0" align="start">
+ <Command>
+ <CommandInput
+ placeholder="Search themes..."
+ className="h-9"
+ />
+ <CommandList>
+ <CommandEmpty>No themes found.</CommandEmpty>
+ <CommandGroup>
+ {THEME_KEYS.map((theme) => {
+ const { name, author } = THEMES[theme];
+ return (
+ <CommandItem
+ value={theme}
+ key={theme}
+ keywords={[theme, name, author.name]}
+ onSelect={(v) => field.onChange(v)}
+ >
+ <span className="truncate">{name}</span>
+ <span className="text-muted-foreground text-xs truncate font-commit-mono">
+ by {author.name}
+ </span>
+ <Check
+ className={cn(
+ "ml-auto",
+ theme === field.value
+ ? "opacity-100"
+ : "opacity-0",
+ )}
+ />
+ </CommandItem>
+ );
+ })}
+ </CommandGroup>
+ </CommandList>
+ </Command>
+ </PopoverContent>
+ </Popover>
</FormItem>
)}
/>
diff --git a/apps/dashboard/src/components/forms/status-page/form-monitors.tsx b/apps/dashboard/src/components/forms/status-page/form-monitors.tsx
index bbec37fec..5c0723bd7 100644
--- a/apps/dashboard/src/components/forms/status-page/form-monitors.tsx
+++ b/apps/dashboard/src/components/forms/status-page/form-monitors.tsx
@@ -193,7 +193,6 @@ export function FormMonitors({
"w-[200px] justify-between",
!field.value && "text-muted-foreground",
)}
- size="sm"
>
{field.value.length > 0
? `${field.value.length} monitors selected`
diff --git a/apps/status-page/src/app/(public)/client.tsx b/apps/status-page/src/app/(public)/client.tsx
new file mode 100644
index 000000000..773342f65
--- /dev/null
+++ b/apps/status-page/src/app/(public)/client.tsx
@@ -0,0 +1,303 @@
+"use client";
+
+import { Link } from "@/components/common/link";
+import {
+ Section,
+ SectionDescription,
+ SectionGroup,
+ SectionGroupHeader,
+ SectionHeader,
+ SectionTitle,
+} from "@/components/content/section";
+import {
+ Status,
+ StatusContent,
+ StatusDescription,
+ StatusHeader,
+ StatusTitle,
+} from "@/components/status-page/status";
+import { StatusBanner } from "@/components/status-page/status-banner";
+import { StatusMonitor } from "@/components/status-page/status-monitor";
+import { ThemePalettePicker } from "@/components/themes/theme-palette-picker";
+import { ThemeSelect } from "@/components/themes/theme-select";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Separator } from "@/components/ui/separator";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { monitors } from "@/data/monitors";
+import { useTRPC } from "@/lib/trpc/client";
+import { cn } from "@/lib/utils";
+import { THEMES, THEME_KEYS } from "@openstatus/theme-store";
+import { useQuery } from "@tanstack/react-query";
+import { useTheme } from "next-themes";
+import { useQueryStates } from "nuqs";
+import { useEffect, useState } from "react";
+import { searchParamsParsers } from "./search-params";
+
+const MAIN_COLORS = [
+ { key: "--primary", label: "Primary" },
+ { key: "--success", label: "Operational" },
+ { key: "--destructive", label: "Error" },
+ { key: "--warning", label: "Degraded" },
+ { key: "--info", label: "Maintenance" },
+] as const;
+
+// TODO: add keyboard navigation for selection?
+
+export function Client() {
+ const { resolvedTheme } = useTheme();
+ const [mounted, setMounted] = useState(false);
+ const [searchParams, setSearchParams] = useQueryStates(searchParamsParsers);
+ const { q, t } = searchParams;
+ const theme = t ? THEMES[t as keyof typeof THEMES] : undefined;
+
+ useEffect(() => {
+ setMounted(true);
+ }, []);
+
+ useEffect(() => {
+ const theme = resolvedTheme as "dark" | "light";
+ if (["dark", "light"].includes(theme)) {
+ const element = document.documentElement;
+ element.removeAttribute("style"); // reset the style
+ Object.keys(THEMES[t][theme]).forEach((key) => {
+ const value =
+ THEMES[t][theme][
+ key as keyof (typeof THEMES)[typeof t][typeof theme]
+ ];
+ if (value) {
+ element.style.setProperty(key, value as string);
+ }
+ });
+ }
+ }, [resolvedTheme, t]);
+
+ return (
+ <SectionGroup>
+ <SectionGroupHeader>
+ <h1 className="font-bold text-2xl md:text-4xl">
+ Status Page Theme Explorer
+ </h1>
+ <h2 className="font-medium text-muted-foreground md:text-lg">
+ View all the openstatus themes and learn how to create your own.
+ </h2>
+ </SectionGroupHeader>
+ <Section>
+ <SectionHeader>
+ <SectionTitle>Explorer</SectionTitle>
+ <SectionDescription>
+ Search for your favorite status page theme.{" "}
+ <Link href="#contribute-theme">Contribute your own?</Link>
+ </SectionDescription>
+ </SectionHeader>
+ <div className="sticky top-0 z-10 overflow-hidden rounded-lg border border-border bg-background outline-[3px] outline-background sm:relative">
+ <div className="relative">
+ <div className="absolute top-0 right-0 rounded-bl-lg border-border border-b border-l bg-muted/50 px-2 py-0.5 text-[10px]">
+ {theme?.name}
+ </div>
+ <div className="sm:p-8">
+ <ThemePlaygroundMonitor className="scale-80 sm:scale-100" />
+ </div>
+ </div>
+ </div>
+ <div className="flex gap-3">
+ <ThemeSelect />
+ <Input
+ placeholder={`Search from ${THEME_KEYS.length} themes`}
+ value={q ?? ""}
+ onChange={(e) => {
+ if (e.target.value.length === 0) {
+ setSearchParams({ q: null });
+ }
+ setSearchParams({ q: e.target.value.trim().toLowerCase() });
+ }}
+ />
+ <ThemePalettePicker />
+ </div>
+ <ul className="grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3">
+ {THEME_KEYS.filter((k) => {
+ const theme = THEMES[k];
+ return (
+ theme.author.name
+ .toLowerCase()
+ .includes(q?.toLowerCase() ?? "") ||
+ theme.name.toLowerCase().includes(q?.toLowerCase() ?? "")
+ );
+ }).map((k) => {
+ const theme = THEMES[k];
+ const style = mounted
+ ? theme[resolvedTheme as "dark" | "light"]
+ : undefined;
+ return (
+ <li key={k} className="group/theme-card space-y-1.5">
+ <div
+ data-active={k === t}
+ data-slot="theme-card"
+ data-theme={k}
+ className="relative h-40 cursor-pointer overflow-hidden rounded-md border outline-none transition-all focus:outline-ring/50 focus:ring-2 focus:ring-ring/50 data-[active=true]:border-ring data-[active=true]:outline-[3px] data-[active=true]:outline-ring/50"
+ onClick={() => setSearchParams({ t: k })}
+ role="button"
+ tabIndex={0}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" || e.key === " ") {
+ setSearchParams({ t: k });
+ }
+ }}
+ >
+ <div
+ className="absolute h-full w-full bg-background text-foreground"
+ style={style as React.CSSProperties}
+ inert
+ >
+ <ThemePlaygroundMonitor className="pointer-events-none scale-80" />
+ </div>
+ </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">
+ {theme.name}
+ </div>
+ <div className="font-mono text-xs">
+ <Link
+ href={theme.author.url}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-muted-foreground"
+ >
+ by {theme.author.name}
+ </Link>
+ </div>
+ </div>
+ <div className="flex gap-0.5">
+ {MAIN_COLORS.map((color) => {
+ const backgroundColor = style
+ ? style[color.key]
+ : undefined;
+ return (
+ <TooltipProvider key={color.key}>
+ <Tooltip>
+ <TooltipTrigger>
+ <div
+ className="size-3.5 rounded-sm border bg-muted-foreground"
+ style={{ backgroundColor }}
+ />
+ </TooltipTrigger>
+ <TooltipContent>{color.label}</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ );
+ })}
+ </div>
+ </div>
+ </li>
+ );
+ })}
+ </ul>
+ </Section>
+ <Separator />
+ <Section>
+ <SectionHeader id="contribute-theme">
+ <SectionTitle>Contribute Theme</SectionTitle>
+ <SectionDescription>
+ Contribute your own theme to the community.
+ </SectionDescription>
+ </SectionHeader>
+ <div className="prose dark:prose-invert prose-sm max-w-none">
+ <p>
+ You can contribute your own theme by creating a new file in the{" "}
+ <code>@openstatus.theme-store</code> package. You&apos;ll only need
+ to override css variables. Make sure your object is satisfiying the{" "}
+ <code>Theme</code> interface.
+ </p>
+ <p>
+ Go to the{" "}
+ <Link href="https://github.com/openstatusHQ/openstatus/tree/main/packages/theme-store">
+ GitHub directory
+ </Link>{" "}
+ to see the existing themes and create a new one by forking and
+ creating a pull request.
+ </p>
+ <Button
+ onClick={() => {
+ // NOTE: we use it to display the 'floating-theme' component
+ sessionStorage.setItem("community-theme", "true");
+ window.location.href = "/status";
+ }}
+ >
+ Test it
+ </Button>
+ {/* TODO: OR go to the status-page config and click on the View and Configure button */}
+ <p>
+ Or use the{" "}
+ <code>sessionStorage.setItem("community-theme", "true");</code> on
+ your own status page.
+ </p>
+ </div>
+ </Section>
+ <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 only
+ support themes?
+ </p>
+ <ul>
+ <li>Keep it simple for the user</li>
+ <li>Don't end up with a xmas tree</li>
+ <li>Keep the theme consistent</li>
+ <li>Avoid conflicts with other styles</li>
+ <li>
+ Keep the theme maintainable (but this will also mean, a change
+ will affect all users)
+ </li>
+ </ul>
+ </div>
+ </Section>
+ </SectionGroup>
+ );
+}
+
+function ThemePlaygroundMonitor({
+ className,
+ ...props
+}: React.ComponentProps<"div"> & {}) {
+ const trpc = useTRPC();
+ const { data: uptimeData, isLoading } = useQuery(
+ trpc.statusPage.getNoopUptime.queryOptions(),
+ );
+ return (
+ // NOTE: we use pointer-events-none to prevent the hover card or tooltip from being interactive - the Portal container is document body and we loose the styles
+ <div className={cn("h-full w-full", className)} {...props}>
+ <Status variant="success">
+ <StatusHeader>
+ <StatusTitle>Acme Inc.</StatusTitle>
+ <StatusDescription>
+ Get informed about our services.
+ </StatusDescription>
+ </StatusHeader>
+ <StatusBanner status="success" />
+ <StatusContent>
+ {/* TODO: create mock data */}
+ <StatusMonitor
+ status="success"
+ data={uptimeData?.data || []}
+ monitor={monitors[0]}
+ showUptime={true}
+ uptime={uptimeData?.uptime}
+ isLoading={isLoading}
+ />
+ </StatusContent>
+ </Status>
+ </div>
+ );
+}
diff --git a/apps/status-page/src/app/(public)/layout.tsx b/apps/status-page/src/app/(public)/layout.tsx
index 49369e003..30472ef2a 100644
--- a/apps/status-page/src/app/(public)/layout.tsx
+++ b/apps/status-page/src/app/(public)/layout.tsx
@@ -15,12 +15,7 @@ export default async function Layout({
}) {
return (
<PlausibleProvider domain="themes.openstatus.dev">
- <ThemeProvider
- attribute="class"
- defaultTheme="light"
- enableSystem
- disableTransitionOnChange
- >
+ <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>
diff --git a/apps/status-page/src/app/(public)/page.tsx b/apps/status-page/src/app/(public)/page.tsx
index 0bd46d1f2..b7f03f9a8 100644
--- a/apps/status-page/src/app/(public)/page.tsx
+++ b/apps/status-page/src/app/(public)/page.tsx
@@ -1,199 +1,12 @@
-"use client";
+import type { SearchParams } from "nuqs";
+import { Client } from "./client";
+import { searchParamsCache } from "./search-params";
-import { Link } from "@/components/common/link";
-import {
- Section,
- SectionDescription,
- SectionGroup,
- SectionHeader,
- SectionTitle,
-} from "@/components/content/section";
-import {
- Status,
- StatusContent,
- StatusDescription,
- StatusHeader,
- StatusTitle,
-} from "@/components/status-page/status";
-import { StatusBanner } from "@/components/status-page/status-banner";
-import { StatusMonitor } from "@/components/status-page/status-monitor";
-import { Button } from "@/components/ui/button";
-import { monitors } from "@/data/monitors";
-import { useTRPC } from "@/lib/trpc/client";
-import { cn } from "@/lib/utils";
-import { THEMES, THEME_KEYS } from "@openstatus/theme-store";
-import { useQuery } from "@tanstack/react-query";
-
-export default function Page() {
- return (
- <SectionGroup>
- <Section>
- <SectionHeader>
- <SectionTitle>Status Page Themes</SectionTitle>
- <SectionDescription>
- View all the current themes you can use.{" "}
- <Link href="#contribute-theme">Contribute your own?</Link>
- </SectionDescription>
- </SectionHeader>
- <div className="flex flex-col gap-4">
- {THEME_KEYS.map((theme) => {
- const t = THEMES[theme];
- return (
- <div key={theme} className="flex flex-col gap-2">
- <ThemeHeader>
- <ThemeTitle>{t.name}</ThemeTitle>
- <ThemeAuthor>
- by{" "}
- <a
- href={t.author.url}
- target="_blank"
- rel="noopener noreferrer"
- >
- {t.author.name}
- </a>
- </ThemeAuthor>
- </ThemeHeader>
- <ThemeGroup>
- <ThemeCard theme={theme} mode="light" />
- <ThemeCard theme={theme} mode="dark" />
- </ThemeGroup>
- </div>
- );
- })}
- </div>
- </Section>
- <Section>
- <SectionHeader id="contribute-theme">
- <SectionTitle>Contribute Theme</SectionTitle>
- <SectionDescription>
- Contribute your own theme to the community.
- </SectionDescription>
- </SectionHeader>
- <div className="prose dark:prose-invert prose-sm max-w-none">
- <p>
- You can contribute your own theme by creating a new file in the{" "}
- <code>@openstatus.theme-store</code> package. You&apos;ll only need
- to override css variables. Make sure your object is satisfiying the{" "}
- <code>Theme</code> interface.
- </p>
- <p>
- Go to the{" "}
- <Link href="https://github.com/openstatusHQ/openstatus/tree/main/packages/theme-store">
- GitHub directory
- </Link>{" "}
- to see the existing themes and create a new one by forking and
- creating a pull request.
- </p>
- <Button
- onClick={() => {
- // NOTE: we use it to display the 'floating-theme' component
- sessionStorage.setItem("community-theme", "true");
- window.location.href = "/status";
- }}
- >
- Test it
- </Button>
- <p>
- Or use the{" "}
- <code>sessionStorage.setItem("community-theme", "true");</code> on
- your own status page.
- </p>
- <hr />
- <p>
- Why don't we allow custom css styles to be overridden and only
- support themes?
- </p>
- <ul>
- <li>Keep it simple for the user</li>
- <li>Don't end up with a xmas tree</li>
- <li>Keep the theme consistent</li>
- <li>Avoid conflicts with other styles</li>
- <li>
- Keep the theme maintainable (but this will also mean, a change
- will affect all users)
- </li>
- </ul>
- </div>
- </Section>
- </SectionGroup>
- );
-}
-
-// TODO: the status-tracker hover card is mounted on the body and looses the theme style context
-
-function ThemeCard({
- theme,
- mode,
+export default async function Page({
+ searchParams,
}: {
- theme: keyof typeof THEMES;
- mode: "dark" | "light";
+ searchParams: Promise<SearchParams>;
}) {
- const t = THEMES[theme][mode];
- const trpc = useTRPC();
- const { data: uptimeData, isLoading } = useQuery(
- trpc.statusPage.getNoopUptime.queryOptions(),
- );
- return (
- <div
- className={cn(
- "group/theme-card overflow-hidden rounded-lg border",
- mode === "dark" ? "dark" : "",
- )}
- >
- <div
- style={t as React.CSSProperties}
- className="h-full w-full bg-background"
- >
- {/* NOTE: we use pointer-events-none to prevent the hover card or tooltip from being interactive - the Portal container is document body and we loose the styles */}
- <div className="pointer-events-none scale-85 bg-background text-foreground transition-all duration-300 group-hover/theme-card:scale-90">
- <Status variant="success">
- <StatusHeader>
- <StatusTitle>Acme Inc.</StatusTitle>
- <StatusDescription>
- Get informed about our services.
- </StatusDescription>
- </StatusHeader>
- <StatusBanner status="success" />
- <StatusContent>
- {/* TODO: create mock data */}
- <StatusMonitor
- status="success"
- data={uptimeData?.data || []}
- monitor={monitors[0]}
- showUptime={true}
- uptime={uptimeData?.uptime}
- isLoading={isLoading}
- />
- </StatusContent>
- </Status>
- </div>
- </div>
- </div>
- );
-}
-
-function ThemeGroup({ children, className }: React.ComponentProps<"div">) {
- return (
- <div className={cn("grid grid-cols-1 gap-4 sm:grid-cols-2", className)}>
- {children}
- </div>
- );
-}
-
-function ThemeHeader({ children, className }: React.ComponentProps<"div">) {
- return <div className={cn("flex flex-col", className)}>{children}</div>;
-}
-
-function ThemeTitle({ children, className }: React.ComponentProps<"div">) {
- return (
- <div className={cn("font-semibold text-base", className)}>{children}</div>
- );
-}
-
-function ThemeAuthor({ children, className }: React.ComponentProps<"div">) {
- return (
- <div className={cn("font-mono text-muted-foreground text-xs", className)}>
- {children}
- </div>
- );
+ await searchParamsCache.parse(searchParams);
+ return <Client />;
}
diff --git a/apps/status-page/src/app/(public)/search-params.ts b/apps/status-page/src/app/(public)/search-params.ts
new file mode 100644
index 000000000..5992eaf53
--- /dev/null
+++ b/apps/status-page/src/app/(public)/search-params.ts
@@ -0,0 +1,13 @@
+import { THEME_KEYS } from "@openstatus/theme-store";
+import {
+ createSearchParamsCache,
+ parseAsString,
+ parseAsStringEnum,
+} from "nuqs/server";
+
+export const searchParamsParsers = {
+ q: parseAsString,
+ t: parseAsStringEnum(THEME_KEYS).withDefault("default"),
+};
+
+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.tsx
index 4d8587c6c..d985f2686 100644
--- a/apps/status-page/src/components/status-page/floating-button.tsx
+++ b/apps/status-page/src/components/status-page/floating-button.tsx
@@ -2,6 +2,13 @@
import { ThemeSelect } from "@/components/themes/theme-select";
import { Button } from "@/components/ui/button";
+import {
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@/components/ui/command";
import { Label } from "@/components/ui/label";
import {
Popover,
@@ -18,7 +25,7 @@ import {
import { Separator } from "@/components/ui/separator";
import { cn } from "@/lib/utils";
import { THEMES, THEME_KEYS } from "@openstatus/theme-store";
-import { Settings } from "lucide-react";
+import { Check, ChevronsUpDown, Command, Settings } from "lucide-react";
import { useTheme } from "next-themes";
import { parseAsString, useQueryState } from "nuqs";
import type React from "react";
@@ -90,20 +97,19 @@ export function StatusPageProvider({
useEffect(() => {
const theme = resolvedTheme as "dark" | "light";
if (["dark", "light"].includes(theme)) {
+ const element = document.documentElement;
+ element.removeAttribute("style"); // reset the style
Object.keys(THEMES[communityTheme][theme]).forEach((key) => {
- const element = document.documentElement;
const value =
THEMES[communityTheme][theme][
key as keyof (typeof THEMES)[typeof communityTheme][typeof theme]
];
+ console.log(key, value);
if (value) {
element.style.setProperty(key, value as string);
}
});
}
- if (communityTheme === "default") {
- document.documentElement.removeAttribute("style");
- }
}, [resolvedTheme, communityTheme]);
useEffect(() => {
@@ -315,24 +321,56 @@ export function FloatingButton({
) : null}
<div className="space-y-2">
<Label htmlFor="community-theme">Community Theme</Label>
- <Select
- value={communityTheme}
- onValueChange={(v) => setCommunityTheme(v as CommunityTheme)}
- >
- <SelectTrigger
- id="community-theme"
- className="w-full capitalize"
- >
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {COMMUNITY_THEME.map((v) => (
- <SelectItem key={v} value={v} className="capitalize">
- {v}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ id="community-theme"
+ variant="outline"
+ role="combobox"
+ className="w-full justify-between font-normal"
+ >
+ {communityTheme}
+ <ChevronsUpDown className="opacity-50" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="p-0">
+ <Command>
+ <CommandInput
+ placeholder="Search themes..."
+ className="h-9"
+ />
+ <CommandList>
+ <CommandEmpty>No themes found.</CommandEmpty>
+ <CommandGroup>
+ {COMMUNITY_THEME.map((theme) => (
+ <CommandItem
+ value={theme}
+ key={theme}
+ onSelect={(v) =>
+ setCommunityTheme(v as CommunityTheme)
+ }
+ >
+ <span className="truncate">
+ {THEMES[theme].name}
+ </span>
+ <span className="text-muted-foreground text-xs truncate font-commit-mono">
+ by {THEMES[theme].author.name}
+ </span>
+ <Check
+ className={cn(
+ "ml-auto",
+ theme === communityTheme
+ ? "opacity-100"
+ : "opacity-0",
+ )}
+ />
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ </CommandList>
+ </Command>
+ </PopoverContent>
+ </Popover>
</div>
</div>
</div>
diff --git a/apps/status-page/src/components/status-page/floating-theme.tsx b/apps/status-page/src/components/status-page/floating-theme.tsx
index a33a2771b..e8dba4150 100644
--- a/apps/status-page/src/components/status-page/floating-theme.tsx
+++ b/apps/status-page/src/components/status-page/floating-theme.tsx
@@ -2,22 +2,23 @@
import { ThemeSelect } from "@/components/themes/theme-select";
import { Button } from "@/components/ui/button";
+import {
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@/components/ui/command";
import { Label } from "@/components/ui/label";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select";
import { cn } from "@/lib/utils";
import { THEMES, THEME_KEYS } from "@openstatus/theme-store";
-import { Palette } from "lucide-react";
+import { Check, ChevronsUpDown, Palette } from "lucide-react";
import { useEffect } from "react";
import { useState } from "react";
import { useStatusPage } from "./floating-button";
@@ -61,37 +62,65 @@ export function FloatingTheme({ className }: { className?: string }) {
<div className="space-y-2">
<h4 className="font-medium leading-none">Theme Settings</h4>
<p className="text-muted-foreground text-sm">
- Test the community themes on the status page.
+ Test community themes on the status page.
</p>
</div>
<div className="space-y-2">
- <Label htmlFor="theme">Theme</Label>
+ <Label htmlFor="theme">Theme Mode</Label>
<ThemeSelect id="theme" className="w-full" />
</div>
<div className="space-y-2">
<Label htmlFor="community-theme">Community Theme</Label>
- <Select
- value={communityTheme}
- onValueChange={(v) => setCommunityTheme(v as CommunityTheme)}
- >
- <SelectTrigger
- id="community-theme"
- className="w-full capitalize"
- >
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {COMMUNITY_THEME.map((theme) => (
- <SelectItem
- key={theme}
- value={theme}
- className="capitalize"
- >
- {THEMES[theme].name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ id="community-theme"
+ variant="outline"
+ role="combobox"
+ className="w-full justify-between font-normal"
+ >
+ {THEMES[communityTheme].name}
+ <ChevronsUpDown className="opacity-50" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="p-0">
+ <Command>
+ <CommandInput
+ placeholder="Search themes..."
+ className="h-9"
+ />
+ <CommandList>
+ <CommandEmpty>No themes found.</CommandEmpty>
+ <CommandGroup>
+ {COMMUNITY_THEME.map((theme) => (
+ <CommandItem
+ value={theme}
+ key={theme}
+ onSelect={(v) =>
+ setCommunityTheme(v as CommunityTheme)
+ }
+ >
+ <span className="truncate">
+ {THEMES[theme].name}
+ </span>
+ <span className="text-muted-foreground text-xs truncate font-commit-mono">
+ by {THEMES[theme].author.name}
+ </span>
+ <Check
+ className={cn(
+ "ml-auto",
+ theme === communityTheme
+ ? "opacity-100"
+ : "opacity-0",
+ )}
+ />
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ </CommandList>
+ </Command>
+ </PopoverContent>
+ </Popover>
</div>
</div>
</PopoverContent>
diff --git a/apps/status-page/src/components/status-page/status-events.tsx b/apps/status-page/src/components/status-page/status-events.tsx
index 019c968cf..cbc7a2163 100644
--- a/apps/status-page/src/components/status-page/status-events.tsx
+++ b/apps/status-page/src/components/status-page/status-events.tsx
@@ -361,7 +361,7 @@ export function StatusEventTimelineMessage({
return (
<div
className={cn(
- "py-1.5 font-mono text-sm text-muted-foreground",
+ "py-1.5 font-mono text-muted-foreground text-sm",
className,
)}
{...props}
diff --git a/apps/status-page/src/components/themes/theme-palette-picker.tsx b/apps/status-page/src/components/themes/theme-palette-picker.tsx
new file mode 100644
index 000000000..0df48669a
--- /dev/null
+++ b/apps/status-page/src/components/themes/theme-palette-picker.tsx
@@ -0,0 +1,35 @@
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { Palette } from "lucide-react";
+import {
+ EmptyStateContainer,
+ EmptyStateDescription,
+ EmptyStateTitle,
+} from "../content/empty-state";
+import { Button } from "../ui/button";
+
+export function ThemePalettePicker() {
+ return (
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button size="icon" variant="outline">
+ <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>
+ );
+}
diff --git a/apps/status-page/src/components/ui/tooltip.tsx b/apps/status-page/src/components/ui/tooltip.tsx
index 1ae8e37e5..0b2f4a597 100644
--- a/apps/status-page/src/components/ui/tooltip.tsx
+++ b/apps/status-page/src/components/ui/tooltip.tsx
@@ -46,13 +46,13 @@ function TooltipContent({
data-slot="tooltip-content"
sideOffset={sideOffset}
className={cn(
- "fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in text-balance rounded-md bg-primary px-3 py-1.5 text-primary-foreground text-xs data-[state=closed]:animate-out",
+ "fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in text-balance rounded-md bg-foreground px-3 py-1.5 text-background text-xs data-[state=closed]:animate-out",
className,
)}
{...props}
>
{children}
- <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-primary fill-primary" />
+ <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
</TooltipPrimitive.Content>
</TooltipPrimitive.Portal>
);
diff --git a/packages/api/src/router/statusPage.ts b/packages/api/src/router/statusPage.ts
index 79e87bf2f..9fdb2b506 100644
--- a/packages/api/src/router/statusPage.ts
+++ b/packages/api/src/router/statusPage.ts
@@ -341,7 +341,7 @@ export const statusPageRouter = createTRPCRouter({
type: "maintenance",
from: new Date(new Date().setDate(new Date().getDate() - 10)),
to: new Date(new Date().setDate(new Date().getDate() - 10)),
- name: "",
+ name: "DB migration",
id: 1,
status: "info",
},
diff --git a/packages/theme-store/README.md b/packages/theme-store/README.md
index 5d785248b..d1b7945d3 100644
--- a/packages/theme-store/README.md
+++ b/packages/theme-store/README.md
@@ -18,6 +18,9 @@ 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? Follow these steps:
### 1. Fork the Repository
diff --git a/packages/theme-store/src/default.ts b/packages/theme-store/src/default.ts
new file mode 100644
index 000000000..cd3b66edd
--- /dev/null
+++ b/packages/theme-store/src/default.ts
@@ -0,0 +1,61 @@
+import type { Theme } from "./types";
+
+export const DEFAULT_THEME = {
+ id: "default" as const,
+ name: "Default",
+ author: { name: "@openstatus", url: "https://openstatus.dev" },
+ light: {
+ "--background": "oklch(100% 0 0)",
+ "--foreground": "oklch(14.5% 0 0)",
+ "--border": "oklch(92.2% 0 0)",
+ "--input": "oklch(92.2% 0 0)",
+
+ "--primary": "oklch(20.5% 0 0)",
+ "--primary-foreground": "oklch(98.5% 0 0)",
+ "--secondary": "oklch(97% 0 0)",
+ "--secondary-foreground": "oklch(20.5% 0 0)",
+ "--muted": "oklch(97% 0 0)",
+ "--muted-foreground": "oklch(55.6% 0 0)",
+ "--accent": "oklch(97% 0 0)",
+ "--accent-foreground": "oklch(20.5% 0 0)",
+
+ "--success": "oklch(72% 0.19 150)",
+ "--destructive": "oklch(57.7% 0.245 27.325)",
+ "--warning": "oklch(77% 0.16 70)",
+ "--info": "oklch(62% 0.19 260)",
+ },
+ dark: {
+ "--background": "oklch(14.5% 0 0)",
+ "--foreground": "oklch(98.5% 0 0)",
+ "--border": "oklch(100% 0 0 / 10%)",
+ "--input": "oklch(100% 0 0 / 15%)",
+
+ "--primary": "oklch(92.2% 0 0)",
+ "--primary-foreground": "oklch(20.5% 0 0)",
+ "--secondary": "oklch(26.9% 0 0)",
+ "--secondary-foreground": "oklch(98.5% 0 0)",
+ "--muted": "oklch(26.9% 0 0)",
+ "--muted-foreground": "oklch(70.8% 0 0)",
+ "--accent": "oklch(26.9% 0 0)",
+ "--accent-foreground": "oklch(98.5% 0 0)",
+
+ "--success": "oklch(72% 0.19 150)",
+ "--destructive": "oklch(70.4% 0.191 22.216)",
+ "--warning": "oklch(77% 0.16 70)",
+ "--info": "oklch(62% 0.19 260)",
+ },
+} as const satisfies Theme;
+
+export const DEFAULT_ROUNDED_THEME = {
+ id: "default-rounded" as const,
+ name: "Default (Rounded)",
+ author: DEFAULT_THEME.author,
+ light: {
+ ...DEFAULT_THEME.light,
+ "--radius": "0.625rem",
+ },
+ dark: {
+ ...DEFAULT_THEME.dark,
+ "--radius": "0.625rem",
+ },
+} as const satisfies Theme;
diff --git a/packages/theme-store/src/index.ts b/packages/theme-store/src/index.ts
index dee095661..ebecd49da 100644
--- a/packages/theme-store/src/index.ts
+++ b/packages/theme-store/src/index.ts
@@ -1,21 +1,15 @@
export * from "./types";
+import { DEFAULT_ROUNDED_THEME, DEFAULT_THEME } from "./default";
import { GITHUB_CONTRAST } from "./github-contrast";
import { SUPABASE } from "./supabase";
import type { Theme, ThemeMap } from "./types";
-const DEFAULT_THEME = {
- id: "default" as const,
- name: "Default",
- author: { name: "@openstatus", url: "https://openstatus.dev" },
- light: {},
- dark: {},
-} as const satisfies Theme;
-
// TODO: Add validation to ensure that the theme IDs are unique
const THEMES_LIST = [
DEFAULT_THEME,
- GITHUB_CONTRAST,
+ DEFAULT_ROUNDED_THEME,
SUPABASE,
+ GITHUB_CONTRAST,
] satisfies Theme[];
export const THEMES = THEMES_LIST.reduce<ThemeMap>((acc, theme) => {
@@ -24,3 +18,4 @@ export const THEMES = THEMES_LIST.reduce<ThemeMap>((acc, theme) => {
}, {} as ThemeMap);
export const THEME_KEYS = THEMES_LIST.map((theme) => theme.id);
+export type ThemeKey = (typeof THEME_KEYS)[number];