Skip to content

Commit 2e53459

Browse files
committed
gate loops behind posthog-desktop-loops flag
1 parent 447b40c commit 2e53459

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

packages/shared/src/flags.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export const DISCOVERY_RUN_FLAG = "posthog-code-discovery-run";
1515
// Gates the entire canvas feature: the app rail's Channels space, the /website
1616
// routes, channels and dashboards.
1717
export const PROJECT_BLUEBIRD_FLAG = "project-bluebird";
18+
// Gates the Loops feature: the sidebar Loops space and the per-channel Loops tab.
19+
export const LOOPS_FLAG = "posthog-desktop-loops";
1820
export const TASKS_PREWARM_SANDBOX_FLAG = "tasks-prewarm-sandbox";
1921
export const GLM_MODEL_FLAG = "posthog-code-glm-model";
2022
/** Spoken narration (agent speaks via the `speak` tool). Gated for a staged rollout. */

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { Button, cn } from "@posthog/quill";
2+
import { LOOPS_FLAG } from "@posthog/shared";
23
import { CHANNEL_SECTIONS } from "@posthog/ui/features/canvas/channelSections";
34
import { ChannelPinnedMenu } from "@posthog/ui/features/canvas/components/ChannelPinnedMenu";
5+
import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";
46
import { Link, useRouterState } from "@tanstack/react-router";
57

68
const TABS = CHANNEL_SECTIONS.map((s) => ({
9+
key: s.key,
710
label: s.label,
811
to: `/website/$channelId/${s.key}` as const,
912
}));
@@ -13,10 +16,12 @@ const TABS = CHANNEL_SECTIONS.map((s) => ({
1316
// codebase's convention) rather than Link's activeProps.
1417
export function ChannelTabs({ channelId }: { channelId: string }) {
1518
const pathname = useRouterState({ select: (s) => s.location.pathname });
19+
const loopsEnabled = useFeatureFlag(LOOPS_FLAG, import.meta.env.DEV);
20+
const tabs = loopsEnabled ? TABS : TABS.filter((tab) => tab.key !== "loops");
1621

1722
return (
1823
<nav className="flex items-center gap-px">
19-
{TABS.map((tab) => {
24+
{tabs.map((tab) => {
2025
const href = tab.to.replace("$channelId", channelId);
2126
const active = pathname === href;
2227
return (

packages/ui/src/features/sidebar/components/SidebarNavSection.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { HashIcon } from "@phosphor-icons/react";
22
import { Badge, Switch } from "@posthog/quill";
3-
import { PROJECT_BLUEBIRD_FLAG } from "@posthog/shared";
3+
import { LOOPS_FLAG, PROJECT_BLUEBIRD_FLAG } from "@posthog/shared";
44
import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events";
55
import { HOME_TAB_FLAG } from "@posthog/shared/constants";
66
import { useCommandCenterStore } from "@posthog/ui/features/command-center/commandCenterStore";
@@ -62,6 +62,9 @@ export function SidebarNavSection({
6262
}: SidebarNavSectionProps = {}) {
6363
const view = useAppView();
6464
const homeTabEnabled = useFeatureFlag(HOME_TAB_FLAG);
65+
// Loops stays behind posthog-desktop-loops; default on in dev so local builds
66+
// keep the nav item. Also gates the per-channel Loops tab (see ChannelTabs).
67+
const loopsEnabled = useFeatureFlag(LOOPS_FLAG, import.meta.env.DEV);
6568
// Channels stay behind project-bluebird: the "Enable channels" nav row (and
6669
// the Canvas row it reveals) only appear where the canvas backend is wired.
6770
const bluebirdEnabled = useFeatureFlag(
@@ -164,9 +167,11 @@ export function SidebarNavSection({
164167
<AgentsItem isActive={isAgentsActive} onClick={navigateToAgents} />
165168
</Box>
166169

167-
<Box>
168-
<LoopsItem isActive={isLoopsActive} onClick={navigateToLoops} />
169-
</Box>
170+
{loopsEnabled ? (
171+
<Box>
172+
<LoopsItem isActive={isLoopsActive} onClick={navigateToLoops} />
173+
</Box>
174+
) : null}
170175

171176
<Box>
172177
<SkillsItem isActive={isSkillsActive} onClick={goSkills} />

0 commit comments

Comments
 (0)