Skip to content

Commit 3ba041e

Browse files
committed
fix: move tools button back inside scrollable tab area
Tools button is better placed inside the scrollable tabs area near the panels it launches. Restores original show/hide behavior when active. Overflow dropdown handles it when scrolled out of view.
1 parent 3cbc4ba commit 3ba041e

2 files changed

Lines changed: 21 additions & 48 deletions

File tree

src/styles/Extn-BottomPanelTabs.less

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,6 @@ img.panel-titlebar-icon {
286286
align-items: center;
287287
justify-content: center;
288288
padding: 0 8px;
289-
border-left: 1px solid rgba(0, 0, 0, 0.08);
290-
291-
.dark & {
292-
border-left: 1px solid rgba(255, 255, 255, 0.08);
293-
}
294289
height: 2rem;
295290
line-height: 2rem;
296291
overflow: hidden;
@@ -315,30 +310,6 @@ img.panel-titlebar-icon {
315310
}
316311
}
317312

318-
&.active {
319-
color: #333;
320-
background-color: #fff;
321-
position: relative;
322-
323-
.dark & {
324-
color: #dedede;
325-
background-color: #1D1F21;
326-
}
327-
328-
&::after {
329-
content: "";
330-
position: absolute;
331-
top: 0;
332-
left: 0;
333-
right: 0;
334-
height: 0.1rem;
335-
background-color: #0078D7;
336-
337-
.dark & {
338-
background-color: #75BEFF;
339-
}
340-
}
341-
}
342313
}
343314

344315
.bottom-panel-tab-bar-actions {

src/view/PanelView.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,24 @@ define(function (require, exports, module) {
172172
if (!_$tabsOverflow) {
173173
return;
174174
}
175+
// Detach the add button before emptying to preserve its event handlers
176+
if (_$addBtn) {
177+
_$addBtn.detach();
178+
}
175179
_$tabsOverflow.empty();
176180

177181
_openIds.forEach(function (panelId) {
178-
// Default panel uses the external Tools button, not a tab
179-
if (panelId === _defaultPanelId) {
180-
return;
181-
}
182182
let panel = _panelMap[panelId];
183183
if (!panel) {
184184
return;
185185
}
186186
_$tabsOverflow.append(_buildTab(panel, panelId === _activeId));
187187
});
188188

189+
// Re-append the Tools button at the end
190+
if (_$addBtn) {
191+
_$tabsOverflow.append(_$addBtn);
192+
}
189193
_updateAddButtonVisibility();
190194
_checkTabOverflow();
191195
}
@@ -218,17 +222,17 @@ define(function (require, exports, module) {
218222
if (!_$tabsOverflow) {
219223
return;
220224
}
221-
// Default panel uses the external Tools button, not a tab
222-
if (panelId === _defaultPanelId) {
223-
_updateAddButtonVisibility();
224-
return;
225-
}
226225
let panel = _panelMap[panelId];
227226
if (!panel) {
228227
return;
229228
}
230229
let $tab = _buildTab(panel, panelId === _activeId);
231-
_$tabsOverflow.append($tab);
230+
// Insert before the Tools button so it stays at the end
231+
if (_$addBtn && _$addBtn.parent().length) {
232+
_$addBtn.before($tab);
233+
} else {
234+
_$tabsOverflow.append($tab);
235+
}
232236
_updateAddButtonVisibility();
233237
_checkTabOverflow();
234238
}
@@ -243,10 +247,6 @@ define(function (require, exports, module) {
243247
if (!_$tabsOverflow) {
244248
return;
245249
}
246-
if (panelId === _defaultPanelId) {
247-
_updateAddButtonVisibility();
248-
return;
249-
}
250250
_$tabsOverflow.find('.bottom-panel-tab[data-panel-id="' + panelId + '"]').remove();
251251
_updateAddButtonVisibility();
252252
_checkTabOverflow();
@@ -495,8 +495,11 @@ define(function (require, exports, module) {
495495
if (!_$addBtn) {
496496
return;
497497
}
498-
// Highlight the Tools button as active when the default panel is shown
499-
_$addBtn.toggleClass("active", _defaultPanelId && _activeId === _defaultPanelId);
498+
if (_defaultPanelId && _activeId === _defaultPanelId) {
499+
_$addBtn.hide();
500+
} else {
501+
_$addBtn.show();
502+
}
500503
}
501504

502505
/**
@@ -773,13 +776,12 @@ define(function (require, exports, module) {
773776
_recomputeLayout = recomputeLayoutFn;
774777
_defaultPanelId = defaultPanelId;
775778

776-
// Create the "Tools" button outside the scrollable tabs area
777-
// so it's always visible even when tabs overflow.
779+
// Create the "Tools" button inside the scrollable tabs area.
778780
_$addBtn = $('<span class="bottom-panel-add-btn" title="' + Strings.BOTTOM_PANEL_DEFAULT_TITLE + '">'
779781
+ '<img class="app-drawer-tab-icon" src="styles/images/app-drawer.svg"'
780782
+ ' style="width:12px;height:12px;vertical-align:middle;margin-right:4px">'
781783
+ Strings.BOTTOM_PANEL_DEFAULT_TITLE + '</span>');
782-
_$tabBar.find(".bottom-panel-tab-bar-actions").before(_$addBtn);
784+
_$tabsOverflow.append(_$addBtn);
783785

784786
// Tab bar click handlers
785787
_$tabBar.on("click", ".bottom-panel-tab-close-btn", function (e) {

0 commit comments

Comments
 (0)