diff --git a/web/src/app/chat/folders/FolderDropdown.tsx b/web/src/app/chat/folders/FolderDropdown.tsx index 7d8131fb1ad..faa8f44368c 100644 --- a/web/src/app/chat/folders/FolderDropdown.tsx +++ b/web/src/app/chat/folders/FolderDropdown.tsx @@ -34,6 +34,7 @@ interface FolderDropdownProps { onDelete?: (folderId: number) => void; onDrop?: (folderId: number, chatSessionId: string) => void; children?: ReactNode; + index: number; } export const FolderDropdown = forwardRef( @@ -46,6 +47,7 @@ export const FolderDropdown = forwardRef( onEdit, onDrop, children, + index, }, ref ) => { @@ -160,110 +162,118 @@ export const FolderDropdown = forwardRef( onDrop={handleDrop} >
setIsHovered(true)} - onMouseLeave={() => setIsHovered(false)} + className="sticky top-0 bg-background-sidebar z-10" + style={{ zIndex: 1000 - index }} > - - {isHovered && !isEditing && folder.folder_id && ( - )} - {(isHovered || isDeletePopoverOpen) && - !isEditing && - folder.folder_id && ( - { - e.stopPropagation(); - handleDeleteClick(); + {isOpen ? ( + + ) : ( + + )} + {isEditing ? ( +
+ setNewFolderName(e.target.value)} + className="text-sm font-medium bg-transparent outline-none w-full pb-1 border-b border-[#6c6c6c] transition-colors duration-200" + onKeyDown={(e) => { + if (e.key === "Enter") { + handleEdit(); + } }} - className="px-1" - > - - - } - popover={ -
-

- Are you sure you want to delete this folder? -

-
- - + onClick={(e) => e.stopPropagation()} + /> +
+ ) : ( +
+ + {folder.folder_name} + +
+ )} + + {isHovered && !isEditing && folder.folder_id && ( + + )} + {(isHovered || isDeletePopoverOpen) && + !isEditing && + folder.folder_id && ( + { + e.stopPropagation(); + handleDeleteClick(); + }} + className="px-1" + > + + + } + popover={ +
+

+ Are you sure you want to delete this folder? +

+
+ + +
-
- } - requiresContentPadding - sideOffset={6} - /> + } + requiresContentPadding + sideOffset={6} + /> + )} + {isEditing && ( +
+ + +
)} - {isEditing && ( -
- - -
+
+ {isOpen && ( +
{children}
)}
- {isOpen && ( -
{children}
- )} ); } diff --git a/web/src/app/chat/input/ChatInputBar.tsx b/web/src/app/chat/input/ChatInputBar.tsx index 6f760962e0e..64009d70373 100644 --- a/web/src/app/chat/input/ChatInputBar.tsx +++ b/web/src/app/chat/input/ChatInputBar.tsx @@ -506,7 +506,10 @@ export function ChatInputBar({ style={{ scrollbarWidth: "thin" }} role="textarea" aria-multiline - placeholder={`Message ${selectedAssistant.name} assistant...`} + placeholder={`Message ${truncateString( + selectedAssistant.name, + 70 + )} assistant...`} value={message} onKeyDown={(event) => { if ( diff --git a/web/src/app/chat/sessionSidebar/ChatSessionDisplay.tsx b/web/src/app/chat/sessionSidebar/ChatSessionDisplay.tsx index 2715b38cae1..9df1733dce2 100644 --- a/web/src/app/chat/sessionSidebar/ChatSessionDisplay.tsx +++ b/web/src/app/chat/sessionSidebar/ChatSessionDisplay.tsx @@ -60,20 +60,10 @@ export function ChatSessionDisplay({ const [popoverOpen, setPopoverOpen] = useState(false); const inputRef = useRef(null); const renamingRef = useRef(null); - const [isMobile, setIsMobile] = useState(false); const { refreshChatSessions, refreshFolders } = useChatContext(); - useEffect(() => { - const mediaQuery = window.matchMedia("(max-width: 768px)"); - setIsMobile(mediaQuery.matches); - - const handleResize = (e: MediaQueryListEvent) => setIsMobile(e.matches); - mediaQuery.addListener(handleResize); - - return () => mediaQuery.removeListener(handleResize); - }, []); - + const isMobile = settings?.isMobile; const handlePopoverOpenChange = useCallback( (open: boolean) => { setPopoverOpen(open); diff --git a/web/src/app/chat/sessionSidebar/HistorySidebar.tsx b/web/src/app/chat/sessionSidebar/HistorySidebar.tsx index 04bdff11203..7018447ddc8 100644 --- a/web/src/app/chat/sessionSidebar/HistorySidebar.tsx +++ b/web/src/app/chat/sessionSidebar/HistorySidebar.tsx @@ -295,8 +295,8 @@ export const HistorySidebar = forwardRef( )} -
-
+
+
Assistants
void; onDelete: (folderId: number) => void; onDrop: (folderId: number, chatSessionId: string) => void; + index: number; } const SortableFolder: React.FC = (props) => { + const settings = useContext(SettingsContext); + const mobile = settings?.isMobile; const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: props.folder.folder_id?.toString() ?? "", @@ -57,6 +61,7 @@ const SortableFolder: React.FC = (props) => { distance: 8, }, }, + disabled: mobile, }); const ref = useRef(null); const style = { @@ -70,7 +75,12 @@ const SortableFolder: React.FC = (props) => { className="pr-3 ml-4 overflow-visible flex items-start" style={style} > - +
); }; @@ -299,7 +309,7 @@ export function PagesTab({ return (
{popup} -
+

Chats