Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion packages/ui/src/features/canvas/components/ChannelNav.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { BellIcon, EnvelopeSimple, Lightning } from "@phosphor-icons/react";
import {
BellIcon,
EnvelopeSimple,
Lightning,
RepeatIcon,
SlidersHorizontal,
} from "@phosphor-icons/react";
import { cn } from "@posthog/quill";
import { LOOPS_FLAG } from "@posthog/shared";
import {
ANALYTICS_EVENTS,
type SidebarNavItem,
Expand All @@ -10,12 +17,15 @@ import {
SHORTCUTS,
} from "@posthog/ui/features/command/keyboard-shortcuts";
import { useCommandCenterActiveCount } from "@posthog/ui/features/command-center/useCommandCenterActiveCount";
import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";
import { useInboxAllReports } from "@posthog/ui/features/inbox/hooks/useInboxAllReports";
import { openSettings } from "@posthog/ui/features/settings/hooks/useOpenSettings";
import { CountBadge } from "@posthog/ui/primitives/CountBadge";
import { Tooltip } from "@posthog/ui/primitives/Tooltip";
import {
navigateToActivity,
navigateToInbox,
navigateToLoops,
navigateToWebsiteCommandCenter,
} from "@posthog/ui/router/navigationBridge";
import { useAppView } from "@posthog/ui/router/useAppView";
Expand Down Expand Up @@ -64,6 +74,7 @@ function NavIcon({

export function ChannelNav() {
const view = useAppView();
const loopsEnabled = useFeatureFlag(LOOPS_FLAG, import.meta.env.DEV);

const { counts } = useInboxAllReports({
ignoreFilters: true,
Expand Down Expand Up @@ -118,6 +129,25 @@ export function ChannelNav() {
/>
}
/>
{loopsEnabled ? (
<NavIcon
icon={
<RepeatIcon
size={16}
weight={view.type === "loops" ? "fill" : "regular"}
/>
}
label="Loops"
isActive={view.type === "loops"}
onClick={withTrack("loops", navigateToLoops)}
/>
) : null}
<NavIcon
icon={<SlidersHorizontal size={16} />}
label="Configure"
isActive={false}
onClick={withTrack("configure", () => openSettings("agents"))}
/>
</div>
);
}
16 changes: 14 additions & 2 deletions packages/ui/src/features/loops/components/LoopDetailView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ import { TimezoneTimestamp } from "@posthog/ui/primitives/TimezoneTimestamp";
import { systemTimezone } from "@posthog/ui/primitives/timezone";
import { toast } from "@posthog/ui/primitives/toast";
import {
canGoBackInHistory,
goBackInHistory,
navigateToEditLoop,
navigateToLoops,
} from "@posthog/ui/router/navigationBridge";
import { track } from "@posthog/ui/shell/analytics";
import { useHostCapabilities } from "@posthog/ui/shell/useHostCapabilities";
import { Flex, Text } from "@radix-ui/themes";
import { useQuery } from "@tanstack/react-query";
import { useLocation } from "@tanstack/react-router";
import { useEffect, useRef, useState } from "react";
import { useLoop } from "../hooks/useLoop";
import {
Expand Down Expand Up @@ -62,6 +65,9 @@ import { LoopLoadError } from "./LoopFallbacks";
import { LoopRunRow } from "./LoopRunRow";

export function LoopDetailView({ loopId }: { loopId: string }) {
const hasLoopListOrigin = useLocation({
select: (location) => location.state.loopListOrigin === true,
});
const { data: loop, isLoading, isError } = useLoop(loopId);
const updateLoop = useUpdateLoop(loopId);
const deleteLoop = useDeleteLoop();
Expand Down Expand Up @@ -207,11 +213,17 @@ export function LoopDetailView({ loopId }: { loopId: string }) {
<Button
variant="link-muted"
size="sm"
onClick={navigateToLoops}
onClick={() => {
if (hasLoopListOrigin && canGoBackInHistory()) {
goBackInHistory();
return;
}
navigateToLoops();
}}
className="w-fit px-0"
>
<ArrowLeftIcon size={15} />
Loops
Back
</Button>

<Flex align="center" justify="between" gap="3" wrap="wrap">
Expand Down
7 changes: 7 additions & 0 deletions packages/ui/src/features/loops/components/LoopRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import {
summarizeNotificationDestinations,
} from "../loopDisplay";

declare module "@tanstack/react-router" {
interface HistoryState {
loopListOrigin?: boolean;
}
}

export function LoopRow({
loop,
creator,
Expand Down Expand Up @@ -55,6 +61,7 @@ export function LoopRow({
<Link
to="/code/loops/$loopId"
params={{ loopId: loop.id }}
state={{ loopListOrigin: true }}
className="flex items-center justify-between gap-3 rounded-(--radius-2) border border-border bg-(--color-panel-solid) px-4 py-3.5 no-underline transition-colors duration-150 hover:border-(--gray-6) hover:bg-(--gray-2)"
>
<Flex align="center" gap="3" className="min-w-0">
Expand Down
Loading