diff --git a/pgml-dashboard/src/components/accordian/accordian.scss b/pgml-dashboard/src/components/accordian/accordian.scss index e90cb1ac5..dc1a279ce 100644 --- a/pgml-dashboard/src/components/accordian/accordian.scss +++ b/pgml-dashboard/src/components/accordian/accordian.scss @@ -4,13 +4,7 @@ div[data-controller="accordian"] { } .accordian-body { - display: none; - height: 0px; - transition: all 0.5s ease-in-out; - } - - .accordian-body.selected { - display: block; - height: auto; + overflow: hidden; + transition: all 0.3s ease-in-out; } } diff --git a/pgml-dashboard/src/components/accordian/accordian_controller.js b/pgml-dashboard/src/components/accordian/accordian_controller.js index b9eace831..d91ba65f6 100644 --- a/pgml-dashboard/src/components/accordian/accordian_controller.js +++ b/pgml-dashboard/src/components/accordian/accordian_controller.js @@ -1,18 +1,37 @@ import { Controller } from "@hotwired/stimulus"; export default class extends Controller { + initialize() { + this.bodies = document.getElementsByClassName("accordian-body"); + this.headers = document.getElementsByClassName("accordian-header"); + + this.heights = new Map(); + for (let i = 0; i < this.bodies.length; i++) { + this.heights.set(this.bodies[i], this.bodies[i].offsetHeight); + if (i > 0) { + this.bodies[i].style.maxHeight = "0px"; + } else { + this.bodies[i].style.maxHeight = this.bodies[i].offsetHeight + "px"; + } + } + } + + titleClick(e) { let target = e.currentTarget.getAttribute("data-value"); - let elements = document.getElementsByClassName("accordian-body"); - for (let i = 0; i < elements.length; i++) { - elements[i].classList.remove("selected"); - } - elements = document.getElementsByClassName("accordian-header"); - for (let i = 0; i < elements.length; i++) { - elements[i].classList.remove("selected"); - } - let element = document.querySelector(`[data-accordian-target="${target}"]`); - element.classList.add("selected"); e.currentTarget.classList.add("selected"); + + let body = document.querySelector(`[data-accordian-target="${target}"]`); + body.classList.add("selected"); + body.style.maxHeight = this.heights.get(body) + "px"; + + for (let i = 0; i < this.bodies.length; i++) { + if (body != this.bodies[i]) { + this.bodies[i].classList.remove("selected"); + this.bodies[i].style.maxHeight = "0px"; + } + if (e.currentTarget != this.headers[i]) + this.headers[i].classList.remove("selected"); + } } } diff --git a/pgml-dashboard/src/components/chatbot/chatbot.scss b/pgml-dashboard/src/components/chatbot/chatbot.scss index ded625965..f5964dc8f 100644 --- a/pgml-dashboard/src/components/chatbot/chatbot.scss +++ b/pgml-dashboard/src/components/chatbot/chatbot.scss @@ -59,8 +59,8 @@ div[data-controller="chatbot"] { } .chatbot-brain-option-logo { - height: 34px; - width: 34px; + height: 30px; + width: 30px; background-position: center; background-repeat: no-repeat; background-size: contain; diff --git a/pgml-dashboard/src/components/chatbot/chatbot_controller.js b/pgml-dashboard/src/components/chatbot/chatbot_controller.js index 515dea535..ef6703b33 100644 --- a/pgml-dashboard/src/components/chatbot/chatbot_controller.js +++ b/pgml-dashboard/src/components/chatbot/chatbot_controller.js @@ -65,7 +65,7 @@ const knowledgeBaseIdToName = (knowledgeBase) => { const createKnowledgeBaseNotice = (knowledgeBase) => { return ` -
Chatting with Knowledge Base ${knowledgeBaseIdToName( +
Chatting with Knowledge Base ${knowledgeBaseIdToName( knowledgeBase, )}
`; diff --git a/pgml-dashboard/src/components/chatbot/template.html b/pgml-dashboard/src/components/chatbot/template.html index cd37f4ad5..2a0b06a99 100644 --- a/pgml-dashboard/src/components/chatbot/template.html +++ b/pgml-dashboard/src/components/chatbot/template.html @@ -1,6 +1,6 @@
-
+
Knowledge Base:
@@ -101,7 +101,7 @@
Knowledge Base:
-

Chatbot

+

Chatbot

diff --git a/pgml-dashboard/src/components/star/mod.rs b/pgml-dashboard/src/components/star/mod.rs index 670577ab9..9494cf1ab 100644 --- a/pgml-dashboard/src/components/star/mod.rs +++ b/pgml-dashboard/src/components/star/mod.rs @@ -26,6 +26,10 @@ const SVGS: Lazy> = Lazy::new(|| { "give_it_a_spin", include_str!("../../../static/images/icons/stars/give_it_a_spin.svg"), ); + map.insert( + "give_it_a_spin_outline", + include_str!("../../../static/images/icons/stars/give_it_a_spin_outline.svg"), + ); map }); diff --git a/pgml-dashboard/static/images/icons/stars/give_it_a_spin_outline.svg b/pgml-dashboard/static/images/icons/stars/give_it_a_spin_outline.svg new file mode 100644 index 000000000..e03aca3b7 --- /dev/null +++ b/pgml-dashboard/static/images/icons/stars/give_it_a_spin_outline.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/pgml-dashboard/static/images/icons/stars/give_it_a_spin_text.svg b/pgml-dashboard/static/images/icons/stars/give_it_a_spin_text.svg new file mode 100644 index 000000000..9e465d703 --- /dev/null +++ b/pgml-dashboard/static/images/icons/stars/give_it_a_spin_text.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + +