1- import { Button } from "@/components/ui/button" ;
2- import { PlayCircle } from "lucide-react" ;
3- import { useTranslation } from "react-i18next" ;
1+ // ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. =========
2+ // Licensed under the Apache License, Version 2.0 (the "License");
3+ // you may not use this file except in compliance with the License.
4+ // You may obtain a copy of the License at
5+ //
6+ // http://www.apache.org/licenses/LICENSE-2.0
7+ //
8+ // Unless required by applicable law or agreed to in writing, software
9+ // distributed under the License is distributed on an "AS IS" BASIS,
10+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+ // See the License for the specific language governing permissions and
12+ // limitations under the License.
13+ // ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. =========
14+
15+ import { Button } from '@/components/ui/button' ;
16+ import { PlayCircle } from 'lucide-react' ;
17+ import { useTranslation } from 'react-i18next' ;
418
519interface HeaderBoxProps {
6- /** Token count to display */
7- tokens : number ;
8- /** Task status for determining what button to show */
9- status ?: 'running' | 'finished' | 'pending' | 'pause' ;
10- /** Whether replay is loading */
11- replayLoading ?: boolean ;
12- /** Callback when replay button is clicked */
13- onReplay ?: ( ) => void ;
14- /** Optional class name */
15- className ?: string ;
20+ /** Token count to display */
21+ tokens : number ;
22+ /** Task status for determining what button to show */
23+ status ?: 'running' | 'finished' | 'pending' | 'pause' ;
24+ /** Whether replay is loading */
25+ replayLoading ?: boolean ;
26+ /** Callback when replay button is clicked */
27+ onReplay ?: ( ) => void ;
28+ /** Optional class name */
29+ className ?: string ;
1630}
1731
1832export function HeaderBox ( {
19- tokens,
20- status,
21- replayLoading = false ,
22- onReplay,
23- className,
33+ tokens,
34+ status,
35+ replayLoading = false ,
36+ onReplay,
37+ className,
2438} : HeaderBoxProps ) {
25- const { t } = useTranslation ( ) ;
26-
27- // Replay button only appears when task is finished
28- const showReplayButton = status === 'finished' ;
29- // Replay button is disabled when task is running or pending
30- const isReplayDisabled = status === 'running' || status === 'pending' || status === 'pause' ;
39+ const { t } = useTranslation ( ) ;
3140
32- return (
33- < div className = { `w-full h-[44px] flex flex-row items-center justify-between px-3 ${ className || "" } ` } >
34- < div className = "flex items-center gap-md" >
35- < div className = "text-text-body font-bold text-body-base leading-relaxed" >
36- Chat
37- </ div >
38- < div className = "text-text-information text-xs font-semibold leading-17" >
39- # { tokens || 0 }
40- </ div >
41- </ div >
41+ // Replay button only appears when task is finished
42+ const showReplayButton = status === 'finished' ;
43+ // Replay button is disabled when task is running or pending
44+ const isReplayDisabled =
45+ status === 'running' || status === 'pending' || status === 'pause' ;
4246
43- { showReplayButton && (
44- < Button
45- onClick = { onReplay }
46- disabled = { isReplayDisabled || replayLoading }
47- variant = "ghost"
48- size = "sm"
49- className = "no-drag !text-text-information bg-surface-information font-semibold rounded-full"
50- >
51- < PlayCircle />
52- { replayLoading ? t ( "common.loading" ) : t ( "chat.replay" ) }
53- </ Button >
54- ) }
47+ return (
48+ < div
49+ className = { `flex h-[44px] w-full flex-row items-center justify-between px-3 ${ className || '' } ` }
50+ >
51+ < div className = "flex items-center gap-md" >
52+ < div className = "text-body-base font-bold leading-relaxed text-text-body" >
53+ Chat
54+ </ div >
55+ < div className = "text-xs font-semibold leading-17 text-text-information" >
56+ # { ( tokens || 0 ) . toLocaleString ( ) }
5557 </ div >
56- ) ;
57- }
58+ </ div >
59+
60+ { showReplayButton && (
61+ < Button
62+ onClick = { onReplay }
63+ disabled = { isReplayDisabled || replayLoading }
64+ variant = "ghost"
65+ size = "sm"
66+ className = "no-drag rounded-full bg-surface-information font-semibold !text-text-information"
67+ >
68+ < PlayCircle />
69+ { replayLoading ? t ( 'common.loading' ) : t ( 'chat.replay' ) }
70+ </ Button >
71+ ) }
72+ </ div >
73+ ) ;
74+ }
0 commit comments