77
88import { motion , AnimatePresence } from 'framer-motion'
99import {
10- Play , Square , RotateCcw , CheckCircle , XCircle , Clock ,
10+ Play , RotateCcw , CheckCircle , XCircle , Clock ,
1111 Send , ArrowDownLeft , Key , Shield , AlertTriangle ,
1212 Lock , Eye , EyeOff , Copy , Check , ChevronDown ,
1313 ChevronRight , Fingerprint , Book , User , Server , FileText ,
1414 Zap
1515} from 'lucide-react'
16- import { useEffect , useState , useRef , useCallback , type ElementType } from 'react'
16+ import { useEffect , useState , type ElementType } from 'react'
1717import type {
1818 FlowExecutorState ,
1919 CapturedExchange ,
@@ -30,9 +30,6 @@ import { StepCards } from './StepCards'
3030
3131interface RealFlowPanelProps {
3232 state : FlowExecutorState | null
33- onExecute : ( ) => void
34- onAbort : ( ) => void
35- onReset : ( ) => void
3633 isExecuting : boolean
3734 flowInfo : {
3835 supported : boolean
@@ -55,9 +52,6 @@ interface RealFlowPanelProps {
5552
5653export function RealFlowPanel ( {
5754 state,
58- onExecute,
59- onAbort,
60- onReset,
6155 isExecuting,
6256 flowInfo,
6357 requirements,
@@ -69,21 +63,6 @@ export function RealFlowPanel({
6963 showVCTab = false ,
7064} : RealFlowPanelProps ) {
7165 const [ activeTab , setActiveTab ] = useState < 'flow' | 'http' | 'wire' | 'tokens' | 'vc' > ( 'flow' )
72- const scrollContainerRef = useRef < HTMLDivElement > ( null )
73- const isNearBottomRef = useRef ( true )
74- const eventCount = ( state ?. events . length || 0 ) + ( wireExchanges . length )
75-
76- const handleScrollContainer = useCallback ( ( ) => {
77- if ( ! scrollContainerRef . current ) return
78- const { scrollTop, scrollHeight, clientHeight } = scrollContainerRef . current
79- isNearBottomRef . current = scrollHeight - scrollTop - clientHeight < 80
80- } , [ ] )
81-
82- useEffect ( ( ) => {
83- if ( isNearBottomRef . current && scrollContainerRef . current ) {
84- scrollContainerRef . current . scrollTop = scrollContainerRef . current . scrollHeight
85- }
86- } , [ eventCount ] )
8766
8867 const latestVerificationArtifact = state ?. vcArtifacts
8968 ? [ ...state . vcArtifacts ] . reverse ( ) . find ( ( artifact ) => artifact . type === 'verification_result' )
@@ -126,10 +105,6 @@ export function RealFlowPanel({
126105 const currentStatus = state ? statusConfig [ state . status ] : statusConfig . idle
127106 const StatusIcon = currentStatus . icon
128107
129- // For now, allow all flows to be executed
130- // Specific flows that need extra config (client_secret, refresh_token, username/password)
131- // will show an error when executed if the config is missing
132- const hasUnmetRequirements = false
133108 const tabs = [
134109 { id : 'flow' , label : 'Flow' , count : state ?. events . length || 0 , icon : Zap } ,
135110 { id : 'wire' , label : 'Wire' , count : wireExchanges . length , icon : Server } ,
@@ -175,47 +150,16 @@ export function RealFlowPanel({
175150 < div className = "space-y-3 sm:space-y-4" >
176151 { /* Flow Info Header */ }
177152 < div className = "p-3 sm:p-4 rounded-xl bg-surface-900/50 border border-white/5" >
178- { /* Top row: Status + Controls */ }
179- < div className = "flex items-start justify-between gap-2 mb-3" >
180- < div className = "flex items-center gap-2 sm:gap-3 min-w-0 flex-1" >
181- < div className = { `p-1.5 sm:p-2 rounded-lg flex-shrink-0 ${ currentStatus . bg } ` } >
182- < StatusIcon className = { `w-4 h-4 ${ currentStatus . color } ` } />
183- </ div >
184- < div className = "min-w-0" >
185- < p className = { `text-xs sm:text-sm font-medium ${ currentStatus . color } ` } > { currentStatus . label } </ p >
186- { state ?. currentStep && (
187- < p className = "text-[11px] text-surface-400 mt-0.5" > { state . currentStep } </ p >
188- ) }
189- </ div >
153+ { /* Status row */ }
154+ < div className = "flex items-center gap-2 sm:gap-3 mb-3" >
155+ < div className = { `p-1.5 sm:p-2 rounded-lg flex-shrink-0 ${ currentStatus . bg } ` } >
156+ < StatusIcon className = { `w-4 h-4 ${ currentStatus . color } ` } />
190157 </ div >
191-
192- { /* Controls */ }
193- < div className = "flex items-center gap-1.5 sm:gap-2 flex-shrink-0" >
194- { isExecuting ? (
195- < button
196- onClick = { onAbort }
197- className = "flex items-center gap-1.5 px-2.5 sm:px-3 py-1.5 sm:py-2 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 hover:bg-red-500/20 active:bg-red-500/30 transition-colors text-xs sm:text-sm"
198- >
199- < Square className = "w-3.5 h-3.5 sm:w-4 sm:h-4" />
200- < span > Abort</ span >
201- </ button >
202- ) : (
203- < button
204- onClick = { onExecute }
205- disabled = { hasUnmetRequirements || state ?. status === 'completed' }
206- className = "flex items-center gap-1.5 px-2.5 sm:px-4 py-1.5 sm:py-2 rounded-lg bg-gradient-to-r from-green-500 to-emerald-500 text-white font-medium hover:opacity-90 active:opacity-80 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed text-xs sm:text-sm"
207- >
208- < Play className = "w-3.5 h-3.5 sm:w-4 sm:h-4" />
209- < span > Execute</ span >
210- </ button >
158+ < div className = "min-w-0" >
159+ < p className = { `text-xs sm:text-sm font-medium ${ currentStatus . color } ` } > { currentStatus . label } </ p >
160+ { state ?. currentStep && (
161+ < p className = "text-[11px] text-surface-400 mt-0.5" > { state . currentStep } </ p >
211162 ) }
212- < button
213- onClick = { onReset }
214- className = "p-1.5 sm:p-2 rounded-lg bg-surface-800 border border-white/10 text-surface-400 hover:text-white active:bg-surface-700 transition-colors"
215- title = "Reset"
216- >
217- < RotateCcw className = "w-3.5 h-3.5 sm:w-4 sm:h-4" />
218- </ button >
219163 </ div >
220164 </ div >
221165
@@ -337,9 +281,7 @@ export function RealFlowPanel({
337281
338282 { /* Tab Content */ }
339283 < div
340- ref = { scrollContainerRef }
341- onScroll = { handleScrollContainer }
342- className = "min-h-[300px] sm:min-h-[400px] max-h-[450px] sm:max-h-[600px] overflow-y-auto scroll-smooth"
284+ className = "min-h-[300px] sm:min-h-[400px]"
343285 >
344286 < AnimatePresence mode = "wait" >
345287 { activeTab === 'flow' && (
0 commit comments