Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit a8396c6

Browse files
authored
fix(loops): Remove empty state CTA buttons (#3845)
1 parent 113eae9 commit a8396c6

4 files changed

Lines changed: 19 additions & 85 deletions

File tree

packages/ui/src/features/canvas/components/WebsiteChannelLoops.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,7 @@ export function WebsiteChannelLoops({ channelId }: { channelId: string }) {
144144
</Flex>
145145
</Flex>
146146
) : (
147-
<LoopsEmptyState
148-
contextName={contextName}
149-
onCreate={startBlank}
150-
disabledReason={limitReason}
151-
/>
147+
<LoopsEmptyState contextName={contextName} />
152148
)}
153149
</Flex>
154150
</div>
Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,22 @@
11
import { Theme } from "@radix-ui/themes";
22
import { render, screen } from "@testing-library/react";
3-
import userEvent from "@testing-library/user-event";
4-
import { describe, expect, it, vi } from "vitest";
3+
import { describe, expect, it } from "vitest";
54
import { LoopsEmptyState } from "./LoopsEmptyState";
65

76
describe("LoopsEmptyState", () => {
8-
it("starts loop creation from the primary CTA", async () => {
9-
const onCreate = vi.fn();
10-
render(
11-
<Theme>
12-
<LoopsEmptyState onCreate={onCreate} />
13-
</Theme>,
14-
);
7+
it.each([
8+
{ contextName: undefined, heading: "Create your first loop" },
9+
{ contextName: "general", heading: "Create a loop for #general" },
10+
])(
11+
'shows "$heading" when contextName is $contextName',
12+
({ contextName, heading }) => {
13+
render(
14+
<Theme>
15+
<LoopsEmptyState contextName={contextName} />
16+
</Theme>,
17+
);
1518

16-
await userEvent.click(
17-
screen.getByRole("button", { name: "Create a loop" }),
18-
);
19-
20-
expect(onCreate).toHaveBeenCalledOnce();
21-
});
22-
23-
it("disables creation when the project reached its loop limit", () => {
24-
render(
25-
<Theme>
26-
<LoopsEmptyState
27-
onCreate={vi.fn()}
28-
disabledReason="This project reached its loop limit."
29-
/>
30-
</Theme>,
31-
);
32-
33-
expect(
34-
screen.getByRole("button", { name: "Create a loop" }),
35-
).toBeDisabled();
36-
});
19+
expect(screen.getByText(heading)).toBeInTheDocument();
20+
},
21+
);
3722
});

packages/ui/src/features/loops/components/LoopsEmptyState.tsx

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
import { ArrowSquareOutIcon, PlusIcon } from "@phosphor-icons/react";
21
import { loopHog } from "@posthog/ui/assets/hedgehogs";
3-
import { Button } from "@posthog/ui/primitives/Button";
4-
import { openUrlInBrowser } from "@posthog/ui/utils/browser";
52
import { Flex, Text } from "@radix-ui/themes";
63

7-
// Placeholder until the loops docs page lands; swap for the final URL.
8-
const LOOPS_DOCS_URL = "https://posthog.com/docs/loops";
9-
104
const GETTING_STARTED_STEPS = [
115
"Describe what you want, or start from a template",
126
"Pick when it runs and what it can touch",
@@ -15,15 +9,7 @@ const GETTING_STARTED_STEPS = [
159

1610
/** The illustrated getting-started card shown when there are no loops yet. `contextName`
1711
* tweaks the copy for a context's Loops tab. */
18-
export function LoopsEmptyState({
19-
contextName,
20-
onCreate,
21-
disabledReason,
22-
}: {
23-
contextName?: string;
24-
onCreate: () => void;
25-
disabledReason?: string | null;
26-
}) {
12+
export function LoopsEmptyState({ contextName }: { contextName?: string }) {
2713
return (
2814
<div className="@container">
2915
<div className="flex @min-[720px]:flex-row flex-col items-center @min-[720px]:gap-0 gap-6 rounded-(--radius-3) border border-gray-6 border-dashed @min-[720px]:px-8 px-5 py-8">
@@ -61,27 +47,6 @@ export function LoopsEmptyState({
6147
</div>
6248
))}
6349
</div>
64-
<Flex gap="2" wrap="wrap">
65-
<Button
66-
variant="solid"
67-
size="2"
68-
onClick={onCreate}
69-
disabled={disabledReason != null}
70-
disabledReason={disabledReason}
71-
>
72-
<PlusIcon size={14} />
73-
Create a loop
74-
</Button>
75-
<Button
76-
variant="outline"
77-
color="gray"
78-
size="2"
79-
onClick={() => void openUrlInBrowser(LOOPS_DOCS_URL)}
80-
>
81-
Learn more
82-
<ArrowSquareOutIcon size={14} />
83-
</Button>
84-
</Flex>
8550
</Flex>
8651
</div>
8752
</div>

packages/ui/src/features/loops/components/LoopsListView.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,9 @@ export function LoopsListViewPresentation({
249249
membersLoading={membersLoading}
250250
membersError={membersError}
251251
membersComplete={membersComplete}
252-
onCreate={onStartBlank}
253-
disabledReason={limitReason}
254252
/>
255253
) : (
256-
<LoopsEmptyState
257-
onCreate={onStartBlank}
258-
disabledReason={limitReason}
259-
/>
254+
<LoopsEmptyState />
260255
)}
261256
</Flex>
262257

@@ -292,17 +287,13 @@ function LoopListTabs({
292287
membersLoading,
293288
membersError,
294289
membersComplete,
295-
onCreate,
296-
disabledReason,
297290
}: {
298291
personalLoops: LoopSchemas.Loop[];
299292
teamLoops: LoopSchemas.Loop[];
300293
members: UserBasic[];
301294
membersLoading: boolean;
302295
membersError: boolean;
303296
membersComplete: boolean;
304-
onCreate: () => void;
305-
disabledReason: string | null;
306297
}) {
307298
return (
308299
<Tabs defaultValue="personal" className="flex flex-col gap-5">
@@ -322,10 +313,7 @@ function LoopListTabs({
322313
{personalLoops.length > 0 ? (
323314
<LoopListSection loops={personalLoops} />
324315
) : (
325-
<LoopsEmptyState
326-
onCreate={onCreate}
327-
disabledReason={disabledReason}
328-
/>
316+
<LoopsEmptyState />
329317
)}
330318
</TabsContent>
331319
<TabsContent value="team">

0 commit comments

Comments
 (0)