remember whether object view was open
This commit is contained in:
Vendored
+5
-6
@@ -1204,7 +1204,7 @@
|
||||
var chats = new ListState();
|
||||
var chatIds = restoreListState("chat-ids");
|
||||
var selectedChat = new State(void 0);
|
||||
var isShowingChatTools = new State(false);
|
||||
var isShowingObjects = restoreState("showing-objects", false);
|
||||
var newChatName = new State("");
|
||||
var cannotCreateChat = createProxyState(
|
||||
[newChatName],
|
||||
@@ -1216,7 +1216,6 @@
|
||||
newChatName.value = "";
|
||||
}
|
||||
function closeChatView() {
|
||||
isShowingChatTools.value = false;
|
||||
selectedChat.value = void 0;
|
||||
document.getElementById("settings-tab")?.scrollIntoView();
|
||||
}
|
||||
@@ -1226,7 +1225,7 @@
|
||||
document.getElementById("message-tab")?.scrollIntoView();
|
||||
}
|
||||
function toggleChatTools() {
|
||||
isShowingChatTools.value = !isShowingChatTools.value;
|
||||
isShowingObjects.value = !isShowingObjects.value;
|
||||
}
|
||||
chatIds.value.forEach((id) => chats.add(new Chat(id)));
|
||||
if (serverAddressInput.value != "" && didRequestConnection.value == true) {
|
||||
@@ -1660,7 +1659,7 @@
|
||||
}
|
||||
chat.messages.handleAddition(scrollToBottomIfAppropriate);
|
||||
chat.outbox.handleAddition(scrollToBottomIfAppropriate);
|
||||
isShowingChatTools.subscribe(() => scrollToBottom());
|
||||
isShowingObjects.subscribe(() => scrollToBottom());
|
||||
setTimeout(() => scrollToBottom(), 50);
|
||||
return listWrapper;
|
||||
}
|
||||
@@ -1681,7 +1680,7 @@
|
||||
{
|
||||
"aria-label": translation.showObjects,
|
||||
"on:click": toggleChatTools,
|
||||
"toggle:selected": isShowingChatTools
|
||||
"toggle:selected": isShowingObjects
|
||||
},
|
||||
/* @__PURE__ */ createElement("span", { class: "icon" }, "deployed_code")
|
||||
), /* @__PURE__ */ createElement(
|
||||
@@ -1701,7 +1700,7 @@
|
||||
return /* @__PURE__ */ createElement(
|
||||
"article",
|
||||
{
|
||||
"toggle:showingchattools": isShowingChatTools,
|
||||
"toggle:showingchattools": isShowingObjects,
|
||||
id: "message-tab",
|
||||
"children:set": messageTabContent
|
||||
}
|
||||
|
||||
+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