1
1
import React , { useState , useRef , useEffect } from 'react' ;
2
2
import { Conversation , ConversationFolder } from '../../types/chat' ;
3
- import { MessageSquare , MoreVertical , Edit , Trash2 , ChevronLeft , ChevronRight , AlertTriangle , MessageSquarePlus , FolderPlus , Folder , ChevronDown } from 'lucide-react' ;
3
+ import { MessageSquare , MoreVertical , Edit , Trash2 , ChevronLeft , ChevronRight , AlertTriangle , FolderPlus , Folder , ChevronDown , PlusCircle } from 'lucide-react' ;
4
4
import ContextMenu , { ContextMenuItem } from '../ui/ContextMenu' ;
5
5
import ConfirmDialog from '../ui/ConfirmDialog' ;
6
6
@@ -255,7 +255,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
255
255
// Add some ghost image effect
256
256
if ( e . dataTransfer . setDragImage ) {
257
257
const elem = document . createElement ( 'div' ) ;
258
- elem . classList . add ( 'bg-blue-100 ' , 'p-2' , 'rounded' , 'shadow' , 'text-sm' , 'w-fit' ) ;
258
+ elem . classList . add ( 'conversation-selected-item-bg-color ' , 'p-2' , 'rounded' , 'shadow' , 'text-sm' , 'w-fit' ) ;
259
259
elem . innerText = conversations . find ( c => c . conversationId === item . id ) ?. title || 'Moving...' ;
260
260
document . body . appendChild ( elem ) ;
261
261
e . dataTransfer . setDragImage ( elem , 10 , 10 ) ;
@@ -389,7 +389,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
389
389
ref = { sidebarRef }
390
390
onMouseEnter = { handleSidebarMouseEnter }
391
391
onMouseLeave = { handleSidebarMouseLeave }
392
- className = { `flex flex-col h-full border-r border-gray-200 bg-gray-50 transition-all duration-300 ease-in-out ${ isCollapsed ? 'w-0' : 'w-64' } relative` }
392
+ className = { `flex flex-col h-full border-r border-gray-200 major-area-bg-color transition-all duration-300 ease-in-out ${ isCollapsed ? 'w-0' : 'w-64' } relative` }
393
393
onDragOver = { ( e ) => handleDragOver ( e , 'root' , 'root' ) }
394
394
onDrop = { ( e ) => handleDrop ( e , 'root' , 'root' ) }
395
395
>
@@ -413,26 +413,26 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
413
413
onMouseLeave = { handleButtonMouseLeave }
414
414
onFocus = { ( ) => setIsButtonVisible ( true ) }
415
415
onBlur = { ( ) => ! isSidebarHovered && setIsButtonVisible ( false ) }
416
- className = { `absolute z-10 flex items-center justify-center w-6 h-20 transform -translate-y-1/2 bg-gray-200 -right-6 top-1/2 hover:bg-gray-300 rounded-r-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50 transition-opacity duration-300 ${ isButtonVisible || isButtonHovered ? 'opacity-100' : 'opacity-0' } ` }
416
+ className = { `absolute z-10 flex items-center justify-center w-6 h-20 transform -translate-y-1/2 bg-gray-200 -right-6 top-1/2 hover:bg-gray-300 rounded-r-md transition-opacity duration-300 ${ isButtonVisible || isButtonHovered ? 'opacity-100' : 'opacity-0' } ` }
417
417
aria-label = { isCollapsed ? 'Expand sidebar' : 'Collapse sidebar' }
418
418
title = { isCollapsed ? 'Expand sidebar' : 'Collapse sidebar' }
419
419
>
420
420
{ isCollapsed ? < ChevronRight size = { 16 } /> : < ChevronLeft size = { 16 } /> }
421
421
</ button >
422
422
423
- < div className = { `p-2 border-b border-gray-200 ${ isCollapsed ? 'opacity-0 pointer-events-none' : 'flex justify-between items-center' } ` } >
423
+ < div className = { `p-2 h-12 major-area-bg-color transition-all duration-100 ease-in-out ${ isCollapsed ? 'opacity-0 pointer-events-none' : 'flex justify-between items-center gap-2 ' } ` } >
424
424
< button
425
425
onClick = { onCreateNewFolder }
426
- className = "flex items-center justify-center p-2 text-sm font-medium text-gray-700 transition-colors bg-white border border-gray-300 rounded-md aspect-square hover: bg-gray-50 checked:outline-none checked:ring-2 checked:ring-blue-500 "
426
+ className = "flex items-center justify-center h-full text-sm font-medium transition-colors aspect-square primary-btn-border primary-btn- bg-color primary-btn-text-color "
427
427
>
428
428
< FolderPlus size = { 16 } />
429
429
</ button >
430
430
431
431
< button
432
432
onClick = { onCreateNewChat }
433
- className = "flex items-center justify-center gap -1 p-2 text-sm font-medium text-gray-700 transition-colors bg-white border border-gray-300 rounded-md hover: bg-gray-50 checked:outline-none checked:ring-2 checked:ring-blue-500 "
433
+ className = "flex items-center justify-center flex -1 h-full gap-2 pr-2 text-sm font-medium transition-all duration-100 primary-btn-border primary-btn- bg-color primary-btn-text-color "
434
434
>
435
- < MessageSquarePlus size = { 16 } />
435
+ < PlusCircle size = { 16 } />
436
436
< span className = "text-sm" > New Chat</ span >
437
437
</ button >
438
438
@@ -447,7 +447,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
447
447
{ ! isCollapsed && < p className = "text-sm" > No conversations yet</ p > }
448
448
</ div >
449
449
) : (
450
- < ul className = "py-2" >
450
+ < ul className = "flex flex-col gap-0.5 py-2" >
451
451
{ rootItems . map ( ( { type, item } ) => (
452
452
< li
453
453
key = { type === 'folder' ? `folder-${ item . folderId } ` : `conv-${ ( item as Conversation ) . conversationId } ` }
@@ -479,7 +479,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
479
479
onDrop = { ( e ) => handleDrop ( e , ( item as ConversationFolder ) . folderId , 'folder' ) }
480
480
>
481
481
{ isCollapsed ? (
482
- < Folder size = { 16 } className = "mx-auto text-gray-600" />
482
+ < Folder fill = { ( item as ConversationFolder ) . colorFlag } size = { 16 } className = "mx-auto text-gray-600" />
483
483
) : (
484
484
< >
485
485
< div
@@ -492,7 +492,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
492
492
< ChevronRight size = { 16 } className = "text-gray-500" />
493
493
}
494
494
</ button >
495
- < Folder size = { 16 } className = "flex-shrink-0 mr-1 text-gray-600" />
495
+ < Folder fill = { ( item as ConversationFolder ) . colorFlag } size = { 16 } className = "flex-shrink-0 mr-1 text-gray-600" />
496
496
< span className = "font-medium truncate select-none" > { ( item as ConversationFolder ) . folderName } </ span >
497
497
</ div >
498
498
< div onClick = { ( e ) => handleMenuClick ( e , ( item as ConversationFolder ) . folderId , 'folder' ) } >
@@ -508,14 +508,14 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
508
508
items = { getFolderContextMenuItems ( item as ConversationFolder ) }
509
509
isOpen = { openMenuId === ( item as ConversationFolder ) . folderId }
510
510
onClose = { ( ) => setOpenMenuId ( null ) }
511
- position = { { top : '100% ' , right : '12px' } }
511
+ position = { { top : '2.5rem ' , right : '12px' } }
512
512
width = "10rem"
513
513
/>
514
514
) }
515
515
516
516
{ /* Folder contents */ }
517
517
{ ! isCollapsed && expandedFolders [ ( item as ConversationFolder ) . folderId ] && (
518
- < ul className = "pl-6 mt-1" >
518
+ < ul className = "pl-6 mt-1 mr-2 " >
519
519
{ conversationsByFolder [ ( item as ConversationFolder ) . folderId ] ?. map ( ( conversation ) => (
520
520
< li key = { conversation . conversationId } className = "relative" >
521
521
{ editingId === conversation . conversationId ? (
@@ -538,10 +538,10 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
538
538
onDragOver = { ( e ) => handleDragOver ( e , ( item as ConversationFolder ) . folderId , 'folder' ) }
539
539
onDrop = { ( e ) => handleDrop ( e , ( item as ConversationFolder ) . folderId , 'folder' ) }
540
540
onClick = { ( ) => onSelectConversation ( conversation . conversationId ) }
541
- className = { `flex items-center justify-between w-full px-2 py-1 text-left rounded-sm ${
541
+ className = { `flex items-center justify-between w-full px-3 py-2 text-left conversation-item-border ${
542
542
activeConversationId === conversation . conversationId
543
- ? 'bg-blue-50 text-blue-600 '
544
- : 'text-gray-700 hover: bg-gray-100 '
543
+ ? 'conversation-selected-item-bg-color conversation-selected-item-text-color '
544
+ : 'conversation-item- bg-color conversation-item-text-color '
545
545
}
546
546
${ draggingItem ?. id === conversation . conversationId ? 'opacity-50' : '' }
547
547
${
@@ -550,11 +550,11 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
550
550
} `}
551
551
>
552
552
< div className = "flex items-center truncate" >
553
- < MessageSquare size = { 14 } className = "flex-shrink-0 mr-1" />
554
- < span className = "text-sm truncate" > { conversation . title } </ span >
553
+ < MessageSquare size = { 16 } className = "flex-shrink-0 mr-1" />
554
+ < span className = "truncate" > { conversation . title } </ span >
555
555
</ div >
556
556
< div onClick = { ( e ) => handleMenuClick ( e , conversation . conversationId , 'conversation' ) } >
557
- < MoreVertical size = { 14 } className = "flex-shrink-0 text-gray-400 hover:text-gray-600 " />
557
+ < MoreVertical size = { 16 } className = "flex-shrink-0" />
558
558
</ div >
559
559
</ div >
560
560
) }
@@ -594,10 +594,10 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
594
594
onDragStart = { ( e ) => handleDragStart ( e , { id : ( item as Conversation ) . conversationId , type : 'conversation' } ) }
595
595
onDragEnd = { handleDragEnd }
596
596
onClick = { ( ) => onSelectConversation ( ( item as Conversation ) . conversationId ) }
597
- className = { `flex items-center justify-between w-full ${ isCollapsed ? 'px-0 py-3 flex-col' : ' px-4 py-2' } text-left ${
597
+ className = { `flex flex-1 items-center justify-between mx-2 conversation-item-border px-3 py-2 text-left transition-all duration-100 ${
598
598
activeConversationId === ( item as Conversation ) . conversationId
599
- ? 'bg-blue-50 text-blue-600 '
600
- : 'text-gray-700 hover: bg-gray-100 '
599
+ ? 'conversation-selected-item-bg-color conversation-selected-item-text-color '
600
+ : 'conversation-item- bg-color conversation-item-text-color '
601
601
} ${ draggingItem ?. id === ( item as Conversation ) . conversationId ? 'opacity-50' : '' } `}
602
602
title = { isCollapsed ? ( item as Conversation ) . title : undefined }
603
603
>
@@ -610,7 +610,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
610
610
< span className = "truncate" > { ( item as Conversation ) . title } </ span >
611
611
</ div >
612
612
< div onClick = { ( e ) => handleMenuClick ( e , ( item as Conversation ) . conversationId , 'conversation' ) } >
613
- < MoreVertical size = { 16 } className = "flex-shrink-0 text-gray-400 hover:text-gray-600 " />
613
+ < MoreVertical size = { 16 } className = "flex-shrink-0" />
614
614
</ div >
615
615
</ >
616
616
) }
0 commit comments