The Open Standard for Generative UI
Add Banner for Reliability (#1058)
AB1160470c1c57
diff --git a/packages/devtools/package.json b/packages/devtools/package.jsonindex 1c7926b09..da779953b 100644--- a/packages/devtools/package.json+++ b/packages/devtools/package.json@@ -1,6 +1,6 @@{"name": "@openuidev/devtools",- "version": "0.0.8",+ "version": "0.0.9","description": "Development-only UI widget for OpenUI apps: surfaces errors captured by @openuidev/observability","license": "MIT","type": "module",diff --git a/packages/devtools/src/OpenUIDevtools.tsx b/packages/devtools/src/OpenUIDevtools.tsxindex 6f7e490e0..fcbc204df 100644--- a/packages/devtools/src/OpenUIDevtools.tsx+++ b/packages/devtools/src/OpenUIDevtools.tsx@@ -29,6 +29,7 @@ import {type ThemeTokens,} from "./theme";import { ErrorBoundary, IconButton, ShiroLogo, ThemeSegmented } from "./ui";+import ReliabilityBanner from "./ui/ReliabilityBanner";/** Uniform row height for the settings menu, set by its tallest control. */const MENU_ROW_HEIGHT = 28;@@ -230,6 +231,8 @@ export function OpenUIDevtools({</div></div>+ <ReliabilityBanner themeMode={mode} />+<ErrorBoundary title="Inspect ran into a problem"><div style={styles.list}>{visibleEvents.length === 0 ? (diff --git a/packages/devtools/src/ui/ReliabilityBanner.tsx b/packages/devtools/src/ui/ReliabilityBanner.tsxnew file mode 100644index 000000000..91e0ab0cb--- /dev/null+++ b/packages/devtools/src/ui/ReliabilityBanner.tsx@@ -0,0 +1,97 @@+import { CSSProperties, useState } from "react";+import { ColorMode, FONT, theme, ThemeTokens } from "../theme";++export default function ReliabilityBanner({ themeMode }: { themeMode: ColorMode }) {+ const [bannerHovered, setBannerHovered] = useState(false);+ const styles = bannerStyles(theme(themeMode));++ return (+ <div style={styles.wrapper}>+ <span style={styles.fade} aria-hidden />+ <a+ style={styles.banner}+ href="https://www.openui.com/docs/openui-lang/reliability"+ target="_blank"+ rel="noreferrer"+ title="Learn how to track and fix errors in production"+ onMouseEnter={() => setBannerHovered(true)}+ onMouseLeave={() => setBannerHovered(false)}+ >+ <span style={styles.text}>+ <span style={styles.title}>Want to track and fix errors in production?</span>+ </span>+ <span+ style={{+ ...styles.bannerAction,+ ...(bannerHovered ? styles.bannerActionHover : null),+ }}+ >+ Learn more+ </span>+ </a>+ </div>+ );+}++const bannerStyles = (t: ThemeTokens) =>+ ({+ wrapper: {+ position: "relative",+ zIndex: 1,+ display: "flex",+ flexDirection: "column",+ gap: 8,+ flexShrink: 0,+ background: t.bg,+ padding: "12px 12px 18px",+ },+ fade: {+ position: "absolute",+ left: 0,+ right: 0,+ top: "100%",+ height: 12,+ background: `linear-gradient(to bottom, ${t.bg}, transparent)`,+ pointerEvents: "none",+ },+ banner: {+ display: "flex",+ alignItems: "center",+ justifyContent: "space-between",+ gap: 12,+ flexShrink: 0,+ textDecoration: "none",+ borderRadius: 12,+ background: t.promoBg,+ color: t.fg,+ cursor: "pointer",+ fontFamily: FONT,+ textAlign: "left",+ padding: "12px 14px",+ },+ text: {+ display: "flex",+ flexDirection: "column",+ },+ title: {+ fontSize: 12,+ fontWeight: 500,+ },+ bannerAction: {+ display: "inline-flex",+ alignItems: "center",+ justifyContent: "center",+ flexShrink: 0,+ border: `1px solid ${t.controlBorder}`,+ borderRadius: 8,+ background: t.controlBg,+ color: t.fg,+ boxShadow: t.shadowSubtle,+ fontSize: 11,+ padding: "5px 12px",+ transition: "transform 150ms ease",+ },+ bannerActionHover: {+ transform: "scale(0.96)",+ },+ }) satisfies Record<string, CSSProperties>;