1- ' use client'
1+ " use client" ;
22
3- import { useState , useRef , useEffect } from "react"
4- import { Button } from "@/components/ui/button"
5- import { Input } from "@/components/ui/input"
6- import {
7- Share ,
8- Bookmark ,
9- MoreHorizontal ,
10- BrainCircuit ,
11- Globe
12- } from "lucide-react"
13- import { DownOutlined } from '@ant-design/icons'
3+ import { useState , useRef , useEffect } from "react" ;
4+ import { Button } from "@/components/ui/button" ;
5+ import { Input } from "@/components/ui/input" ;
6+ import { BrainCircuit , Globe } from "lucide-react" ;
7+ import { DownOutlined } from "@ant-design/icons" ;
148
159// Gradient definition for BrainCircuit icon
1610const GradientDefs = ( ) => (
@@ -22,31 +16,25 @@ const GradientDefs = () => (
2216 </ linearGradient >
2317 </ defs >
2418 </ svg >
25- )
19+ ) ;
2620
27- import { DropdownMenu , DropdownMenuContent , DropdownMenuItem , DropdownMenuTrigger } from "@/components/ui/dropdownMenu"
28- import { useTranslation } from "react-i18next"
29- import { Dropdown } from "antd"
30- import { languageOptions } from '@/lib/constants'
31- import { useLanguageSwitch } from '@/lib/languageUtils'
32- import MemoryManageModal from "../internal/memory/memoryManageModal"
21+ import { useTranslation } from "react-i18next" ;
22+ import { Dropdown } from "antd" ;
23+ import { languageOptions } from "@/lib/constants" ;
24+ import { useLanguageSwitch } from "@/lib/language" ;
25+ import MemoryManageModal from "../internal/memory/memoryManageModal" ;
3326
3427interface ChatHeaderProps {
35- title : string
36- onShare ?: ( ) => void
37- onRename ?: ( newTitle : string ) => void
28+ title : string ;
29+ onRename ?: ( newTitle : string ) => void ;
3830}
3931
40- export function ChatHeader ( {
41- title,
42- onShare,
43- onRename
44- } : ChatHeaderProps ) {
32+ export function ChatHeader ( { title, onRename } : ChatHeaderProps ) {
4533 const [ isEditing , setIsEditing ] = useState ( false ) ;
4634 const [ editTitle , setEditTitle ] = useState ( title ) ;
4735 const [ memoryModalVisible , setMemoryModalVisible ] = useState ( false ) ;
4836 const inputRef = useRef < HTMLInputElement > ( null ) ;
49- const { t } = useTranslation ( ' common' ) ;
37+ const { t } = useTranslation ( " common" ) ;
5038 const { currentLanguage, handleLanguageChange } = useLanguageSwitch ( ) ;
5139
5240 // Update editTitle when the title attribute changes
@@ -87,8 +75,6 @@ export function ChatHeader({
8775 }
8876 } ;
8977
90-
91-
9278 return (
9379 < >
9480 < GradientDefs />
@@ -127,27 +113,39 @@ export function ChatHeader({
127113 { /* Language Switch */ }
128114 < Dropdown
129115 menu = { {
130- items : languageOptions . map ( opt => ( { key : opt . value , label : opt . label } ) ) ,
116+ items : languageOptions . map ( ( opt ) => ( {
117+ key : opt . value ,
118+ label : opt . label ,
119+ } ) ) ,
131120 onClick : ( { key } ) => handleLanguageChange ( key as string ) ,
132121 } }
133122 >
134- < a
135- className = "ant-dropdown-link text-sm font-medium text-slate-600 hover:text-slate-900 dark:text-slate-300 dark:hover:text-white transition-colors flex items-center gap-2 cursor-pointer w-[100px] border-0 shadow-none bg-transparent text-left"
136- >
123+ < a className = "ant-dropdown-link text-sm font-medium text-slate-600 hover:text-slate-900 dark:text-slate-300 dark:hover:text-white transition-colors flex items-center gap-2 cursor-pointer w-[100px] border-0 shadow-none bg-transparent text-left" >
137124 < Globe className = "h-4 w-4" />
138- { languageOptions . find ( o => o . value === currentLanguage ) ?. label || currentLanguage }
125+ { languageOptions . find ( ( o ) => o . value === currentLanguage )
126+ ?. label || currentLanguage }
139127 < DownOutlined className = "text-[10px]" />
140128 </ a >
141129 </ Dropdown >
142130 { /* Memory Setting */ }
143- < Button variant = "ghost" className = "h-8 w-12 rounded-full" onClick = { ( ) => setMemoryModalVisible ( true ) } >
144- < BrainCircuit className = "size-5" stroke = "url(#brainCogGradient)" />
131+ < Button
132+ variant = "ghost"
133+ className = "h-8 w-12 rounded-full"
134+ onClick = { ( ) => setMemoryModalVisible ( true ) }
135+ >
136+ < BrainCircuit
137+ className = "size-5"
138+ stroke = "url(#brainCogGradient)"
139+ />
145140 </ Button >
146141 </ div >
147142 </ div >
148143 </ div >
149144 </ header >
150- < MemoryManageModal visible = { memoryModalVisible } onClose = { ( ) => setMemoryModalVisible ( false ) } />
145+ < MemoryManageModal
146+ visible = { memoryModalVisible }
147+ onClose = { ( ) => setMemoryModalVisible ( false ) }
148+ />
151149 </ >
152- )
153- }
150+ ) ;
151+ }
0 commit comments