🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(banner): inline the notification title instead of a second column (LFE-14490) (#15872)
Nikita Kabardin17266cd9a2b7
diff --git a/web/src/components/ui/callout.stories.tsx b/web/src/components/ui/callout.stories.tsxnew file mode 100644index 0000000000..648b9956d4--- /dev/null+++ b/web/src/components/ui/callout.stories.tsx@@ -0,0 +1,54 @@+import { Bot } from "lucide-react";+import preview from "../../../.storybook/preview";+import { Button } from "./button";+import { Callout } from "./callout";++const meta = preview.meta({+ component: Callout,+});++// Message and actions share a row from `sm` up; below that the actions drop+// under the full-width message so it is not squeezed into a narrow column+// (LFE-14490). Dismiss keeps its corner either way. Resize the Storybook canvas+// across 640px to see the switch (CSS-only; jsdom story tests do not apply+// media queries).+export const WithActions = meta.story({+ args: {+ id: "callout-story:with-actions",+ variant: "info",+ align: "middle",+ actions: () => (+ <Button size="sm" variant="secondary">+ Learn more+ </Button>+ ),+ children: (+ <div className="flex items-start gap-2 sm:items-center">+ <Bot className="mt-0.5 h-4 w-4 shrink-0 sm:mt-0" />+ <span>+ <span className="font-bold">+ Langfuse works great with your AI coding agents.+ </span>{" "}+ Connect Claude Code, Codex, and other agents to your data with the+ Langfuse Agent Skill, MCP server, and CLI.+ </span>+ </div>+ ),+ },+});++// Without actions the message keeps the full width at every size, minus the+// dismiss control.+export const WarningWithoutActions = meta.story({+ args: {+ id: "callout-story:no-actions",+ variant: "warning",+ align: "top",+ children: (+ <span>+ <span className="font-bold">Heads up:</span> this workspace is close to+ its ingestion limit for the current billing period.+ </span>+ ),+ },+});diff --git a/web/src/components/ui/callout.tsx b/web/src/components/ui/callout.tsxindex ab665e6349..b5b198bd13 100644--- a/web/src/components/ui/callout.tsx+++ b/web/src/components/ui/callout.tsx@@ -82,7 +82,10 @@ export function Callout({variant === "warning"? "border-light-yellow bg-light-yellow dark:border-light-yellow dark:bg-light-yellow": "border-light-blue bg-light-blue dark:border-light-blue dark:bg-light-blue";- const alignmentClass = align === "middle" ? "items-center" : "items-start";+ // Vertical alignment only applies once text and actions share a row (sm+);+ // below that the column stacks them and the cross axis is horizontal.+ const alignmentClass =+ align === "middle" ? "sm:items-center" : "sm:items-start";const alignmentOverrides =align === "middle"@@ -93,22 +96,30 @@ export function Callout({<AlertclassName={`${variantClass} ${alignmentOverrides} ${className ?? ""}`}>+ {/* Dismiss stays outside the stacking wrapper so it keeps its corner+ position; only the actions drop below the message on narrow widths. */}<AlertDescription- className={`flex ${alignmentClass} ml-1 justify-between`}+ className={`ml-1 flex items-start gap-2 ${align === "middle" ? "sm:items-center" : ""}`}>- <div className="text-foreground flex-1 text-sm">{children}</div>- <div className="ml-4 flex items-center gap-2">- {actions && actions()}- <Button- variant="ghost"- size="sm"- onClick={handleDismiss}- className="text-muted-foreground hover:text-foreground h-6 w-6 p-0"- aria-label="Dismiss"- >- <X className="h-4 w-4" />- </Button>+ <div+ className={`flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:justify-between ${alignmentClass}`}+ >+ <div className="text-foreground min-w-0 text-sm">{children}</div>+ {actions && (+ <div className="flex shrink-0 items-center gap-2 self-end sm:ml-4 sm:self-auto">+ {actions()}+ </div>+ )}</div>+ <Button+ variant="ghost"+ size="sm"+ onClick={handleDismiss}+ className="text-muted-foreground hover:text-foreground h-6 w-6 shrink-0 p-0"+ aria-label="Dismiss"+ >+ <X className="h-4 w-4" />+ </Button></AlertDescription></Alert>);diff --git a/web/src/features/developer-tools/components/AgentToolsBanner.tsx b/web/src/features/developer-tools/components/AgentToolsBanner.tsxindex c0cbfc227f..7235ef01f1 100644--- a/web/src/features/developer-tools/components/AgentToolsBanner.tsx+++ b/web/src/features/developer-tools/components/AgentToolsBanner.tsx@@ -26,8 +26,8 @@ export function AgentToolsBanner() {</Button>)}>- <div className="flex items-center gap-2">- <Bot className="h-4 w-4 shrink-0" />+ <div className="flex items-start gap-2 sm:items-center">+ <Bot className="mt-0.5 h-4 w-4 shrink-0 sm:mt-0" /><span><span className="font-bold">Langfuse works great with your AI coding agents.diff --git a/web/src/features/payment-banner/PaymentBanner.tsx b/web/src/features/payment-banner/PaymentBanner.tsxindex ca977c17b6..ee884ac4ab 100644--- a/web/src/features/payment-banner/PaymentBanner.tsx+++ b/web/src/features/payment-banner/PaymentBanner.tsx@@ -1,15 +1,11 @@import { useMemo, useRef } from "react";import { useSession } from "next-auth/react";-import { AlertCircle, CreditCard } from "lucide-react";-import Link from "next/link";-import { Button } from "@/src/components/ui/button";import { useQueryProjectOrOrganization } from "@/src/features/projects/hooks";import { useIsCloudBillingAvailable } from "@/src/ee/features/billing/utils/isCloudBilling";import { useTopBannerRegistration } from "@/src/features/top-banner";-import { cn } from "@/src/utils/tailwind";import { env } from "@/src/env.mjs";import { hasOrganizationAccess } from "@/src/features/rbac/utils/checkOrganizationAccess";-import { cva } from "class-variance-authority";+import { PaymentBannerView } from "./PaymentBannerView";const PAYMENT_BANNER_ID = "payment-banner";const PAYMENT_BANNER_ORDER = 10;@@ -60,59 +56,18 @@ export function PaymentBanner() {elementRef: bannerRef,});- // Determine severity styling- const isCritical = subscriptionStatus === "unpaid";const basePath = env.NEXT_PUBLIC_BASE_PATH ?? "";- const drawerVariants = cva(- "fixed top-0 z-51 flex w-full items-center justify-between gap-4 px-4 py-1 sm:px-4 lg:px-4",- {- variants: {- type: {- info: "bg-foreground text-background",- warning:- "bg-amber-500 text-amber-950 dark:bg-amber-600 dark:text-amber-50",- critical: "bg-destructive text-destructive-foreground",- },-- defaultVariants: {- type: "info",- },- },- },- );-if (!isVisible || !organization) {return null;}return (- <div+ <PaymentBannerViewref={bannerRef}- className={cn(drawerVariants({ type: isCritical ? "critical" : "info" }))}- role="alert"- aria-live="polite"- >- <div className="flex items-center gap-3">- <AlertCircle className="h-4 w-4 shrink-0" />- <div className="flex flex-col gap-0.5 sm:flex-row sm:items-center sm:gap-2">- <span className="text-sm font-bold">Billing Issue:</span>- <span className="text-sm">- {`We have problems collecting subscription payment for your organization '${organization.name}'. Please update your payment information to continue using Langfuse.`}- </span>- </div>- </div>-- <div className="flex items-center gap-2">- <Button size="sm" variant="ghost" asChild>- <Link- href={`${basePath}/organization/${organization.id}/settings/billing`}- >- <CreditCard className="mr-2 h-4 w-4" />- Update Payment- </Link>- </Button>- </div>- </div>+ organizationName={organization.name}+ billingSettingsHref={`${basePath}/organization/${organization.id}/settings/billing`}+ severity={subscriptionStatus === "unpaid" ? "critical" : "info"}+ />);}diff --git a/web/src/features/payment-banner/PaymentBannerView.stories.tsx b/web/src/features/payment-banner/PaymentBannerView.stories.tsxnew file mode 100644index 0000000000..8b364680f2--- /dev/null+++ b/web/src/features/payment-banner/PaymentBannerView.stories.tsx@@ -0,0 +1,36 @@+import preview from "../../../.storybook/preview";+import { PaymentBannerView } from "./PaymentBannerView";++const meta = preview.meta({+ component: PaymentBannerView,+ args: {+ organizationName: "handshake",+ billingSettingsHref: "/organization/org-id/settings/billing",+ },+});++/**+ * A payment we could not collect (Stripe `past_due`). Pins to the top of the+ * viewport, as in the app. Narrow the Storybook canvas: the sentence reflows as+ * a whole, keeping the bold title inline with the message, and below `sm` the+ * action drops to its own row so the message keeps the full width.+ */+export const Default = meta.story({});++/**+ * Stripe `unpaid` — same layout, destructive colors.+ */+export const Critical = meta.story({+ args: { severity: "critical" },+});++/**+ * Organization names are user-supplied and can be long and unbroken; the+ * message still wraps instead of pushing the action off the strip.+ */+export const LongOrganizationName = meta.story({+ args: {+ organizationName:+ "acme-corporation-platform-engineering-observability-team-production",+ },+});diff --git a/web/src/features/payment-banner/PaymentBannerView.tsx b/web/src/features/payment-banner/PaymentBannerView.tsxnew file mode 100644index 0000000000..9df0dad28f--- /dev/null+++ b/web/src/features/payment-banner/PaymentBannerView.tsx@@ -0,0 +1,76 @@+import { type Ref } from "react";+import { AlertCircle, CreditCard } from "lucide-react";+import Link from "next/link";+import { cva, type VariantProps } from "class-variance-authority";+import { Button } from "@/src/components/ui/button";+import { cn } from "@/src/utils/tailwind";++const paymentBannerVariants = cva(+ "fixed top-0 z-51 flex w-full flex-col gap-1 px-4 py-1.5 sm:flex-row sm:items-center sm:gap-3 sm:py-1",+ {+ variants: {+ severity: {+ info: "bg-foreground text-background",+ warning:+ "bg-amber-500 text-amber-950 dark:bg-amber-600 dark:text-amber-50",+ critical: "bg-destructive text-destructive-foreground",+ },+ },+ defaultVariants: {+ severity: "info",+ },+ },+);++export type PaymentBannerViewProps = VariantProps<+ typeof paymentBannerVariants+> & {+ /** Organization the failing subscription belongs to. */+ organizationName: string;+ /** Billing settings page for that organization. */+ billingSettingsHref: string;+ ref?: Ref<HTMLDivElement>;+};++/**+ * Full-width strip warning that a subscription payment could not be collected.+ * Icon, then the message as one paragraph flow with the title as a bold inline+ * span, then the action — so narrow widths reflow the whole sentence instead of+ * squeezing a title column (LFE-14490). Below `sm` the action drops to its own+ * row so the message keeps the full width instead of wrapping beside it.+ */+export function PaymentBannerView({+ organizationName,+ billingSettingsHref,+ severity,+ ref,+}: PaymentBannerViewProps) {+ return (+ <div+ ref={ref}+ className={cn(paymentBannerVariants({ severity }))}+ role="alert"+ aria-live="polite"+ >+ <div className="flex min-w-0 flex-1 items-start gap-3 sm:items-center">+ {/* mt-0.5 optically centers the 16px icon on the first 20px text line */}+ <AlertCircle className="mt-0.5 h-4 w-4 shrink-0 sm:mt-0" />+ <p className="min-w-0 text-sm wrap-break-word">+ <span className="font-bold">Billing Issue:</span>{" "}+ {`We have problems collecting subscription payment for your organization '${organizationName}'. Please update your payment information to continue using Langfuse.`}+ </p>+ </div>+ <Button+ size="sm"+ variant="ghost"+ asChild+ className="shrink-0 self-end sm:self-auto"+ >+ <Link href={billingSettingsHref}>+ <CreditCard className="mr-2 h-4 w-4" />+ Update Payment+ </Link>+ </Button>+ </div>+ );+}diff --git a/web/src/features/v4-migration/V4MigrationBanner.tsx b/web/src/features/v4-migration/V4MigrationBanner.tsxindex abefdbfc15..9c753f2d85 100644--- a/web/src/features/v4-migration/V4MigrationBanner.tsx+++ b/web/src/features/v4-migration/V4MigrationBanner.tsx@@ -81,8 +81,8 @@ export function V4MigrationBanner() {</>)}>- <div className="flex items-center gap-2">- <Zap className="h-4 w-4 shrink-0" />+ <div className="flex items-start gap-2 sm:items-center">+ <Zap className="mt-0.5 h-4 w-4 shrink-0 sm:mt-0" /><span><span className="font-bold">Langfuse v4 is here: real-time and up to 165× faster.