From f67b3f9105066edb8d9785759d633e1f01399021 Mon Sep 17 00:00:00 2001 From: SilasMarvin <19626586+SilasMarvin@users.noreply.github.com> Date: Thu, 26 Oct 2023 09:06:24 -0700 Subject: [PATCH] Some updates from QA --- .../src/components/accordian/accordian.scss | 10 +---- .../accordian/accordian_controller.js | 39 ++++++++++++++----- .../src/components/chatbot/chatbot.scss | 4 +- .../components/chatbot/chatbot_controller.js | 2 +- .../src/components/chatbot/template.html | 4 +- pgml-dashboard/src/components/star/mod.rs | 4 ++ .../icons/stars/give_it_a_spin_outline.svg | 9 +++++ .../icons/stars/give_it_a_spin_text.svg | 24 ++++++++++++ 8 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 pgml-dashboard/static/images/icons/stars/give_it_a_spin_outline.svg create mode 100644 pgml-dashboard/static/images/icons/stars/give_it_a_spin_text.svg 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 ` -
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: