11'use client' ;
22
3- import { useTheme } from '@lib/hooks/use-theme' ;
43import type {
54 ChatflowNode ,
65 ChatflowParallelBranch ,
@@ -42,7 +41,6 @@ export function ChatflowExecutionBar({
4241 index,
4342 delay = 0 ,
4443} : ChatflowExecutionBarProps ) {
45- const { isDark } = useTheme ( ) ;
4644 const t = useTranslations ( 'pages.chatflow.executionBar' ) ;
4745 const [ isVisible , setIsVisible ] = useState ( false ) ;
4846 const [ elapsedTime , setElapsedTime ] = useState ( 0 ) ;
@@ -113,37 +111,28 @@ export function ChatflowExecutionBar({
113111 < Loader2
114112 className = { cn (
115113 'h-4 w-4 animate-spin' ,
116- isDark ? 'text-stone-400' : ' text-stone-600 '
114+ 'text-stone-600 dark: text-stone-400 '
117115 ) }
118116 />
119117 ) ;
120118 case 'completed' :
121119 return (
122120 < CheckCircle
123- className = { cn (
124- 'h-4 w-4' ,
125- isDark ? 'text-stone-400' : 'text-stone-600'
126- ) }
121+ className = { cn ( 'h-4 w-4' , 'text-stone-600 dark:text-stone-400' ) }
127122 />
128123 ) ;
129124 case 'failed' :
130125 return < XCircle className = "h-4 w-4 text-red-500" /> ;
131126 case 'pending' :
132127 return (
133128 < Clock
134- className = { cn (
135- 'h-4 w-4' ,
136- isDark ? 'text-stone-500' : 'text-stone-400'
137- ) }
129+ className = { cn ( 'h-4 w-4' , 'text-stone-400 dark:text-stone-500' ) }
138130 />
139131 ) ;
140132 default :
141133 return (
142134 < AlertCircle
143- className = { cn (
144- 'h-4 w-4' ,
145- isDark ? 'text-stone-500' : 'text-stone-400'
146- ) }
135+ className = { cn ( 'h-4 w-4' , 'text-stone-400 dark:text-stone-500' ) }
147136 />
148137 ) ;
149138 }
@@ -247,7 +236,7 @@ export function ChatflowExecutionBar({
247236 // Use new indicator bar style
248237 node . isInIteration ? 'iteration-node' : 'loop-node' ,
249238 // Slight background color distinction
250- isDark ? 'bg-stone-800/20' : ' bg-stone-50/40 '
239+ 'bg-stone-50/40 dark: bg-stone-800/20 '
251240 )
252241 : '' ;
253242
@@ -257,37 +246,27 @@ export function ChatflowExecutionBar({
257246 case 'running' :
258247 return cn (
259248 combinedBaseStyles ,
260- isDark
261- ? 'border-stone-600 bg-stone-700/50 shadow-lg shadow-stone-900/30'
262- : 'border-stone-300 bg-stone-200/50 shadow-lg shadow-stone-200/50'
249+ 'border-stone-300 bg-stone-200/50 shadow-lg shadow-stone-200/50 dark:border-stone-600 dark:bg-stone-700/50 dark:shadow-lg dark:shadow-stone-900/30'
263250 ) ;
264251 case 'completed' :
265252 return cn (
266253 combinedBaseStyles ,
267- isDark
268- ? 'border-stone-500 bg-stone-600/30'
269- : 'border-stone-300 bg-stone-100'
254+ 'border-stone-300 bg-stone-100 dark:border-stone-500 dark:bg-stone-600/30'
270255 ) ;
271256 case 'failed' :
272257 return cn (
273258 combinedBaseStyles ,
274- isDark
275- ? 'border-red-700/50 bg-red-900/20'
276- : 'border-red-200 bg-red-50'
259+ 'border-red-200 bg-red-50 dark:border-red-700/50 dark:bg-red-900/20'
277260 ) ;
278261 case 'pending' :
279262 return cn (
280263 combinedBaseStyles ,
281- isDark
282- ? 'border-stone-700/50 bg-stone-800/50'
283- : 'border-stone-200 bg-stone-50'
264+ 'border-stone-200 bg-stone-50 dark:border-stone-700/50 dark:bg-stone-800/50'
284265 ) ;
285266 default :
286267 return cn (
287268 combinedBaseStyles ,
288- isDark
289- ? 'border-stone-700/50 bg-stone-800/50'
290- : 'border-stone-200 bg-stone-50'
269+ 'border-stone-200 bg-stone-50 dark:border-stone-700/50 dark:bg-stone-800/50'
291270 ) ;
292271 }
293272 } ;
@@ -324,7 +303,7 @@ export function ChatflowExecutionBar({
324303 < span
325304 className = { cn (
326305 'flex-1 truncate font-serif text-sm font-medium' ,
327- isDark ? 'text-stone-200' : ' text-stone-800 '
306+ 'text-stone-800 dark: text-stone-200 '
328307 ) }
329308 >
330309 { getNodeTitle ( ) }
@@ -337,7 +316,7 @@ export function ChatflowExecutionBar({
337316 < span
338317 className = { cn (
339318 'rounded bg-stone-200 px-1.5 py-0.5 text-xs text-stone-700' ,
340- isDark && ' bg-stone-700/50 text-stone-300'
319+ 'dark: bg-stone-700/50 dark: text-stone-300'
341320 ) }
342321 >
343322 { ( node . currentIteration || 0 ) + 1 } /{ node . totalIterations }
@@ -347,7 +326,7 @@ export function ChatflowExecutionBar({
347326 < span
348327 className = { cn (
349328 'rounded bg-stone-200 px-1.5 py-0.5 text-xs text-stone-700' ,
350- isDark && ' bg-stone-700/50 text-stone-300'
329+ 'dark: bg-stone-700/50 dark: text-stone-300'
351330 ) }
352331 >
353332 { node . completedBranches || 0 } /{ node . totalBranches }
@@ -357,7 +336,7 @@ export function ChatflowExecutionBar({
357336 < span
358337 className = { cn (
359338 'rounded bg-stone-200 px-1.5 py-0.5 text-xs text-stone-700' ,
360- isDark && ' bg-stone-700/50 text-stone-300'
339+ 'dark: bg-stone-700/50 dark: text-stone-300'
361340 ) }
362341 >
363342 { node . maxLoops
@@ -372,23 +351,15 @@ export function ChatflowExecutionBar({
372351 node . status === 'running'
373352 ? cn (
374353 // Base style
375- isDark
376- ? 'bg-stone-600/40 text-stone-200'
377- : 'bg-stone-300/60 text-stone-700' ,
354+ 'bg-stone-300/60 text-stone-700 dark:bg-stone-600/40 dark:text-stone-200' ,
378355 // Subtle pulse effect
379356 'animate-pulse'
380357 )
381358 : node . status === 'completed'
382- ? isDark
383- ? 'bg-stone-500/40 text-stone-100'
384- : 'bg-stone-200 text-stone-800'
359+ ? 'bg-stone-200 text-stone-800 dark:bg-stone-500/40 dark:text-stone-100'
385360 : node . status === 'failed'
386- ? isDark
387- ? 'bg-red-700/30 text-red-200'
388- : 'bg-red-100 text-red-700'
389- : isDark
390- ? 'bg-stone-700/50 text-stone-400'
391- : 'bg-stone-200/80 text-stone-600'
361+ ? 'bg-red-100 text-red-700 dark:bg-red-700/30 dark:text-red-200'
362+ : 'bg-stone-200/80 text-stone-600 dark:bg-stone-700/50 dark:text-stone-400'
392363 ) }
393364 >
394365 { getStatusText ( ) }
@@ -404,7 +375,7 @@ export function ChatflowExecutionBar({
404375 < div
405376 className = { cn (
406377 'font-serif text-xs' ,
407- isDark ? 'text-stone-400' : ' text-stone-500 '
378+ 'text-stone-500 dark: text-stone-400 '
408379 ) }
409380 >
410381 { formatTime ( elapsedTime ) }
@@ -435,19 +406,14 @@ export function ChatflowExecutionBar({
435406 current = { node . completedBranches || 0 }
436407 total = { node . totalBranches }
437408 type = "branch"
438- isDark = { isDark }
439409 />
440410 </ div >
441411 ) }
442412
443413 { /* Branch list */ }
444414 < div className = "space-y-1" >
445415 { node . parallelBranches ?. map ( branch => (
446- < ParallelBranchItem
447- key = { branch . id }
448- branch = { branch }
449- isDark = { isDark }
450- />
416+ < ParallelBranchItem key = { branch . id } branch = { branch } />
451417 ) ) }
452418 </ div >
453419 </ div >
@@ -485,10 +451,9 @@ function CollapsibleContent({
485451// --- 🎯 New: parallel branch item component ---
486452interface ParallelBranchItemProps {
487453 branch : ChatflowParallelBranch ;
488- isDark : boolean ;
489454}
490455
491- function ParallelBranchItem ( { branch, isDark } : ParallelBranchItemProps ) {
456+ function ParallelBranchItem ( { branch } : ParallelBranchItemProps ) {
492457 const t = useTranslations ( 'pages.chatflow.executionBar' ) ;
493458 const [ elapsedTime , setElapsedTime ] = useState ( 0 ) ;
494459
@@ -531,13 +496,13 @@ function ParallelBranchItem({ branch, isDark }: ParallelBranchItemProps) {
531496 className = { cn (
532497 'ml-4 flex items-center gap-2 rounded-md border-l-2 px-3 py-2 font-serif' ,
533498 branch . status === 'running' &&
534- cn ( 'border-l-stone-400' , isDark ? 'bg-stone-800/20' : ' bg-stone-100 ') ,
499+ cn ( 'border-l-stone-400' , 'bg-stone-100 dark: bg-stone-800/20 ' ) ,
535500 branch . status === 'completed' &&
536- cn ( 'border-l-stone-500' , isDark ? 'bg-stone-700/20' : ' bg-stone-50 ') ,
501+ cn ( 'border-l-stone-500' , 'bg-stone-50 dark: bg-stone-700/20 ' ) ,
537502 branch . status === 'failed' &&
538- cn ( 'border-l-red-500' , isDark ? 'bg-red-900/20' : ' bg-red-50 ') ,
503+ cn ( 'border-l-red-500' , 'bg-red-50 dark: bg-red-900/20 ' ) ,
539504 branch . status === 'pending' &&
540- cn ( 'border-l-stone-300' , isDark ? 'bg-stone-800/20' : ' bg-stone-50 ')
505+ cn ( 'border-l-stone-300' , 'bg-stone-50 dark: bg-stone-800/20 ' )
541506 ) }
542507 >
543508 < div className = "flex-shrink-0" >
@@ -550,17 +515,12 @@ function ParallelBranchItem({ branch, isDark }: ParallelBranchItemProps) {
550515 < span
551516 className = { cn (
552517 'text-sm font-medium' ,
553- isDark ? 'text-stone-200' : ' text-stone-800 '
518+ 'text-stone-800 dark: text-stone-200 '
554519 ) }
555520 >
556521 { t ( 'branch.label' ) } { String . fromCharCode ( 65 + branch . index ) }
557522 </ span >
558- < span
559- className = { cn (
560- 'text-xs' ,
561- isDark ? 'text-stone-400' : 'text-stone-600'
562- ) }
563- >
523+ < span className = { cn ( 'text-xs' , 'text-stone-600 dark:text-stone-400' ) } >
564524 { branch . description || t ( 'status.executing_' ) }
565525 </ span >
566526 </ div >
@@ -573,7 +533,7 @@ function ParallelBranchItem({ branch, isDark }: ParallelBranchItemProps) {
573533 < span
574534 className = { cn (
575535 'font-serif text-xs' ,
576- isDark ? 'text-stone-400' : ' text-stone-500 '
536+ 'text-stone-500 dark: text-stone-400 '
577537 ) }
578538 >
579539 { formatTime ( elapsedTime ) }
@@ -589,10 +549,9 @@ interface ProgressBarProps {
589549 current : number ;
590550 total : number ;
591551 type : 'iteration' | 'branch' ;
592- isDark : boolean ;
593552}
594553
595- function ProgressBar ( { current, total, type, isDark } : ProgressBarProps ) {
554+ function ProgressBar ( { current, total, type } : ProgressBarProps ) {
596555 const t = useTranslations ( 'pages.chatflow.executionBar' ) ;
597556 const percentage = total > 0 ? ( current / total ) * 100 : 0 ;
598557
@@ -602,7 +561,7 @@ function ProgressBar({ current, total, type, isDark }: ProgressBarProps) {
602561 < span
603562 className = { cn (
604563 'font-serif text-xs font-medium' ,
605- isDark ? 'text-stone-300' : ' text-stone-700 '
564+ 'text-stone-700 dark: text-stone-300 '
606565 ) }
607566 >
608567 { type === 'iteration'
@@ -612,7 +571,7 @@ function ProgressBar({ current, total, type, isDark }: ProgressBarProps) {
612571 < span
613572 className = { cn (
614573 'font-serif text-xs' ,
615- isDark ? 'text-stone-400' : ' text-stone-500 '
574+ 'text-stone-500 dark: text-stone-400 '
616575 ) }
617576 >
618577 { current } /{ total }
@@ -622,7 +581,7 @@ function ProgressBar({ current, total, type, isDark }: ProgressBarProps) {
622581 < div
623582 className = { cn (
624583 'h-2 w-full overflow-hidden rounded-full' ,
625- isDark ? 'bg-stone-700' : ' bg-stone-200 '
584+ 'bg-stone-200 dark: bg-stone-700 '
626585 ) }
627586 >
628587 < div
0 commit comments