Skip to content

Agent Zero AI framework

Bootstrap collapse; drop Alpine; fix expand anim

Alessandro3b7c5a12f2c8
diff --git a/webui/components/sidebar/bottom/preferences/preferences-panel.html b/webui/components/sidebar/bottom/preferences/preferences-panel.html
index 51ec52124..2139170da 100644
--- a/webui/components/sidebar/bottom/preferences/preferences-panel.html
+++ b/webui/components/sidebar/bottom/preferences/preferences-panel.html
@@ -7,15 +7,15 @@
<body>
<div x-data>
<template x-if="$store.preferences">
- <div class="pref-section" x-data="{ prefOpen: true }">
+ <div class="pref-section">
<span>
- <h3 class="pref-header" @click="prefOpen = !prefOpen">
+ <h3 class="pref-header" data-bs-toggle="collapse" data-bs-target="#pref-list">
Preferences
- <svg class="arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16" :class="{'rotated': !prefOpen}">
+ <svg class="arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
<path d="M8 4l8 8-8 8" />
</svg>
</h3>
- <ul class="config-list" id="pref-list" x-show="prefOpen" x-collapse x-transition>
+ <ul class="config-list collapse show" id="pref-list">
<li x-data x-init="$watch('$store.preferences.autoScroll', v => $store.preferences.applyAutoScroll(v))">
<span>Autoscroll</span>
<label class="switch">
@@ -81,14 +81,6 @@
cursor: pointer;
user-select: none;
}
- .pref-section .arrow-icon {
- margin-left: 0.5rem;
- transition: transform .15s ease;
- transform: rotate(90deg);
- }
- .pref-section .arrow-icon.rotated {
- transform: rotate(0deg);
- }
.pref-section .config-list {
list-style: none;
padding: 0.05rem 0;
diff --git a/webui/components/sidebar/left-sidebar.html b/webui/components/sidebar/left-sidebar.html
index e1c7cbcc4..e81b03e38 100644
--- a/webui/components/sidebar/left-sidebar.html
+++ b/webui/components/sidebar/left-sidebar.html
@@ -118,11 +118,17 @@
display: contents;
}
- /* Ensure the collapse wrapper participates in flex sizing */
- #tasks-section div[x-show][x-collapse] {
- display: contents;
+ /* Bootstrap collapse elements need proper display for animation to work */
+ #tasks-section .collapse {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-height: 0;
+ }
+ /* During the collapsing transition, allow height animation to control size */
+ #tasks-section .collapsing {
+ flex: 0 0 auto !important;
}
-
/* Common section header styling (Chats, Tasks) - matching Preferences style */
.section-header {
display: flex;
@@ -141,17 +147,6 @@
cursor: pointer;
}
- /* Arrow icon for collapsible sections */
- .section-header .arrow-icon {
- margin-left: 0.5rem;
- transition: transform 0.15s ease;
- transform: rotate(90deg);
- }
-
- .section-header .arrow-icon.rotated {
- transform: rotate(0deg);
- }
-
@media (max-width: 768px) {
#left-panel {
position: fixed;
diff --git a/webui/components/sidebar/tasks/tasks-list.html b/webui/components/sidebar/tasks/tasks-list.html
index 32b12b702..8a40ad9a8 100644
--- a/webui/components/sidebar/tasks/tasks-list.html
+++ b/webui/components/sidebar/tasks/tasks-list.html
@@ -5,16 +5,17 @@
</script>
</head>
<body>
- <div x-data="{ tasksOpen: true }" class="tasks-list-root">
+ <div class="tasks-list-root">
<template x-if="$store.tasks">
<div x-data class="tasks-list-inner">
- <h3 class="section-header section-header-collapsible" @click="tasksOpen = !tasksOpen">
+ <h3 class="section-header section-header-collapsible" data-bs-toggle="collapse" data-bs-target="#tasks-collapse">
Tasks
- <svg class="arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16" :class="{'rotated': !tasksOpen}">
+ <svg class="arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
<path d="M8 4l8 8-8 8" />
</svg>
</h3>
- <div class="tasks-list-body" x-show="tasksOpen" x-collapse x-transition>
+ <div class="collapse show" id="tasks-collapse">
+ <div class="tasks-list-body">
<div class="tasks-list-container" x-data>
<ul class="config-list tasks-config-list" x-show="$store.tasks.tasks.length > 0">
<template x-for="task in $store.tasks.tasks" :key="task.id">
@@ -54,6 +55,7 @@
<p><i>No tasks to list.</i></p>
</div>
</div>
+ </div>
</div>
</div>
</template>
@@ -64,10 +66,17 @@
<style>
/* Root wrappers provide flex context when embedded */
.tasks-list-root,
- .tasks-list-inner,
- .tasks-list-body {
+ .tasks-list-inner {
display: contents;
}
+
+ /* tasks-list-body is the flex container inside the collapse wrapper */
+ .tasks-list-body {
+ display: flex;
+ flex-direction: column;
+ flex: 1 1 auto;
+ min-height: 0;
+ }
.tasks-list-container .section-header {
position: sticky;
top: 0;
diff --git a/webui/index.css b/webui/index.css
index 28f0635ae..e46b182fb 100644
--- a/webui/index.css
+++ b/webui/index.css
@@ -1641,3 +1641,22 @@ nav ul li a img {
.spin {
animation: spin 1s linear infinite;
}
+
+/* Bootstrap Collapse */
+.collapse:not(.show) {
+ display: none !important;
+}
+.collapsing {
+ height: 0;
+ overflow: hidden;
+ transition: height .35s ease;
+}
+
+/* Arrow rotation based on Bootstrap's .collapsed class */
+[data-bs-toggle="collapse"] .arrow-icon {
+ transform: rotate(90deg);
+ transition: transform .15s ease;
+}
+[data-bs-toggle="collapse"].collapsed .arrow-icon {
+ transform: rotate(0deg);
+}
diff --git a/webui/index.html b/webui/index.html
index 272ac1807..f9cebe161 100644
--- a/webui/index.html
+++ b/webui/index.html
@@ -102,8 +102,10 @@
<script type="module" src="index.js"></script>
+ <!-- Bootstrap JS (only for logic, importing bundled CSS => UI conflicts) -->
+ <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
+
<!-- Then load Alpine.js -->
- <script defer src="vendor/alpine/alpine.collapse.min.js"></script>
<!-- <script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script> -->
<script type="module" src="js/initFw.js"></script>