22 ArrowSquareOutIcon ,
33 BrainIcon ,
44 BugIcon ,
5+ CircleNotchIcon ,
56 GithubLogoIcon ,
67 KanbanIcon ,
78 TicketIcon ,
@@ -16,7 +17,10 @@ import {
1617 Switch ,
1718 Text ,
1819} from "@radix-ui/themes" ;
19- import type { Evaluation } from "@renderer/api/posthogClient" ;
20+ import type {
21+ Evaluation ,
22+ SignalSourceConfig ,
23+ } from "@renderer/api/posthogClient" ;
2024import { memo , useCallback } from "react" ;
2125
2226export interface SignalSourceValues {
@@ -37,6 +41,7 @@ interface SignalSourceToggleCardProps {
3741 requiresSetup ?: boolean ;
3842 onSetup ?: ( ) => void ;
3943 loading ?: boolean ;
44+ statusSection ?: React . ReactNode ;
4045}
4146
4247const SignalSourceToggleCard = memo ( function SignalSourceToggleCard ( {
@@ -49,6 +54,7 @@ const SignalSourceToggleCard = memo(function SignalSourceToggleCard({
4954 requiresSetup,
5055 onSetup,
5156 loading,
57+ statusSection,
5258} : SignalSourceToggleCardProps ) {
5359 return (
5460 < Box
@@ -101,6 +107,7 @@ const SignalSourceToggleCard = memo(function SignalSourceToggleCard({
101107 />
102108 ) }
103109 </ Flex >
110+ { statusSection && < Box style = { { marginLeft : 32 } } > { statusSection } </ Box > }
104111 </ Box >
105112 ) ;
106113} ) ;
@@ -210,6 +217,30 @@ export const EvaluationsSection = memo(function EvaluationsSection({
210217 ) ;
211218} ) ;
212219
220+ function SourceRunningIndicator ( {
221+ status,
222+ message,
223+ } : {
224+ status : SignalSourceConfig [ "status" ] ;
225+ message : string ;
226+ } ) {
227+ if ( status !== "running" ) {
228+ return null ;
229+ }
230+ return (
231+ < Flex align = "center" gap = "2" mt = "2" >
232+ < CircleNotchIcon
233+ size = { 14 }
234+ className = "animate-spin"
235+ style = { { color : "var(--accent-11)" } }
236+ />
237+ < Text size = "1" style = { { color : "var(--accent-11)" } } >
238+ { message }
239+ </ Text >
240+ </ Flex >
241+ ) ;
242+ }
243+
213244interface SignalSourceTogglesProps {
214245 value : SignalSourceValues ;
215246 onToggle : ( source : keyof SignalSourceValues , enabled : boolean ) => void ;
@@ -220,6 +251,7 @@ interface SignalSourceTogglesProps {
220251 { requiresSetup : boolean ; loading : boolean }
221252 >
222253 > ;
254+ sessionAnalysisStatus ?: SignalSourceConfig [ "status" ] ;
223255 onSetup ?: ( source : keyof SignalSourceValues ) => void ;
224256 evaluations ?: Evaluation [ ] ;
225257 evaluationsUrl ?: string ;
@@ -231,6 +263,7 @@ export function SignalSourceToggles({
231263 onToggle,
232264 disabled,
233265 sourceStates,
266+ sessionAnalysisStatus,
234267 onSetup,
235268 evaluations,
236269 evaluationsUrl,
@@ -269,6 +302,14 @@ export function SignalSourceToggles({
269302 checked = { value . session_replay }
270303 onCheckedChange = { toggleSessionReplay }
271304 disabled = { disabled }
305+ statusSection = {
306+ value . session_replay ? (
307+ < SourceRunningIndicator
308+ status = { sessionAnalysisStatus ?? null }
309+ message = "Session analysis run in progress now…"
310+ />
311+ ) : undefined
312+ }
272313 />
273314 < SignalSourceToggleCard
274315 icon = { < BugIcon size = { 20 } /> }
0 commit comments