From 5661cd9cde400f8a9422ca81ce0b758bc9d5c3cf Mon Sep 17 00:00:00 2001 From: Zach Dodson Date: Thu, 20 Jun 2024 08:39:46 -0400 Subject: [PATCH] minor changes, button hides correctly --- elements/chat-agent/chat-agent.js | 26 +++++++++++++++---- .../chat-agent/lib/chat-developer-panel.js | 3 +++ elements/chat-agent/lib/chat-input.js | 12 ++++----- elements/chat-agent/lib/chat-interface.js | 6 ++--- elements/chat-agent/lib/chat-message.js | 2 +- elements/chat-agent/lib/chat-suggestion.js | 3 +-- elements/chat-agent/src/chat-agent.js | 26 +++++++++++++++---- 7 files changed, 54 insertions(+), 24 deletions(-) diff --git a/elements/chat-agent/chat-agent.js b/elements/chat-agent/chat-agent.js index 2883268a1a..f134c4485b 100644 --- a/elements/chat-agent/chat-agent.js +++ b/elements/chat-agent/chat-agent.js @@ -39,13 +39,14 @@ class ChatAgent extends DDD { this.chatLog = []; this.engine = "alfred"; this.isAILoaded = false; - this.userName = "guest"; // TODO needs to grab username somehow or default to "guest", saw example in haxcms-site-editor-ui.js + this.userName = "guest"; + this.userPicture = ""; // button this.buttonIcon = "hax:wizard-hat"; this.buttonLabel = "Merlin-AI"; - this.isButtonHidden = false; + this.isButtonHidden = false; // TODO remove if unused // control bar @@ -74,6 +75,13 @@ class ChatAgent extends DDD { } + connectedCallback() { + super.connectedCallback(); + + // code for username and picture possibly found at => elements/haxcms-elements/lib/core/haxcms-editor-builder.js (starting around line 2639) + + } + // TODO @container queries for screen size differences /** * LitElement style callback @@ -209,7 +217,13 @@ class ChatAgent extends DDD { // button - + if (!this.isInterfaceHidden && this.isFullView) { + this.isButtonHidden = true; + CHAT_BUTTON.style.display = "none"; + } else { + this.isButtonHidden = false; + CHAT_BUTTON.style.display = "block"; + } // control bar @@ -227,13 +241,11 @@ class ChatAgent extends DDD { } if (this.isFullView) { - CHAT_INTERFACE.setAttribute("full-view", ""); SITE_BUILDER.style.width = "75%"; // TODO will be changed this.developerModeEnabled ? console.info("HAX-DEV-MODE: Interface loaded into full view") : null; } else { this.developerModeEnabled ? console.info("HAX-DEV-MODE: Interface loaded into standard view") : null; SITE_BUILDER.style.width = "100%"; - CHAT_INTERFACE.removeAttribute("full-view"); } // message @@ -318,6 +330,10 @@ class ChatAgent extends DDD { type: String, attribute: "username", }, + userPicture: { + type: String, + attribute: "user-picture", + }, // button buttonIcon: { diff --git a/elements/chat-agent/lib/chat-developer-panel.js b/elements/chat-agent/lib/chat-developer-panel.js index a09f589e07..7df7e41610 100644 --- a/elements/chat-agent/lib/chat-developer-panel.js +++ b/elements/chat-agent/lib/chat-developer-panel.js @@ -41,6 +41,7 @@ class ChatDeveloperPanel extends DDD { gap: var(--ddd-spacing-1); justify-content: space-between; align-items: center; + flex-wrap: wrap; } .switch-engine-controls { @@ -63,7 +64,9 @@ class ChatDeveloperPanel extends DDD { render() { return html`
+
+