@@ -2,10 +2,11 @@ import cls from 'classnames';
22import React , { FC , memo , useCallback , useEffect , useRef , useState } from 'react' ;
33
44import { Icon , Input , Loading , Popover , PopoverPosition , PopoverTriggerType , getIcon } from '@opensumi/ide-components' ;
5- import './chat-history.css' ;
65import { localize } from '@opensumi/ide-core-browser' ;
76import { EnhanceIcon } from '@opensumi/ide-core-browser/lib/components/ai-native' ;
87
8+ import styles from './chat-history.module.less' ;
9+
910export interface IChatHistoryItem {
1011 id : string ;
1112 title : string ;
@@ -162,22 +163,25 @@ const ChatHistory: FC<IChatHistoryProps> = memo(
162163 ( item : IChatHistoryItem ) => (
163164 < div
164165 key = { item . id }
165- className = { cls ( 'dm-chat-history-item' , item . id === currentId ? 'dm-chat-history-item-selected' : '' ) }
166+ className = { cls (
167+ styles [ 'dm-chat-history-item' ] ,
168+ item . id === currentId ? styles [ 'dm-chat-history-item-selected' ] : '' ,
169+ ) }
166170 onClick = { ( ) => handleHistoryItemSelect ( item ) }
167171 >
168- < div className = 'dm-chat-history-item-content' >
172+ < div className = { styles [ 'dm-chat-history-item-content' ] } >
169173 { item . loading ? (
170174 < Loading />
171175 ) : (
172176 < Icon icon = 'message' style = { { width : '16px' , height : '16px' , marginRight : 4 } } />
173177 ) }
174178 { ! historyTitleEditable ?. [ item . id ] ? (
175- < span id = { `dm-chat-history-item-title-${ item . id } ` } className = 'dm-chat-history-item-title' >
179+ < span id = { `dm-chat-history-item-title-${ item . id } ` } className = { styles [ 'dm-chat-history-item-title' ] } >
176180 { item . title }
177181 </ span >
178182 ) : (
179183 < Input
180- className = 'dm-chat-history-item-title'
184+ className = { styles [ 'dm-chat-history-item-title' ] }
181185 defaultValue = { item . title }
182186 ref = { inputRef }
183187 onPressEnter = { ( e : any ) => {
@@ -187,7 +191,7 @@ const ChatHistory: FC<IChatHistoryProps> = memo(
187191 />
188192 ) }
189193 </ div >
190- < div className = 'dm-chat-history-item-actions' >
194+ < div className = { styles [ 'dm-chat-history-item-actions' ] } >
191195 { /* <EditOutlined
192196 title={localize('aiNative.operate.chatHistory.edit')}
193197 style={{ marginRight: 8 }}
@@ -198,7 +202,7 @@ const ChatHistory: FC<IChatHistoryProps> = memo(
198202 }}
199203 /> */ }
200204 < EnhanceIcon
201- className = { cls ( 'dm-chat-history-item-actions-delete' , getIcon ( 'delete' ) ) }
205+ className = { cls ( styles [ 'dm-chat-history-item-actions-delete' ] , getIcon ( 'delete' ) ) }
202206 onClick = { ( e ) => {
203207 e . preventDefault ( ) ;
204208 e . stopPropagation ( ) ;
@@ -237,10 +241,10 @@ const ChatHistory: FC<IChatHistoryProps> = memo(
237241 value = { searchValue }
238242 onChange = { handleSearchChange }
239243 />
240- < div className = 'dm-chat-history-list' >
244+ < div className = { styles [ 'dm-chat-history-list' ] } >
241245 { groupedHistoryList . map ( ( group ) => (
242246 < div key = { group . key } style = { { padding : '4px' } } >
243- < div className = 'dm-chat-history-time' > { group . key } </ div >
247+ < div className = { styles [ 'dm-chat-history-time' ] } > { group . key } </ div >
244248 { group . items . map ( renderHistoryItem ) }
245249 </ div >
246250 ) ) }
@@ -253,11 +257,11 @@ const ChatHistory: FC<IChatHistoryProps> = memo(
253257 const getPopupContainer = useCallback ( ( triggerNode : HTMLElement ) => triggerNode . parentElement ! , [ ] ) ;
254258
255259 return (
256- < div className = { cls ( 'dm-chat-history-header' , className ) } >
257- < div className = 'dm-chat-history-header-title' >
260+ < div className = { cls ( styles [ 'dm-chat-history-header' ] , className ) } >
261+ < div className = { styles [ 'dm-chat-history-header-title' ] } >
258262 < span > { title } </ span >
259263 </ div >
260- < div className = 'dm-chat-history-header-actions' >
264+ < div className = { styles [ 'dm-chat-history-header-actions' ] } >
261265 < Popover
262266 id = 'dm-chat-history-header-actions-history'
263267 content = { renderHistory ( ) }
@@ -267,10 +271,12 @@ const ChatHistory: FC<IChatHistoryProps> = memo(
267271 getPopupContainer = { getPopupContainer }
268272 >
269273 < div
270- className = 'dm-chat-history-header-actions-history'
274+ className = { styles [ 'dm-chat-history-header-actions-history' ] }
271275 title = { localize ( 'aiNative.operate.chatHistory.title' ) }
272276 >
273- < EnhanceIcon className = { cls ( 'dm-chat-history-header-actions-history' , 'codicon codicon-history' ) } />
277+ < EnhanceIcon
278+ className = { cls ( styles [ 'dm-chat-history-header-actions-history' ] , 'codicon codicon-history' ) }
279+ />
274280 </ div >
275281 </ Popover >
276282 < Popover
@@ -279,7 +285,7 @@ const ChatHistory: FC<IChatHistoryProps> = memo(
279285 title = { localize ( 'aiNative.operate.newChat.title' ) }
280286 >
281287 < EnhanceIcon
282- className = { cls ( 'dm-chat-history-header-actions-new' , getIcon ( 'plus' ) ) }
288+ className = { cls ( styles [ 'dm-chat-history-header-actions-new' ] , getIcon ( 'plus' ) ) }
283289 onClick = { handleNewChat }
284290 />
285291 </ Popover >
0 commit comments