Skip to content

Agent Zero AI framework

tooltips; css polishing

3clyp5067e5783c3c20
diff --git a/webui/components/chat/input/chat-bar-input.html b/webui/components/chat/input/chat-bar-input.html
index 5765846e8..08bce644b 100644
--- a/webui/components/chat/input/chat-bar-input.html
+++ b/webui/components/chat/input/chat-bar-input.html
@@ -9,15 +9,13 @@
<body>
<div class="input-row">
<!-- Attachment icon with tooltip -->
- <div class="attachment-wrapper" x-data="{ showTooltip: false }">
- <label for="file-input" class="attachment-icon" @mouseover="showTooltip = true" @mouseleave="showTooltip = false">
+ <div class="attachment-wrapper">
+ <label for="file-input" class="attachment-icon" title="Add attachments to the message" data-bs-placement="top">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
<path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z" />
</svg>
</label>
<input type="file" id="file-input" accept="*" multiple style="display: none" @change="$store.chatAttachments.handleFileUpload($event)">
-
- <div x-show="showTooltip" class="tooltip">Add attachments to the message</div>
</div>
<!-- Container for textarea and expand button -->
@@ -64,8 +62,6 @@
.attachment-icon { cursor: pointer; color: var(--color-text); opacity: 0.7; transition: opacity 0.2s ease; display: flex; align-items: center; }
.attachment-icon:hover { opacity: 1; }
.attachment-icon:active { opacity: 0.5; }
- .tooltip { position: absolute; bottom: 100%; left: 50%; transform: translateX(0%); padding: 8px; background-color: var(--color-secondary); color: var(--color-text); border-radius: 4px; font-size: 12px; white-space: nowrap; z-index: 1002; }
-
/* Text input */
#chat-input-container {
position: relative;
@@ -117,8 +113,6 @@
.chat-button svg { width: 1.5rem; height: 1.5rem; }
/* Microphone button */
.chat-button.mic-inactive svg { /* Add specific styles if needed */ }
- /* Tooltip */
- .tooltip { position: absolute; bottom: 100%; left: 50%; transform: translateX(0%); padding: 8px; background-color: var(--color-secondary); color: var(--color-text); border-radius: 4px; font-size: 12px; white-space: nowrap; z-index: 1002; }
/* Responsive tweaks */
@media (max-width: 640px) {
#chat-input { min-height: 5.3rem; align-content: start; }
@@ -128,4 +122,3 @@
</style>
</body>
</html>
-
diff --git a/webui/components/sidebar/chats/chats-list.html b/webui/components/sidebar/chats/chats-list.html
index e26a7aa85..8aff1d111 100644
--- a/webui/components/sidebar/chats/chats-list.html
+++ b/webui/components/sidebar/chats/chats-list.html
@@ -13,7 +13,7 @@
<div class="section-header-row">
<h3 class="section-header">Chats</h3>
<!-- New Chat Button -->
- <button id="newChat" @click="$store.chats.newChat()" aria-label="New Chat">
+ <button id="newChat" @click="$store.chats.newChat()" aria-label="New Chat" title="New Chat" data-bs-placement="top">
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 110 135" width="32" height="32">
<path d="m38.3 81.3 3.2-9.1 3.1-9v-.1c0-.2.1-.3.2-.4.1-.2.2-.3.3-.4L82.4 25c1.6-1.6 3.7-2.4 5.7-2.4h.2c2 0 4 .8 5.6 2.4l3.7 3.7.1.2c1.5 1.6 2.2 3.6 2.2 5.6v.2c0 2-.8 4-2.4 5.6l-.1.1-3.8 3.6-.1.1-.1.1-32.9 33-.1.1q-.45.45-.9.6l-9.1 3.2h-.1l-9.1 3.1c-1.2.4-2.5-.2-2.9-1.4q-.3-.75 0-1.5m7.5-7.6-1.6 4.6 4.6-1.6 5.7-2-3.4-3.4-3.3-3.3zm4.2-9.9 4.3 4.3 4.3 4.3 30-30-8.6-8.5zm35.7-35.7-2.5 2.5 8.6 8.6 2.4-2.4.1-.1c.6-.6 1-1.5 1-2.3v-.1c0-.9-.3-1.8-1-2.4l-3.7-3.7c-.6-.6-1.5-1-2.3-1h-.1c-.9-.1-1.8.3-2.5.9m.4 44.1c0-1.3 1-2.3 2.3-2.3s2.3 1 2.3 2.3V101c0 3.2-1.3 6.1-3.4 8.2s-5 3.4-8.2 3.4H21.6c-3.2 0-6.1-1.3-8.2-3.4s-3.4-5-3.4-8.2V43.4c0-3.2 1.3-6.1 3.4-8.2s5-3.4 8.2-3.4h28.8c1.3 0 2.3 1 2.3 2.3s-1 2.3-2.3 2.3H21.6c-1.9 0-3.7.8-4.9 2-1.3 1.3-2 3-2 4.9v57.6c0 1.9.8 3.6 2 4.9 1.3 1.3 3 2 4.9 2h57.6c1.9 0 3.7-.8 4.9-2 1.3-1.3 2-3 2-4.9z" style="fill:currentColor"></path>
</svg>
diff --git a/webui/components/sidebar/top-section/quick-actions.html b/webui/components/sidebar/top-section/quick-actions.html
index b58e9671c..822f10680 100644
--- a/webui/components/sidebar/top-section/quick-actions.html
+++ b/webui/components/sidebar/top-section/quick-actions.html
@@ -31,7 +31,7 @@
</button>
<!-- Dropdown Toggle -->
- <button class="config-button dropdown-toggle" @click="dropdownOpen = !dropdownOpen" title="More options">
+ <button class="config-button dropdown-toggle" @click="$store.tooltips.hideAll(); dropdownOpen = !dropdownOpen" title="More options">
<span class="material-symbols-outlined" :class="dropdownOpen ? 'rotated' : ''">expand_more</span>
</button>
</div>
diff --git a/webui/components/tooltips/tooltip-store.js b/webui/components/tooltips/tooltip-store.js
new file mode 100644
index 000000000..3d5ea6170
--- /dev/null
+++ b/webui/components/tooltips/tooltip-store.js
@@ -0,0 +1,112 @@
+import { createStore } from "/js/AlpineStore.js";
+
+let bootstrapTooltipObserver = null;
+
+function ensureBootstrapTooltip(element) {
+ if (!element || !(element instanceof Element)) return;
+
+ const bs = globalThis.bootstrap;
+ if (!bs?.Tooltip) return;
+
+ const existing = bs.Tooltip.getInstance(element);
+ const title = element.getAttribute("title") || element.getAttribute("data-bs-original-title");
+
+ if (!title) return;
+
+ if (existing) {
+ if (element.getAttribute("title")) {
+ element.setAttribute("data-bs-original-title", title);
+ element.removeAttribute("title");
+ }
+ existing.setContent({ ".tooltip-inner": title });
+ return;
+ }
+
+ if (element.getAttribute("title")) {
+ element.setAttribute("data-bs-original-title", title);
+ element.removeAttribute("title");
+ }
+
+ element.setAttribute("data-bs-toggle", "tooltip");
+ element.setAttribute("data-bs-tooltip-initialized", "true");
+ new bs.Tooltip(element, {
+ delay: { show: 0, hide: 0 },
+ trigger: "hover focus",
+ });
+}
+
+function initBootstrapTooltips(root = document) {
+ if (!globalThis.bootstrap?.Tooltip) return;
+ const tooltipTargets = root.querySelectorAll(
+ "[title]:not([data-bs-tooltip-initialized]), [data-bs-original-title]:not([data-bs-tooltip-initialized])"
+ );
+ tooltipTargets.forEach((element) => ensureBootstrapTooltip(element));
+}
+
+function observeBootstrapTooltips() {
+ if (!globalThis.bootstrap?.Tooltip) return;
+
+ // Prevent multiple observers
+ if (bootstrapTooltipObserver) return;
+
+ bootstrapTooltipObserver = new MutationObserver((mutations) => {
+ mutations.forEach((mutation) => {
+ if (mutation.type === "attributes" && mutation.attributeName === "title") {
+ ensureBootstrapTooltip(mutation.target);
+ return;
+ }
+
+ if (mutation.type === "childList") {
+ mutation.addedNodes.forEach((node) => {
+ if (!(node instanceof Element)) return;
+ if (node.matches("[title]") || node.querySelector("[title]")) {
+ initBootstrapTooltips(node);
+ }
+ });
+ }
+ });
+ });
+
+ bootstrapTooltipObserver.observe(document.body, {
+ childList: true,
+ subtree: true,
+ attributes: true,
+ attributeFilter: ["title"],
+ });
+}
+
+function cleanupTooltipObserver() {
+ if (bootstrapTooltipObserver) {
+ bootstrapTooltipObserver.disconnect();
+ bootstrapTooltipObserver = null;
+ }
+}
+
+function hideAllTooltips() {
+ const Tooltip = globalThis.bootstrap?.Tooltip;
+ if (!Tooltip) return;
+
+ document
+ .querySelectorAll('[data-bs-tooltip-initialized="true"]')
+ .forEach((element) => {
+ try {
+ const instance = Tooltip.getInstance(element);
+ if (instance) {
+ instance.hide();
+ }
+ } catch (error) {
+ console.warn("Error hiding tooltip:", error);
+ }
+ });
+}
+
+export const store = createStore("tooltips", {
+ hideAll: hideAllTooltips,
+
+ init() {
+ initBootstrapTooltips();
+ observeBootstrapTooltips();
+ },
+
+ cleanup: cleanupTooltipObserver,
+});
diff --git a/webui/css/settings.css b/webui/css/settings.css
index 7918a31e3..6fffd5e72 100644
--- a/webui/css/settings.css
+++ b/webui/css/settings.css
@@ -280,12 +280,10 @@ nav ul li a img {
.settings-tabs::before {
left: 0;
- background: linear-gradient(to right, var(--color-panel), transparent);
}
.settings-tabs::after {
right: 0;
- background: linear-gradient(to left, var(--color-panel), transparent);
}
.settings-tab {
diff --git a/webui/index.css b/webui/index.css
index d757ddc6f..e5ed391de 100644
--- a/webui/index.css
+++ b/webui/index.css
@@ -129,6 +129,111 @@ body,
color: var(--color-text);
}
+/* Bootstrap-like tooltips */
+.tooltip {
+ position: absolute;
+ z-index: 1080;
+ display: block;
+ margin: 0;
+ font-family: var(--font-family-main);
+ font-style: normal;
+ font-weight: 400;
+ line-height: 1.2;
+ text-align: left;
+ text-decoration: none;
+ text-shadow: none;
+ text-transform: none;
+ letter-spacing: normal;
+ word-break: normal;
+ white-space: normal;
+ opacity: 0;
+ pointer-events: none;
+ transition: opacity 0.08s ease-in-out;
+}
+
+.tooltip.show {
+ opacity: 1;
+}
+
+.tooltip .tooltip-inner {
+ max-width: 240px;
+ padding: 0.35rem 0.6rem;
+ color: var(--color-text);
+ background-color: var(--color-secondary);
+ border-radius: 0.375rem;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
+ font-size: 0.75rem;
+}
+
+.tooltip .tooltip-arrow {
+ position: absolute;
+ width: 0.8rem;
+ height: 0.4rem;
+}
+
+.tooltip .tooltip-arrow::before {
+ content: "";
+ position: absolute;
+ border-color: transparent;
+ border-style: solid;
+}
+
+.bs-tooltip-top .tooltip-arrow {
+ bottom: 0;
+ left: 50%;
+ transform: translateX(-50%);
+}
+
+.bs-tooltip-top .tooltip-arrow::before {
+ border-width: 0.4rem 0.4rem 0;
+ border-top-color: var(--color-secondary);
+ top: 0;
+}
+
+.bs-tooltip-bottom .tooltip-arrow {
+ top: 0;
+ left: 50%;
+ transform: translateX(-50%);
+}
+
+.bs-tooltip-bottom .tooltip-arrow::before {
+ border-width: 0 0.4rem 0.4rem;
+ border-bottom-color: var(--color-secondary);
+ top: 0;
+}
+
+.bs-tooltip-start .tooltip-arrow,
+.bs-tooltip-left .tooltip-arrow {
+ right: 0;
+ top: 50%;
+ width: 0.4rem;
+ height: 0.8rem;
+ transform: translateY(-50%);
+}
+
+.bs-tooltip-start .tooltip-arrow::before,
+.bs-tooltip-left .tooltip-arrow::before {
+ border-width: 0.4rem 0 0.4rem 0.4rem;
+ border-left-color: var(--color-secondary);
+ left: 0;
+}
+
+.bs-tooltip-end .tooltip-arrow,
+.bs-tooltip-right .tooltip-arrow {
+ left: 0;
+ top: 50%;
+ width: 0.4rem;
+ height: 0.8rem;
+ transform: translateY(-50%);
+}
+
+.bs-tooltip-end .tooltip-arrow::before,
+.bs-tooltip-right .tooltip-arrow::before {
+ border-width: 0.4rem 0.4rem 0.4rem 0;
+ border-right-color: var(--color-secondary);
+ right: 0;
+}
+
img {
user-drag: none; /* Safari & old Chrome */
-webkit-user-drag: none;
diff --git a/webui/js/modals.js b/webui/js/modals.js
index b147a25f7..39abd643e 100644
--- a/webui/js/modals.js
+++ b/webui/js/modals.js
@@ -1,5 +1,6 @@
// Import the component loader and page utilities
import { importComponent } from "/js/components.js";
+import { store as tooltipsStore } from "/components/tooltips/tooltip-store.js";
// Modal functionality
const modalStack = [];
@@ -106,6 +107,8 @@ function createModalElement(path) {
export function openModal(modalPath) {
return new Promise((resolve) => {
try {
+ tooltipsStore.hideAll();
+
// Create new modal instance
const modal = createModalElement(modalPath);