addingg toggle to split or hide chat

This commit is contained in:
marlon-erler
2024-07-13 15:10:54 +02:00
parent eff75660b5
commit 6516c7ab71
7 changed files with 162 additions and 109 deletions
+19 -1
View File
@@ -209,7 +209,21 @@ export const chats = new React.ListState<Chat>();
export const chatIds = React.restoreListState<string>("chat-ids");
export const selectedChat = new React.State<Chat | undefined>(undefined);
export const isShowingObjects = React.restoreState("showing-objects", false);
export const isShowingChatInSplit = React.restoreState(
"showing-chat-split",
false
);
export const isChatOpen = React.createProxyState(
[selectedChat],
() => selectedChat.value != undefined
);
export const isChatVisible = React.createProxyState(
[isShowingObjects, isShowingChatInSplit],
() => isShowingObjects.value == false || isShowingChatInSplit.value == true
);
export const newChatName = new React.State("");
export const cannotCreateChat = React.createProxyState(
@@ -235,10 +249,14 @@ export function selectChat(chat: Chat) {
document.getElementById("message-tab")?.scrollIntoView();
}
export function toggleChatTools() {
export function toggleObjects() {
isShowingObjects.value = !isShowingObjects.value;
}
export function toggleChat() {
isShowingChatInSplit.value = !isShowingChatInSplit.value;
}
chatIds.value.forEach((id) => chats.add(new Chat(id)));
// INIT