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