Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(web): Topics first-run empty state with one setup action (#19291)

Trang Nguyencaa001597aa5
diff --git a/web/src/features/topics/TopicPilesIllustration.tsx b/web/src/features/topics/TopicPilesIllustration.tsx
new file mode 100644
index 0000000000..bde559bd7e
--- /dev/null
+++ b/web/src/features/topics/TopicPilesIllustration.tsx
@@ -0,0 +1,119 @@
+/* eslint-disable @typescript-eslint/no-use-before-define */
+import { cn } from "@/src/utils/tailwind";
+
+const PILE_LEFT = ["left-5", "left-33.5", "left-62"] as const;
+
+/** Decorative card with three topic piles; bars fill from the bottom. */
+export function TopicPilesIllustration({
+ piles,
+ slips = [],
+ bare = false,
+}: TopicPilesIllustrationProps) {
+ if (bare) {
+ return (
+ <div aria-hidden="true" className="flex items-end gap-4">
+ {piles.map((pile) => (
+ <PileBars key={pile.name} pile={pile} narrow />
+ ))}
+ </div>
+ );
+ }
+ return (
+ <div aria-hidden="true" className="relative h-62.5 w-110 shrink-0">
+ <div className="bg-background absolute top-17.5 left-10 z-10 h-45 w-90 rounded-lg border shadow-md">
+ {piles.map((pile, pileIndex) => (
+ <div
+ key={pile.name}
+ className={cn(
+ "absolute bottom-3.5 flex w-23 flex-col gap-1.5",
+ PILE_LEFT[pileIndex],
+ )}
+ >
+ <PileBars pile={pile} />
+ <div className="flex flex-col text-xs">
+ <span className="font-bold whitespace-nowrap">{pile.name}</span>
+ <span className="text-muted-foreground font-mono">
+ {pile.detail}
+ </span>
+ </div>
+ </div>
+ ))}
+ </div>
+ {slips.map((slip) => (
+ <div
+ key={slip.text}
+ className={cn(
+ "bg-background absolute z-20 flex items-center gap-1.75 rounded-lg border px-2.5 py-1.75 text-xs whitespace-nowrap shadow-md",
+ slip.position,
+ )}
+ >
+ <span
+ className="size-1.75 shrink-0 rounded-full"
+ style={{ backgroundColor: categoryColor(slip.color) }}
+ />
+ {slip.text}
+ </div>
+ ))}
+ </div>
+ );
+}
+
+function PileBars({ pile, narrow = false }: PileBarsProps) {
+ return (
+ <div className={cn("flex flex-col-reverse gap-0.75", narrow && "w-9")}>
+ {Array.from({ length: pile.slots }, (_, index) => (
+ <PileBar
+ key={index}
+ color={pile.color}
+ index={index}
+ filled={index < pile.filled}
+ />
+ ))}
+ </div>
+ );
+}
+
+function PileBar({ color, index, filled }: PileBarProps) {
+ return (
+ <span
+ className={cn(
+ "h-2.25 rounded-sm border transition-colors duration-500",
+ filled ? "border-transparent" : "border-dashed",
+ )}
+ style={{
+ backgroundColor: filled ? fadedColor(color, index) : "transparent",
+ }}
+ />
+ );
+}
+
+function categoryColor(color: PileColor) {
+ return `var(--category-${color}-highlight)`;
+}
+
+/** Bottom bar strongest; each bar above fades 8% toward the page. */
+function fadedColor(color: PileColor, index: number) {
+ return `color-mix(in oklch, ${categoryColor(color)} ${100 - index * 8}%, hsl(var(--background)))`;
+}
+
+type PileColor = "violet" | "blue" | "amber";
+
+type TopicPile = {
+ name: string;
+ detail: string;
+ slots: number;
+ filled: number;
+ color: PileColor;
+};
+
+type TopicPilesIllustrationProps = {
+ /** Three piles, left to right. */
+ piles: readonly TopicPile[];
+ slips?: readonly { text: string; color: PileColor; position: string }[];
+ /** Piles only: no card, labels or slips. */
+ bare?: boolean;
+};
+
+type PileBarsProps = { pile: TopicPile; narrow?: boolean };
+
+type PileBarProps = { color: PileColor; index: number; filled: boolean };
diff --git a/web/src/features/topics/TopicSetupNotice.tsx b/web/src/features/topics/TopicSetupNotice.tsx
index 65c1cc0b84..21cbe24b54 100644
--- a/web/src/features/topics/TopicSetupNotice.tsx
+++ b/web/src/features/topics/TopicSetupNotice.tsx
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-use-before-define */
-import { ArrowRight } from "@langfuse/icons";
import { Alert } from "@/src/components/design-system/Alert/Alert";
import { Button } from "@/src/components/design-system/Button/Button";
import { type TopicSetupNoticeState } from "./TopicModelSettings";
+import { TopicPilesIllustration } from "./TopicPilesIllustration";
type TopicSetupNoticeProps = {
notice: TopicSetupNoticeState;
@@ -55,18 +55,24 @@ export function TopicSetupNotice({
</Alert>
) : null}
{showOnboarding ? (
- <div className="mx-auto flex w-full max-w-4xl flex-col items-center gap-8 overflow-y-auto px-4 pt-12">
- <SortingIllustration />
- <h2 className="text-center text-2xl font-bold">
- Thousands of traces, identify recurring topics & issues
- </h2>
+ <div className="flex flex-1 flex-col items-center-safe justify-center-safe gap-7 overflow-y-auto px-4 pb-24">
+ <TopicPilesIllustration piles={LANDING_PILES} slips={LANDING_SLIPS} />
+ <div className="flex flex-col items-center gap-2 text-center">
+ <h2 className="text-3xl leading-tight font-bold tracking-tight text-balance">
+ See what your traces are about
+ </h2>
+ <p className="text-muted-foreground max-w-100 text-base text-pretty">
+ Every trace is labeled by intent, sentiment, outcome and issues,
+ so recurring patterns surface on their own.
+ </p>
+ </div>
{startBlockedReason ? (
<p role="status" className="text-muted-foreground text-sm">
{startBlockedReason}
</p>
) : (
<Button
- text="Start analyzing"
+ text="Set up topics"
disabled={!canWrite || !canConfigure}
onClick={onStart}
/>
@@ -77,84 +83,27 @@ export function TopicSetupNotice({
);
}
-// Decorative: a messy pile of traces sorted into three example topics.
-const MESSY_CARDS = [
- [10, 24, -12],
- [78, 0, 7],
- [150, 34, -4],
- [24, 96, 9],
- [112, 84, -15],
- [166, 118, 11],
- [0, 160, -6],
- [86, 156, 4],
- [150, 176, -9],
- [62, 48, 17],
+// Decorative: trace summaries dropping into three example topics.
+const LANDING_PILES = [
+ { name: "Refunds", detail: "214", slots: 9, filled: 9, color: "violet" },
+ { name: "Order status", detail: "154", slots: 6, filled: 6, color: "blue" },
+ { name: "Address", detail: "96", slots: 4, filled: 4, color: "amber" },
] as const;
-const SLAB_JITTER = [0, 3, -2, 4, -3, 1, -4, 2, -1, 3, 0];
-const PILES = [
+
+const LANDING_SLIPS = [
{
- name: "Refund requests",
- count: 214,
- slabs: 11,
- className: "bg-dark-violet/25 border-dark-violet/40",
+ text: "Refund for a double charge",
+ color: "violet",
+ position: "top-7 left-15 -rotate-8",
},
{
- name: "Order status",
- count: 156,
- slabs: 8,
- className: "bg-dark-blue/20 border-dark-blue/35",
+ text: "Package says delivered, not here",
+ color: "blue",
+ position: "top-1.5 left-47.5 rotate-5",
},
{
- name: "Cancel subscription",
- count: 61,
- slabs: 4,
- className: "bg-dark-teal/20 border-dark-teal/35",
+ text: "Ship to my office instead",
+ color: "amber",
+ position: "top-13 left-67.5 -rotate-4",
},
-];
-
-function SortingIllustration() {
- return (
- <div
- aria-hidden="true"
- className="bg-light-violet flex w-full items-center justify-center gap-8 overflow-hidden rounded-2xl px-6 py-10"
- >
- <div className="relative hidden h-60 w-72 shrink-0 sm:block">
- {MESSY_CARDS.map(([left, top, rotate]) => (
- <div
- key={`${left}-${top}`}
- className="bg-card absolute flex h-16 w-28 flex-col gap-2 rounded-lg border p-2.5 shadow-sm"
- style={{ left, top, transform: `rotate(${rotate}deg)` }}
- >
- <span className="bg-muted size-2 rounded-full" />
- <span className="bg-muted h-1.5 w-4/5 rounded" />
- <span className="bg-muted h-1.5 w-3/5 rounded" />
- </div>
- ))}
- </div>
- <ArrowRight
- size="lg"
- color="muted"
- __rawClassName="hidden shrink-0 sm:block"
- />
- <div className="flex items-end gap-5">
- {PILES.map((pile) => (
- <div key={pile.name} className="flex flex-col items-center gap-1">
- <div className="flex flex-col gap-1">
- {SLAB_JITTER.slice(0, pile.slabs).map((offset, index) => (
- <span
- key={index}
- className={`h-3.5 w-28 rounded border ${pile.className}`}
- style={{ transform: `translateX(${offset}px)` }}
- />
- ))}
- </div>
- <span className="mt-2 text-sm font-bold whitespace-nowrap">
- {pile.name}
- </span>
- <span className="text-muted-foreground text-sm">{pile.count}</span>
- </div>
- ))}
- </div>
- </div>
- );
-}
+] as const;
diff --git a/web/src/features/topics/TopicsHeaderActions.tsx b/web/src/features/topics/TopicsHeaderActions.tsx
index b52a187142..a8b08c4d21 100644
--- a/web/src/features/topics/TopicsHeaderActions.tsx
+++ b/web/src/features/topics/TopicsHeaderActions.tsx
@@ -16,15 +16,18 @@ export function TopicsHeaderActions({
onConfigure,
onHistory,
onRefresh,
+ menuOnly = false,
}: TopicsHeaderActionsProps) {
return (
<div className="ph-no-capture flex items-center justify-end gap-1">
- <AutomaticProcessingControl
- state={automaticProcessing.state}
- canWrite={canWrite && !automaticProcessing.saving}
- onOpen={onAutomaticProcessing}
- />
- {!configured ? (
+ {!menuOnly && (
+ <AutomaticProcessingControl
+ state={automaticProcessing.state}
+ canWrite={canWrite && !automaticProcessing.saving}
+ onOpen={onAutomaticProcessing}
+ />
+ )}
+ {!menuOnly && !configured ? (
<Button
text="Configure Topics"
variant={configure.triggerVariant}
@@ -33,7 +36,7 @@ export function TopicsHeaderActions({
onClick={onConfigure}
/>
) : null}
- {manualAvailable ? (
+ {!menuOnly && manualAvailable ? (
<Button
text="Manual processing"
variant="secondary"
@@ -98,4 +101,6 @@ type TopicsHeaderActionsProps = {
onConfigure: () => void;
onHistory: () => void;
onRefresh: () => void;
+ /** Before setup only the overflow menu shows. */
+ menuOnly?: boolean;
};
diff --git a/web/src/features/topics/TopicsPage.clienttest.tsx b/web/src/features/topics/TopicsPage.clienttest.tsx
index 805f945d66..861d183ebb 100644
--- a/web/src/features/topics/TopicsPage.clienttest.tsx
+++ b/web/src/features/topics/TopicsPage.clienttest.tsx
@@ -1052,12 +1052,15 @@ it.each([
it("shows the setup landing until the project's first stored summary exists", () => {
state.hasStoredSummaries = false;
const view = render(<TopicsPage />);
- expect(screen.getByRole("button", { name: "Start analyzing" })).toBeEnabled();
+ expect(screen.getByRole("button", { name: "Set up topics" })).toBeEnabled();
+ expect(
+ screen.queryByRole("button", { name: /^Automatic processing/ }),
+ ).toBeNull();
expect(screen.queryByTestId("current-topics")).toBeNull();
state.hasStoredSummaries = true;
view.rerender(<TopicsPage />);
expect(screen.getByTestId("current-topics")).toBeVisible();
- expect(screen.queryByRole("button", { name: "Start analyzing" })).toBeNull();
+ expect(screen.queryByRole("button", { name: "Set up topics" })).toBeNull();
});
it("opens generation directly from the empty topics panel", () => {
@@ -1085,9 +1088,5 @@ it("keeps date controls reachable when a disabled results query has no data", ()
expect(
screen.getByRole("button", { name: "Select last 30 days" }),
).toBeVisible();
- expect(
- screen.queryByText(
- "Thousands of traces, identify recurring topics & issues",
- ),
- ).toBeNull();
+ expect(screen.queryByText("See what your traces are about")).toBeNull();
});
diff --git a/web/src/features/topics/TopicsPage.tsx b/web/src/features/topics/TopicsPage.tsx
index 8ac9a71686..fedbe65dbd 100644
--- a/web/src/features/topics/TopicsPage.tsx
+++ b/web/src/features/topics/TopicsPage.tsx
@@ -45,6 +45,7 @@ import { ManualTopicsFormContent } from "./ManualTopicsFormContent";
import { cn } from "@/src/utils/tailwind";
import { TopicsFacetTabs } from "./TopicsFacetTabs";
import { resolveTopicFacetId } from "./topic-facet-selection";
+import { Spinner } from "@/src/components/layouts/Spinner";
import { TopicsHeaderActions } from "./TopicsHeaderActions";
import {
TopicsResultsViewSelect,
@@ -105,8 +106,8 @@ const facetOutcomeLabels: Record<TopicFacetOutcome, string> = {
failed: "Facet failed",
};
const loadingPage = (
- <Page headerProps={{ title: "Topics" }} withPadding>
- <p>Loading topics…</p>
+ <Page headerProps={{ title: "Topics" }}>
+ <Spinner message="Loading topics" />
</Page>
);
@@ -487,6 +488,8 @@ function TopicsWorkspaceContent({
!results.error &&
!hasStoredSummaries;
const showOnboarding = showSetupProgress || showLanding;
+ const landingOnly =
+ showLanding && !showSetupProgress && !setupBlockedReason;
return (
<Page
headerProps={{
@@ -521,6 +524,7 @@ function TopicsWorkspaceContent({
onConfigure={configured ? openConfigure : openSetup}
onHistory={openHistory}
onRefresh={refreshResults}
+ menuOnly={landingOnly}
/>
),
actionButtonsMenu: ({ closeMenu }) => {
@@ -531,7 +535,7 @@ function TopicsWorkspaceContent({
return (
<TopicsActionsMenu
triggerAction={
- pipeline.available
+ pipeline.available && !landingOnly
? {
label: "Manual processing",
disabled: false,