diff --git a/components/ClearDataConfirmModal.tsx b/components/ClearDataConfirmModal.tsx index 3396aed..37bb328 100644 --- a/components/ClearDataConfirmModal.tsx +++ b/components/ClearDataConfirmModal.tsx @@ -13,7 +13,7 @@ const ClearDataConfirmModal = (props: Props) => { toast.success("Message cleared. The page will be reloaded."); setTimeout(() => { window.location.reload(); - }, 1500); + }, 300); }; return ( diff --git a/components/ConnectionSidebar.tsx b/components/ConnectionSidebar.tsx index b2588f6..e81956d 100644 --- a/components/ConnectionSidebar.tsx +++ b/components/ConnectionSidebar.tsx @@ -50,10 +50,21 @@ const ConnectionSidebar = () => { }); }; + const handleDeleteConnection = (connection: Connection) => { + connectionStore.clearConnection((item) => item.id !== connection.id); + if (currentConnectionCtx?.connection.id === connection.id) { + connectionStore.setCurrentConnectionCtx(undefined); + } + }; + const handleDatabaseNameSelect = async (databaseName: string) => { + if (!currentConnectionCtx?.connection) { + return; + } + const database = databaseList.find((database) => database.name === databaseName); connectionStore.setCurrentConnectionCtx({ - connection: currentConnectionCtx!.connection, + connection: currentConnectionCtx.connection, database: database, }); }; @@ -71,6 +82,13 @@ const ConnectionSidebar = () => { layoutStore.toggleSidebar(false); }; + const handleDeleteChat = (chat: Chat) => { + chatStore.clearChat((item) => item.id !== chat.id); + if (chatStore.currentChat?.id === chat.id) { + chatStore.setCurrentChat(undefined); + } + }; + return ( <>