remember whether object view was open
This commit is contained in:
+2
-3
@@ -162,7 +162,7 @@ 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 isShowingChatTools = new React.State(false);
|
||||
export const isShowingObjects = React.restoreState("showing-objects", false);
|
||||
export const newChatName = new React.State("");
|
||||
|
||||
export const cannotCreateChat = React.createProxyState(
|
||||
@@ -178,7 +178,6 @@ export function createChat() {
|
||||
}
|
||||
|
||||
export function closeChatView() {
|
||||
isShowingChatTools.value = false;
|
||||
selectedChat.value = undefined;
|
||||
document.getElementById("settings-tab")?.scrollIntoView();
|
||||
}
|
||||
@@ -190,7 +189,7 @@ export function selectChat(chat: Chat) {
|
||||
}
|
||||
|
||||
export function toggleChatTools() {
|
||||
isShowingChatTools.value = !isShowingChatTools.value;
|
||||
isShowingObjects.value = !isShowingObjects.value;
|
||||
}
|
||||
|
||||
chatIds.value.forEach((id) => chats.add(new Chat(id)));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import { closeChatView, isShowingChatTools, selectedChat, toggleChatTools } from "../Model/model";
|
||||
import { closeChatView, isShowingObjects, selectedChat, toggleChatTools } from "../Model/model";
|
||||
|
||||
import { ChatObjectView } from "../Views/Objects/chatObjectView";
|
||||
import { ChatOptionModal } from "../Views/Chat/chatOptionModal";
|
||||
@@ -37,7 +37,7 @@ export function MessageTab() {
|
||||
<button
|
||||
aria-label={translation.showObjects}
|
||||
on:click={toggleChatTools}
|
||||
toggle:selected={isShowingChatTools}
|
||||
toggle:selected={isShowingObjects}
|
||||
>
|
||||
<span class="icon">deployed_code</span>
|
||||
</button>
|
||||
@@ -61,7 +61,7 @@ export function MessageTab() {
|
||||
|
||||
return (
|
||||
<article
|
||||
toggle:showingchattools={isShowingChatTools}
|
||||
toggle:showingchattools={isShowingObjects}
|
||||
id="message-tab"
|
||||
children:set={messageTabContent}
|
||||
></article>
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from "bloatless-react";
|
||||
|
||||
import { Chat, ChatMessage } from "../../Model/chatModel";
|
||||
|
||||
import { isShowingChatTools } from "../../Model/model";
|
||||
import { isShowingObjects } from "../../Model/model";
|
||||
import { translation } from "../../translations";
|
||||
|
||||
export function ThreadView(chat: Chat) {
|
||||
@@ -138,7 +138,7 @@ export function ThreadView(chat: Chat) {
|
||||
|
||||
chat.messages.handleAddition(scrollToBottomIfAppropriate);
|
||||
chat.outbox.handleAddition(scrollToBottomIfAppropriate);
|
||||
isShowingChatTools.subscribe(() => scrollToBottom());
|
||||
isShowingObjects.subscribe(() => scrollToBottom());
|
||||
setTimeout(() => scrollToBottom(), 50);
|
||||
|
||||
return listWrapper;
|
||||
|
||||
Reference in New Issue
Block a user