Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

remove transition and add resize to left sidebar

ali-inkcob67f3b10d584
diff --git a/packages/app/src/builder-ui/pages/builder/components-menu.ts b/packages/app/src/builder-ui/pages/builder/components-menu.ts
index 82cf780d..80107702 100644
--- a/packages/app/src/builder-ui/pages/builder/components-menu.ts
+++ b/packages/app/src/builder-ui/pages/builder/components-menu.ts
@@ -804,6 +804,132 @@ function setupBuilderMenuDragDrop() {
},
});
+ // Left sidebar resize setup
+ const leftSidebarInteract = interact('#left-sidebar');
+ interactInstances.push(leftSidebarInteract);
+ leftSidebarInteract
+ .resizable({
+ margin: 5,
+ // Enable resize from right edge
+ edges: { left: false, right: true, bottom: false, top: false },
+
+ // Set min and max width
+ modifiers: [
+ (<any>interact).modifiers!.restrictSize({
+ min: { width: 280 },
+ max: (x, y, element) => {
+ const workspaceRect = document
+ .querySelector('#workspace-container')
+ ?.getBoundingClientRect();
+ const rightSidebarRect = document
+ .querySelector('#right-container')
+ ?.getBoundingClientRect();
+
+ if (!workspaceRect) {
+ return { width: 280 }; // Fallback to min-width
+ }
+
+ const minCanvasSpace = 420;
+ const responsiveBreakpoint = 768;
+ const maxLeftSidebarWidth = 1000;
+
+ // Calculate max width ensuring minimum canvas space is preserved
+ // For left sidebar: calculate from where the right edge would be
+ // Similar to right sidebar but in reverse direction
+ const elementRect = element.element.getBoundingClientRect();
+ const leftSidebarLeft = elementRect.left;
+
+ // Calculate available space from left edge to ensure canvas space
+ let maxWidthForCanvas = workspaceRect.right - leftSidebarLeft - minCanvasSpace;
+
+ // If right sidebar is open, account for its space requirement
+ if (rightSidebarRect && rightSidebarRect.width > 0) {
+ maxWidthForCanvas = rightSidebarRect.left - leftSidebarLeft - minCanvasSpace;
+ }
+
+ // On large screens, sidebar shouldn't be more than half the workspace
+ if (workspaceRect.width >= responsiveBreakpoint) {
+ const halfWorkspace = workspaceRect.width / 2;
+ return { width: Math.min(maxWidthForCanvas, halfWorkspace, maxLeftSidebarWidth) };
+ }
+
+ return { width: maxWidthForCanvas };
+ },
+ }),
+ ],
+
+ inertia: true,
+ })
+ .on('resizestart', function (event) {
+ document.body.classList.add('select-none');
+ event.target.classList.add('no-transition');
+ // Prevent scrollbar interference during resize
+ const contentSections = event.target.querySelectorAll(
+ '#left-sidebar-content-sections, .helpTab, .agentTab, .deployTab',
+ );
+ contentSections.forEach((section: Element) => {
+ (section as HTMLElement).classList.add('overflow-hidden');
+ });
+ })
+ .on('resizemove', function (event) {
+ const newWidth = event.rect.width + 'px';
+ event.target.style.width = newWidth;
+
+ // Update inner content container width to match main sidebar width
+ const contentContainer = event.target.querySelector('#left-sidebar-content-sections');
+ if (contentContainer) {
+ (contentContainer as HTMLElement).style.width = newWidth;
+ }
+
+ // Dispatch resize event for Alpine.js to react to real-time changes
+ window.dispatchEvent(
+ new CustomEvent('leftSidebarResized', {
+ detail: { width: newWidth },
+ }),
+ );
+ })
+ .on('resizeend', function (event) {
+ document.body.classList.remove('select-none');
+ event.target.classList.remove('no-transition');
+ // Restore scrollbars after resize
+ const contentSections = event.target.querySelectorAll(
+ '#left-sidebar-content-sections, .helpTab, .agentTab, .deployTab',
+ );
+ contentSections.forEach((section: Element) => {
+ (section as HTMLElement).classList.remove('overflow-hidden');
+ });
+
+ const finalWidth = event.target.style.width;
+
+ // Get current tab from localStorage and save with per-tab key
+ const currentTab = localStorage.getItem('currentSidebarTab');
+ if (currentTab && currentTab !== 'null') {
+ const storageKey = `leftSidebarWidth-${currentTab}`;
+ localStorage.setItem(storageKey, finalWidth);
+ } else {
+ // Fallback to generic key if no tab is set
+ localStorage.setItem('left-sidebar-width', finalWidth);
+ }
+
+ // Update Alpine.js width property to keep binding in sync
+ try {
+ const alpineComponent = (window as any).Alpine?.$data?.(event.target);
+ if (alpineComponent && typeof alpineComponent.width === 'string') {
+ alpineComponent.width = finalWidth;
+ }
+ } catch (error) {
+ // Alpine might not be available or element might not have Alpine data
+ console.warn('Could not update Alpine width property:', error);
+ }
+
+ // Dispatch final resize event
+ window.dispatchEvent(
+ new CustomEvent('leftSidebarResized', {
+ detail: { width: finalWidth },
+ }),
+ );
+ });
+
const rightSidebarInteract = interact(
'#right-sidebar,#embodiment-sidebar,#agent-settings-sidebar',
);
diff --git a/packages/app/static/css/menus.css b/packages/app/static/css/menus.css
index f6839756..55f981c8 100644
--- a/packages/app/static/css/menus.css
+++ b/packages/app/static/css/menus.css
@@ -5,210 +5,209 @@
} */
.compacted #left-menu.navview-pane {
- width: 50px !important;
+ width: 50px !important;
}
#left-menu .navview-menu-container {
- scrollbar-width: thin;
- scrollbar-color: #888 #f1f1f1;
+ scrollbar-width: thin;
+ scrollbar-color: #888 #f1f1f1;
}
#left-menu .navview-menu-container .navview-menu {
- background-color: transparent !important;
+ background-color: transparent !important;
}
/* This styles the container of the scrollbar */
#left-menu .navview-menu-container::-webkit-scrollbar {
- width: 0px;
- height: 0px;
+ width: 0px;
+ height: 0px;
}
#left-menu:hover .navview-menu-container::-webkit-scrollbar {
- width: 6px;
- height: 6px;
+ width: 6px;
+ height: 6px;
}
/* This styles the background of the scrollbar */
#left-menu .navview-menu-container::-webkit-scrollbar-track {
- background: transparent;
- border-radius: 10px;
+ background: transparent;
+ border-radius: 10px;
}
/* This styles the actual scrollbar itself */
#left-menu .navview-menu-container::-webkit-scrollbar-thumb {
- background: #bbbbbb;
- border-radius: 10px;
+ background: #bbbbbb;
+ border-radius: 10px;
}
/* Style the scrollbar when it's hovered */
#left-menu .navview-menu-container::-webkit-scrollbar-thumb:hover {
- background: #818181;
+ background: #818181;
}
#left-menu .suggest-box .input,
-.cpt-search .input,
-#cpt-search {
- background-color: #f8f8f8;
- max-width: 230px;
+.cpt-search .input {
+ background-color: #f8f8f8;
+ max-width: 230px;
}
.cpt-search .input.input.focused,
#left-menu .suggest-box .input.focused {
- box-shadow: 0px 0px 0px 0px #ffffff00 !important;
- -webkit-box-shadow: 0px 0px 0px 0px #ffffff00 !important;
+ box-shadow: 0px 0px 0px 0px #ffffff00 !important;
+ -webkit-box-shadow: 0px 0px 0px 0px #ffffff00 !important;
}
.cpt-search .input,
.navview .suggest-box .input {
- border: 0px !important;
- border-radius: 100px !important;
+ border: 0px !important;
+ border-radius: 100px !important;
}
.cpt-search .input input,
.navview .suggest-box .input input {
- border-radius: 12px !important;
+ border-radius: 12px !important;
}
#left-menu .navview-menu li.menuitem a.active {
- font-weight: 700;
+ font-weight: 700;
}
#left-menu .navview-menu li.menuitem a.active::before {
- content: '';
- display: block;
- position: absolute;
- height: 24px;
- top: 8px;
- left: 0;
- width: 60%;
- background: linear-gradient(90deg, rgb(0 164 255 / 35%) 0%, rgba(255, 255, 255, 0) 97%);
- z-index: 1;
+ content: '';
+ display: block;
+ position: absolute;
+ height: 24px;
+ top: 8px;
+ left: 0;
+ width: 60%;
+ background: linear-gradient(90deg, rgb(0 164 255 / 35%) 0%, rgba(255, 255, 255, 0) 97%);
+ z-index: 1;
}
#left-menu .navview-menu li.menuitem.active::before {
- display: none !important;
+ display: none !important;
}
.drag-menuitem {
- z-index: 999999;
- display: block;
- padding: 10px;
- max-width: 200px;
- cursor: grabbing;
- overflow: hidden;
- background: #fff;
- border-radius: 10px;
- border: 1px solid #aaa;
- transform: rotate(8deg);
+ z-index: 999999;
+ display: block;
+ padding: 10px;
+ max-width: 200px;
+ cursor: grabbing;
+ overflow: hidden;
+ background: #fff;
+ border-radius: 10px;
+ border: 1px solid #aaa;
+ transform: rotate(8deg);
}
#main-menu {
- border-bottom: 2px solid #01151c;
- height: 50px;
- background: #01151c;
+ border-bottom: 2px solid #01151c;
+ height: 50px;
+ background: #01151c;
}
#main-menu .app-bar-menu > li > a {
- color: #d9dcdd;
+ color: #d9dcdd;
}
#main-menu .app-bar-menu > li > a.active {
- color: #73f9bc;
- font-weight: 500;
+ color: #73f9bc;
+ font-weight: 500;
}
#main-menu .avatar {
- border-radius: 100px;
- border: 1px solid #01151c;
- background: #fff;
+ border-radius: 100px;
+ border: 1px solid #01151c;
+ background: #fff;
}
#main-menu a.brand {
- padding: 0 10px !important;
+ padding: 0 10px !important;
}
.menuitem.hidden {
- display: none !important;
+ display: none !important;
}
.name .highlight,
.menuitem .caption .highlight {
- color: #000;
- font-weight: bold;
- background-color: #8ad0ff;
+ color: #000;
+ font-weight: bold;
+ background-color: #8ad0ff;
}
/* top menu -----------------------------------------------*/
#top-menu {
- display: block;
- box-shadow: 0 0 5px 1px #b4b4b4;
- position: relative;
- z-index: 4;
- background-color: #fff !important;
- border-bottom: 0px solid #aaa;
- line-height: 30px;
- height: 30px;
+ display: block;
+ box-shadow: 0 0 5px 1px #b4b4b4;
+ position: relative;
+ z-index: 4;
+ background-color: #fff !important;
+ border-bottom: 0px solid #aaa;
+ line-height: 30px;
+ height: 30px;
}
#top-menu > li > div.input {
- border-radius: 0px 10px 10px 0px;
+ border-radius: 0px 10px 10px 0px;
}
#top-menu .input,
#top-menu input {
- height: 30px;
- overflow-y: hidden;
- font: 700 12px;
+ height: 30px;
+ overflow-y: hidden;
+ font: 700 12px;
}
#top-menu div.prepend {
- height: 30px;
- padding: 0px 10px;
- font: 500 14px;
- line-height: 30px;
+ height: 30px;
+ padding: 0px 10px;
+ font: 500 14px;
+ line-height: 30px;
}
#top-menu > li > a {
- height: 30px;
- padding: 0px 5px;
- margin: 0px 5px;
+ height: 30px;
+ padding: 0px 5px;
+ margin: 0px 5px;
}
#top-menu button.input-custom-button {
- height: 30px;
+ height: 30px;
}
#top-menu button.input-custom-button span::before {
- font-size: 11px;
- line-height: 30px;
+ font-size: 11px;
+ line-height: 30px;
}
/*---------------------------------------------------------*/
/*---------------------------------------------------------*/
.navview-menu .item-subheader {
- font: 700 12px;
+ font: 700 12px;
}
.menuitem .badges {
- position: absolute;
- top: 10px;
- right: 0px;
+ position: absolute;
+ top: 10px;
+ right: 0px;
}
.menuitem .badges .btn-info {
- cursor: help;
+ cursor: help;
}
.user-block {
- display: block;
- position: absolute;
- top: 100%;
- right: 0;
- width: 280px;
- line-height: 1.2;
+ display: block;
+ position: absolute;
+ top: 100%;
+ right: 0;
+ width: 280px;
+ line-height: 1.2;
}
.user-block .avatar {
- width: 128px;
- height: 120px;
- overflow: hidden;
- border-radius: 50%;
- border: 2px solid white;
+ width: 128px;
+ height: 120px;
+ overflow: hidden;
+ border-radius: 50%;
+ border: 2px solid white;
}
.user-block .avatar img {
- width: 100%;
- height: auto;
+ width: 100%;
+ height: auto;
}
#main-menu a.user-menu {
- padding: 0px;
+ padding: 0px;
}
#main-menu a.user-menu:hover {
- background-color: transparent;
+ background-color: transparent;
}
#main-menu a.user-menu:hover img {
- background-color: silver;
+ background-color: silver;
}
diff --git a/packages/app/views/pages/partials/studio/left-sidebar.ejs b/packages/app/views/pages/partials/studio/left-sidebar.ejs
index b94df0da..6c9fb763 100644
--- a/packages/app/views/pages/partials/studio/left-sidebar.ejs
+++ b/packages/app/views/pages/partials/studio/left-sidebar.ejs
@@ -1,11 +1,11 @@
<div
x-data="sidebarState()"
@toggle-sidebar-request.window="toggleSidebar()"
- class="transition-all duration-300 max-h-screen z-[11] absolute top-16 md:top-0 h-screen"
+ class="max-h-screen z-[11] absolute top-16 md:top-0 h-screen"
:class="{
- 'w-full md:w-[414px]': isSidebarOpen && currentSidebarTab === 'helpTab',
- 'md:w-[378px]': isSidebarOpen && currentSidebarTab !== 'helpTab' && currentSidebarTab !== 'agentBuilderTab' && currentSidebarTab !== 'agentTab',
- 'w-full md:w-[480px]': isSidebarOpen && (currentSidebarTab === 'agentBuilderTab' || currentSidebarTab === 'agentTab'),
+ 'w-full md:w-[414px]': isSidebarOpen && currentSidebarTab === 'helpTab' && !sidebarWidth,
+ 'md:w-[378px]': isSidebarOpen && currentSidebarTab !== 'helpTab' && currentSidebarTab !== 'agentBuilderTab' && currentSidebarTab !== 'agentTab' && !sidebarWidth,
+ 'w-full md:w-[480px]': isSidebarOpen && (currentSidebarTab === 'agentBuilderTab' || currentSidebarTab === 'agentTab') && !sidebarWidth,
'w-0 md:w-16': !isSidebarOpen
}"
id="left-sidebar"
@@ -474,19 +474,13 @@
<div
x-show="isSidebarOpen"
- x-transition:enter="transition-opacity duration-300"
- x-transition:enter-start="opacity-0"
- x-transition:enter-end="opacity-100"
- x-transition:leave="transition-opacity duration-300"
- x-transition:leave-start="opacity-100"
- x-transition:leave-end="opacity-0"
id="left-sidebar-container"
class="inset-y-0 -top-5 md:top-4 md:bottom-4 left-[6px] md:left-[80px] p-3 px-0 flex-shrink-0 rounded-lg w-[100vw] md:w-[calc(100%-4rem)] absolute"
>
<div
aria-label="Main"
id="left-sidebar-content-sections"
- class="flex flex-col items-start bg-white rounded-lg border border-solid border-gray-300 h-[calc(100dvh-4rem)] md:h-full w-full max-w-[100vw]"
+ class="flex flex-col items-start bg-white rounded-lg border border-solid border-gray-300 h-[calc(100dvh-4rem)] md:h-full"
>
<div class="w-full flex md:hidden justify-between items-center p-2">
<div class="flex items-center gap-2">
@@ -556,6 +550,7 @@
Alpine.data('sidebarState', () => ({
previousTab: localStorage.getItem('previousTab') || null,
+ sidebarWidth: null, // Will be loaded from localStorage in init()
buildSidebarTabs: [
'agentBuilderTab',
'buildTab',
@@ -668,15 +663,80 @@
localStorage.setItem('currentSidebarTab', 'agentBuilderTab');
}
- this.$watch('isSidebarOpen', (value) => {
- localStorage.setItem('sidebarOpen', value);
+ // === SINGLE SOURCE OF TRUTH: Apply width to DOM ===
+ const applyWidth = (width) => {
+ console.log('[applyWidth] Applying width:', width);
+ this.$nextTick(() => {
+ const leftSidebar = document.querySelector('#left-sidebar');
+ const contentContainer = document.querySelector('#left-sidebar-content-sections');
+
+ if (leftSidebar && width) {
+ leftSidebar.style.setProperty('width', width, 'important');
+ console.log('[applyWidth] Set #left-sidebar width to:', width);
+ }
+ if (contentContainer && width) {
+ contentContainer.style.width = width;
+ console.log('[applyWidth] Set content container width to:', width);
+ }
+ });
+ };
+
+ // Load saved width on init
+ const savedWidth = localStorage.getItem('left-sidebar-width');
+ if (savedWidth) {
+ this.sidebarWidth = savedWidth;
+ if (this.isSidebarOpen) {
+ applyWidth(savedWidth);
+ }
+ }
- // Very important: If sidebar is closed, ensure currentSidebarTab is null
- if (!value && this.currentSidebarTab) {
- this.previousTab = this.currentSidebarTab;
- this.currentSidebarTab = null;
- localStorage.setItem('previousTab', this.previousTab);
- localStorage.setItem('currentSidebarTab', null);
+ // Listen for resize events from interact.js
+ window.addEventListener('leftSidebarResized', (event) => {
+ this.sidebarWidth = event.detail.width;
+ applyWidth(event.detail.width);
+ });
+
+ // Watch sidebarWidth changes and apply to DOM
+ this.$watch('sidebarWidth', (newWidth) => {
+ if (newWidth && this.isSidebarOpen) {
+ applyWidth(newWidth);
+ }
+ });
+
+ this.$watch('isSidebarOpen', (value, oldValue) => {
+ localStorage.setItem('sidebarOpen', value);
+ console.log('[isSidebarOpen watcher] Changed from', oldValue, 'to', value);
+
+ if (!value) {
+ // When sidebar closes, clear the inline styles so Tailwind takes over
+ this.$nextTick(() => {
+ const leftSidebar = document.querySelector('#left-sidebar');
+ const contentContainer = document.querySelector('#left-sidebar-content-sections');
+ if (leftSidebar) leftSidebar.style.width = '';
+ if (contentContainer) contentContainer.style.width = '';
+ });
+
+ // Very important: If sidebar is closed, ensure currentSidebarTab is null
+ if (this.currentSidebarTab) {
+ this.previousTab = this.currentSidebarTab;
+ this.currentSidebarTab = null;
+ localStorage.setItem('previousTab', this.previousTab);
+ localStorage.setItem('currentSidebarTab', null);
+ }
+ } else {
+ // When sidebar opens, apply saved width if it exists
+ console.log('[isSidebarOpen watcher] Sidebar opened, sidebarWidth:', this.sidebarWidth);
+ if (this.sidebarWidth) {
+ applyWidth(this.sidebarWidth);
+ } else {
+ // No custom width, check localStorage
+ const savedWidth = localStorage.getItem('left-sidebar-width');
+ console.log('[isSidebarOpen watcher] Checking localStorage:', savedWidth);
+ if (savedWidth) {
+ this.sidebarWidth = savedWidth;
+ applyWidth(savedWidth);
+ }
+ }
}
window.dispatchEvent(
@@ -689,6 +749,16 @@
}),
);
});
+
+ // Watch for tab changes when sidebar is already open
+ this.$watch('currentSidebarTab', (newTab, oldTab) => {
+ console.log('[currentSidebarTab watcher] Changed from', oldTab, 'to', newTab);
+ // Apply width when switching tabs (sidebar stays open)
+ if (this.isSidebarOpen && this.sidebarWidth) {
+ console.log('[currentSidebarTab watcher] Reapplying width on tab change');
+ applyWidth(this.sidebarWidth);
+ }
+ });
window.addEventListener('fixWithAIBtn', (event) => {
// Only click the tab if sidebar is closed or weaver tab is not active
if (!this.isSidebarOpen || this.currentSidebarTab !== 'agentBuilderTab') {