mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-07-28 17:53:21 +08:00
chore: add default channel
This commit is contained in:
@ -59,12 +59,18 @@ const ChatView = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (!connectionStore.currentConnectionCtx) {
|
||||
chatStore.setCurrentChat(undefined);
|
||||
return;
|
||||
}
|
||||
if (currentChat?.connectionId === connectionStore.currentConnectionCtx.connection.id) {
|
||||
chatStore.setCurrentChat(undefined);
|
||||
return;
|
||||
}
|
||||
const chatList = chatStore.chatList.filter((chat) => chat.connectionId === connectionStore.currentConnectionCtx?.connection.id);
|
||||
const chatList = chatStore.chatList.filter(
|
||||
(chat) =>
|
||||
chat.connectionId === connectionStore.currentConnectionCtx?.connection.id &&
|
||||
chat.databaseName === connectionStore.currentConnectionCtx?.database?.name
|
||||
);
|
||||
chatStore.setCurrentChat(head(chatList));
|
||||
}, [connectionStore.currentConnectionCtx]);
|
||||
|
||||
|
@ -117,6 +117,12 @@ const ConnectionSidebar = () => {
|
||||
<div className="w-80 h-full border-r flex flex-row justify-start items-start">
|
||||
<div className="w-16 h-full bg-gray-200 pl-2 py-4 pt-6 flex flex-col justify-between items-center">
|
||||
<div className="w-full flex flex-col justify-start items-start">
|
||||
<button
|
||||
className={`w-full h-14 rounded-l-lg p-2 mt-2 group ${currentConnectionCtx === undefined && "bg-gray-100 shadow"}`}
|
||||
onClick={() => connectionStore.setCurrentConnectionCtx(undefined)}
|
||||
>
|
||||
<Icon.AiOutlineRobot className="w-7 h-auto mx-auto" />
|
||||
</button>
|
||||
{connectionList.map((connection) => (
|
||||
<button
|
||||
key={connection.id}
|
||||
|
Reference in New Issue
Block a user