|
1 | 1 | import type { LoopSchemas } from "@posthog/api-client/loops"; |
2 | 2 | import { Badge } from "@posthog/ui/primitives/Badge"; |
| 3 | +import { navigateToTaskDetail } from "@posthog/ui/router/navigationBridge"; |
3 | 4 | import { Flex, Text } from "@radix-ui/themes"; |
4 | 5 |
|
5 | 6 | function statusColor( |
@@ -28,32 +29,34 @@ function formatRelativeDate(iso: string | null): string { |
28 | 29 |
|
29 | 30 | export function LoopRunRow({ run }: { run: LoopSchemas.LoopRun }) { |
30 | 31 | return ( |
31 | | - <Flex |
32 | | - align="center" |
33 | | - justify="between" |
34 | | - gap="3" |
35 | | - className="rounded-(--radius-2) border border-border bg-(--color-panel-solid) px-3 py-2.5" |
| 32 | + <button |
| 33 | + type="button" |
| 34 | + onClick={() => navigateToTaskDetail(run.task_id)} |
| 35 | + title="Open this run to see the agent's activity" |
| 36 | + className="w-full rounded-(--radius-2) border border-border bg-(--color-panel-solid) px-3 py-2.5 text-left transition-colors hover:bg-(--gray-3)" |
36 | 37 | > |
37 | | - <Flex direction="column" className="min-w-0 gap-0.5"> |
38 | | - <Flex align="center" gap="2"> |
39 | | - <Badge color={statusColor(run.status)}>{run.status}</Badge> |
40 | | - <Text className="text-[12px] text-gray-11"> |
41 | | - {formatRelativeDate(run.created_at)} |
42 | | - </Text> |
| 38 | + <Flex align="center" justify="between" gap="3"> |
| 39 | + <Flex direction="column" className="min-w-0 gap-0.5"> |
| 40 | + <Flex align="center" gap="2"> |
| 41 | + <Badge color={statusColor(run.status)}>{run.status}</Badge> |
| 42 | + <Text className="text-[12px] text-gray-11"> |
| 43 | + {formatRelativeDate(run.created_at)} |
| 44 | + </Text> |
| 45 | + </Flex> |
| 46 | + {run.error_message ? ( |
| 47 | + <Text className="truncate text-(--red-11) text-[11.5px]"> |
| 48 | + {run.error_message} |
| 49 | + </Text> |
| 50 | + ) : run.branch ? ( |
| 51 | + <Text className="truncate text-[11.5px] text-gray-10 [font-family:var(--font-mono)]"> |
| 52 | + {run.branch} |
| 53 | + </Text> |
| 54 | + ) : null} |
43 | 55 | </Flex> |
44 | | - {run.error_message ? ( |
45 | | - <Text className="truncate text-(--red-11) text-[11.5px]"> |
46 | | - {run.error_message} |
47 | | - </Text> |
48 | | - ) : run.branch ? ( |
49 | | - <Text className="truncate text-[11.5px] text-gray-10 [font-family:var(--font-mono)]"> |
50 | | - {run.branch} |
51 | | - </Text> |
52 | | - ) : null} |
| 56 | + <Text className="shrink-0 text-[11px] text-gray-10 uppercase"> |
| 57 | + {run.environment} |
| 58 | + </Text> |
53 | 59 | </Flex> |
54 | | - <Text className="shrink-0 text-[11px] text-gray-10 uppercase"> |
55 | | - {run.environment} |
56 | | - </Text> |
57 | | - </Flex> |
| 60 | + </button> |
58 | 61 | ); |
59 | 62 | } |
0 commit comments