Skip to content

Commit bb54663

Browse files
committed
feat: restore the files/ai chips in sidebar
1 parent f35b7e0 commit bb54663

3 files changed

Lines changed: 88 additions & 24 deletions

File tree

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@
911911
</div>
912912
<div class="ccb-divider"></div>
913913
<div class="ccb-group">
914-
<a href="#" id="searchNav" class="ccb-btn"><i class="fa-solid fa-magnifying-glass"></i></a>
914+
<a href="#" id="searchNav" class="ccb-btn"><i class="fa-regular fa-magnifying-glass"></i></a>
915915
</div>
916916
<div class="ccb-spacer"></div>
917917
<div class="ccb-group ccb-group-bottom">

src/styles/CentralControlBar.less

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,6 @@
5353
flex: 1 1 auto;
5454
}
5555

56-
.claude-ai-icon {
57-
display: inline-block;
58-
width: 16px;
59-
height: 16px;
60-
background-color: currentColor;
61-
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M25.5 3c-.6-2.1-3.6-2.1-4.2 0L18.6 12a3 3 0 0 1-2 2L7.5 16.8c-2.1.6-2.1 3.6 0 4.2L16.6 24a3 3 0 0 1 2 2l2.7 9.1c.6 2.1 3.6 2.1 4.2 0L28.2 26a3 3 0 0 1 2-2l9.1-2.7c2.1-.6 2.1-3.6 0-4.2L30.2 14a3 3 0 0 1-2-2L25.5 3ZM40.3 30.5c-.3-1.2-2-1.2-2.4 0l-1 3.4a1.7 1.7 0 0 1-1.1 1.1l-3.4 1c-1.2.3-1.2 2 0 2.4l3.4 1c.5.2 1 .6 1.1 1.1l1 3.4c.3 1.2 2 1.2 2.4 0l1-3.4c.2-.5.6-1 1.1-1.1l3.4-1c1.2-.3 1.2-2 0-2.4l-3.4-1a1.7 1.7 0 0 1-1.1-1.1l-1-3.4Z'/%3E%3C/svg%3E");
62-
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M25.5 3c-.6-2.1-3.6-2.1-4.2 0L18.6 12a3 3 0 0 1-2 2L7.5 16.8c-2.1.6-2.1 3.6 0 4.2L16.6 24a3 3 0 0 1 2 2l2.7 9.1c.6 2.1 3.6 2.1 4.2 0L28.2 26a3 3 0 0 1 2-2l9.1-2.7c2.1-.6 2.1-3.6 0-4.2L30.2 14a3 3 0 0 1-2-2L25.5 3ZM40.3 30.5c-.3-1.2-2-1.2-2.4 0l-1 3.4a1.7 1.7 0 0 1-1.1 1.1l-3.4 1c-1.2.3-1.2 2 0 2.4l3.4 1c.5.2 1 .6 1.1 1.1l1 3.4c.3 1.2 2 1.2 2.4 0l1-3.4c.2-.5.6-1 1.1-1.1l3.4-1c1.2-.3 1.2-2 0-2.4l-3.4-1a1.7 1.7 0 0 1-1.1-1.1l-1-3.4Z'/%3E%3C/svg%3E");
63-
-webkit-mask-size: contain;
64-
mask-size: contain;
65-
-webkit-mask-repeat: no-repeat;
66-
mask-repeat: no-repeat;
67-
-webkit-mask-position: center;
68-
mask-position: center;
69-
}
70-
7156
/* Override legacy sprite styles that NavigationProvider applies */
7257
#searchNav {
7358
background: transparent !important;
@@ -136,3 +121,34 @@
136121
.ccb-editor-collapsed #sidebar {
137122
max-width: ~"calc(100vw - 230px)";
138123
}
124+
125+
/* Global tab icons — used in control bar tabs and sidebar chip bar */
126+
.files-icon {
127+
display: inline-block;
128+
width: 16px;
129+
height: 16px;
130+
background-color: currentColor;
131+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20640%20640%27%3E%3Cpath%20d%3D%27M304%20112L192%20112C183.2%20112%20176%20119.2%20176%20128L176%20512C176%20520.8%20183.2%20528%20192%20528L448%20528C456.8%20528%20464%20520.8%20464%20512L464%20272L376%20272C336.2%20272%20304%20239.8%20304%20200L304%20112zM444.1%20224L352%20131.9L352%20200C352%20213.3%20362.7%20224%20376%20224L444.1%20224zM128%20128C128%2092.7%20156.7%2064%20192%2064L325.5%2064C342.5%2064%20358.8%2070.7%20370.8%2082.7L493.3%20205.3C505.3%20217.3%20512%20233.6%20512%20250.6L512%20512C512%20547.3%20483.3%20576%20448%20576L192%20576C156.7%20576%20128%20547.3%20128%20512L128%20128z%27%2F%3E%3C%2Fsvg%3E");
132+
mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20640%20640%27%3E%3Cpath%20d%3D%27M304%20112L192%20112C183.2%20112%20176%20119.2%20176%20128L176%20512C176%20520.8%20183.2%20528%20192%20528L448%20528C456.8%20528%20464%20520.8%20464%20512L464%20272L376%20272C336.2%20272%20304%20239.8%20304%20200L304%20112zM444.1%20224L352%20131.9L352%20200C352%20213.3%20362.7%20224%20376%20224L444.1%20224zM128%20128C128%2092.7%20156.7%2064%20192%2064L325.5%2064C342.5%2064%20358.8%2070.7%20370.8%2082.7L493.3%20205.3C505.3%20217.3%20512%20233.6%20512%20250.6L512%20512C512%20547.3%20483.3%20576%20448%20576L192%20576C156.7%20576%20128%20547.3%20128%20512L128%20128z%27%2F%3E%3C%2Fsvg%3E");
133+
-webkit-mask-size: contain;
134+
mask-size: contain;
135+
-webkit-mask-repeat: no-repeat;
136+
mask-repeat: no-repeat;
137+
-webkit-mask-position: center;
138+
mask-position: center;
139+
}
140+
141+
.claude-ai-icon {
142+
display: inline-block;
143+
width: 16px;
144+
height: 16px;
145+
background-color: currentColor;
146+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20640%20640%27%3E%3Cpath%20d%3D%27M164.4%20404.5L265.1%20348L266.8%20343.1L265.1%20340.4L260.2%20340.4L243.4%20339.4L185.9%20337.8L136%20335.7L87.7%20333.1L75.5%20330.5L64.1%20315.5L65.3%20308L75.5%20301.1L90.2%20302.4C109.1%20303.7%20136.1%20305.5%20171.2%20308L206.4%20310.1L258.6%20315.5L266.9%20315.5L268.1%20312.1L265.3%20310L263.1%20307.9L212.8%20273.8L158.4%20237.8L129.9%20217.1L114.5%20206.6L106.7%20196.8L103.3%20175.3L117.3%20159.9L136.1%20161.2L140.9%20162.5L159.9%20177.2L200.6%20208.7L253.7%20247.8L261.5%20254.3L264.6%20252.1L265%20250.5L261.5%20244.7L232.6%20192.5L201.8%20139.4L188.1%20117.4L184.5%20104.2C183.2%2098.8%20182.3%2094.2%20182.3%2088.7L198.2%2067.1L207%2064.3L228.2%2067.1L237.1%2074.9L250.3%20105.1L271.7%20152.6L304.9%20217.2L314.6%20236.4L319.8%20254.2L321.7%20259.6L325.1%20259.6L325.1%20256.5L327.8%20220.1L332.8%20175.4L337.7%20117.9L339.4%20101.7L347.4%2082.3L363.3%2071.8L375.7%2077.7L385.9%2092.4L384.5%20101.9L378.4%20141.4L366.5%20203.3L358.7%20244.8L363.2%20244.8L368.4%20239.6L389.4%20211.8L424.6%20167.7L440.1%20150.2L458.2%20130.9L469.8%20121.7L491.8%20121.7L508%20145.8L500.7%20170.7L478%20199.4L459.2%20223.8L432.2%20260.1L415.4%20289.1L417%20291.4L421%20291L481.9%20278L514.8%20272.1L554.1%20265.4L571.9%20273.7L573.8%20282.1L566.8%20299.3L524.8%20309.7L475.6%20319.5L402.3%20336.8L401.4%20337.5L402.4%20338.8L435.4%20341.9L449.5%20342.7L484.1%20342.7L548.5%20347.5L565.3%20358.6L575.4%20372.2L573.7%20382.6L547.8%20395.8C532.3%20392.1%20493.4%20382.9%20431.2%20368.1L403.2%20361.1L399.3%20361.1L399.3%20363.4L422.6%20386.2L465.3%20424.8L518.8%20474.6L521.5%20486.9L514.6%20496.6L507.3%20495.6L460.3%20460.2L442.2%20444.3L401.1%20409.7L398.4%20409.7L398.4%20413.3L407.9%20427.2L457.9%20502.4L460.5%20525.4L456.9%20532.9L443.9%20537.4L429.7%20534.8L400.4%20493.7L370.2%20447.4L345.8%20405.9L342.8%20407.6L328.4%20562.4L321.7%20570.3L306.2%20576.2L293.2%20566.4L286.3%20550.5L293.2%20519L301.5%20477.9L308.2%20445.2L314.3%20404.6L317.9%20391.1L317.7%20390.2L314.7%20390.6L284.1%20432.6L237.6%20495.5L200.8%20534.9L192%20538.4L176.7%20530.5L178.1%20516.4L186.6%20503.8L237.5%20439L268.2%20398.8L288%20375.6L287.9%20372.2L286.7%20372.2L151.4%20460L127.3%20463.1L116.9%20453.4L118.2%20437.5L123.1%20432.3L163.8%20404.3L163.7%20404.4L163.7%20404.5z%27%2F%3E%3C%2Fsvg%3E");
147+
mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20640%20640%27%3E%3Cpath%20d%3D%27M164.4%20404.5L265.1%20348L266.8%20343.1L265.1%20340.4L260.2%20340.4L243.4%20339.4L185.9%20337.8L136%20335.7L87.7%20333.1L75.5%20330.5L64.1%20315.5L65.3%20308L75.5%20301.1L90.2%20302.4C109.1%20303.7%20136.1%20305.5%20171.2%20308L206.4%20310.1L258.6%20315.5L266.9%20315.5L268.1%20312.1L265.3%20310L263.1%20307.9L212.8%20273.8L158.4%20237.8L129.9%20217.1L114.5%20206.6L106.7%20196.8L103.3%20175.3L117.3%20159.9L136.1%20161.2L140.9%20162.5L159.9%20177.2L200.6%20208.7L253.7%20247.8L261.5%20254.3L264.6%20252.1L265%20250.5L261.5%20244.7L232.6%20192.5L201.8%20139.4L188.1%20117.4L184.5%20104.2C183.2%2098.8%20182.3%2094.2%20182.3%2088.7L198.2%2067.1L207%2064.3L228.2%2067.1L237.1%2074.9L250.3%20105.1L271.7%20152.6L304.9%20217.2L314.6%20236.4L319.8%20254.2L321.7%20259.6L325.1%20259.6L325.1%20256.5L327.8%20220.1L332.8%20175.4L337.7%20117.9L339.4%20101.7L347.4%2082.3L363.3%2071.8L375.7%2077.7L385.9%2092.4L384.5%20101.9L378.4%20141.4L366.5%20203.3L358.7%20244.8L363.2%20244.8L368.4%20239.6L389.4%20211.8L424.6%20167.7L440.1%20150.2L458.2%20130.9L469.8%20121.7L491.8%20121.7L508%20145.8L500.7%20170.7L478%20199.4L459.2%20223.8L432.2%20260.1L415.4%20289.1L417%20291.4L421%20291L481.9%20278L514.8%20272.1L554.1%20265.4L571.9%20273.7L573.8%20282.1L566.8%20299.3L524.8%20309.7L475.6%20319.5L402.3%20336.8L401.4%20337.5L402.4%20338.8L435.4%20341.9L449.5%20342.7L484.1%20342.7L548.5%20347.5L565.3%20358.6L575.4%20372.2L573.7%20382.6L547.8%20395.8C532.3%20392.1%20493.4%20382.9%20431.2%20368.1L403.2%20361.1L399.3%20361.1L399.3%20363.4L422.6%20386.2L465.3%20424.8L518.8%20474.6L521.5%20486.9L514.6%20496.6L507.3%20495.6L460.3%20460.2L442.2%20444.3L401.1%20409.7L398.4%20409.7L398.4%20413.3L407.9%20427.2L457.9%20502.4L460.5%20525.4L456.9%20532.9L443.9%20537.4L429.7%20534.8L400.4%20493.7L370.2%20447.4L345.8%20405.9L342.8%20407.6L328.4%20562.4L321.7%20570.3L306.2%20576.2L293.2%20566.4L286.3%20550.5L293.2%20519L301.5%20477.9L308.2%20445.2L314.3%20404.6L317.9%20391.1L317.7%20390.2L314.7%20390.6L284.1%20432.6L237.6%20495.5L200.8%20534.9L192%20538.4L176.7%20530.5L178.1%20516.4L186.6%20503.8L237.5%20439L268.2%20398.8L288%20375.6L287.9%20372.2L286.7%20372.2L151.4%20460L127.3%20463.1L116.9%20453.4L118.2%20437.5L123.1%20432.3L163.8%20404.3L163.7%20404.4L163.7%20404.5z%27%2F%3E%3C%2Fsvg%3E");
148+
-webkit-mask-size: contain;
149+
mask-size: contain;
150+
-webkit-mask-repeat: no-repeat;
151+
mask-repeat: no-repeat;
152+
-webkit-mask-position: center;
153+
mask-position: center;
154+
}

src/view/SidebarTabs.js

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ define(function (require, exports, module) {
8686
* @private */
8787
let $ccbTabGroup;
8888

89+
/** @type {jQuery}
90+
* @private */
91+
let $navTabBar;
92+
8993
/** @type {jQuery}
9094
* @private*/
9195
let $sidebar;
@@ -124,7 +128,7 @@ define(function (require, exports, module) {
124128

125129
// --- IDs to always exclude from visibility toggling ----------------------
126130

127-
const _EXCLUDED_IDS = { "mainNavBar": true };
131+
const _EXCLUDED_IDS = { "mainNavBar": true, "navTabBar": true };
128132

129133
/**
130134
* CSS classes that mark structural/resizer elements which must never be
@@ -163,15 +167,37 @@ define(function (require, exports, module) {
163167
$ccbTabGroup.empty();
164168
_tabs.sort(function (a, b) { return a.priority - b.priority; });
165169
_tabs.forEach(function (tab) {
170+
const iconMarkup = tab.iconHTML || '<i class="' + tab.iconClass + '"></i>';
166171
const $item = $('<a href="#" class="ccb-btn ccb-tab-btn" data-tab-id="' + tab.id + '" title="' + tab.label + '">' +
167-
'<i class="' + tab.iconClass + '"></i>' +
172+
iconMarkup +
168173
'</a>');
169174
if (tab.id === _activeTabId && $sidebar && $sidebar.is(":visible")) {
170175
$item.addClass("active");
171176
}
172177
tab.$tabItem = $item;
173178
$ccbTabGroup.append($item);
174179
});
180+
181+
// Also rebuild the sidebar chip bar
182+
if ($navTabBar) {
183+
$navTabBar.empty();
184+
_tabs.forEach(function (tab) {
185+
const iconMarkup = tab.iconHTML || '<i class="' + tab.iconClass + '"></i>';
186+
const $chip = $('<div class="sidebar-tab" data-tab-id="' + tab.id + '">' +
187+
iconMarkup +
188+
'<span>' + tab.label + '</span>' +
189+
'</div>');
190+
if (tab.id === _activeTabId) {
191+
$chip.addClass("active");
192+
}
193+
$navTabBar.append($chip);
194+
});
195+
if (_tabs.length >= 2) {
196+
$navTabBar.addClass("has-tabs");
197+
} else {
198+
$navTabBar.removeClass("has-tabs");
199+
}
200+
}
175201
}
176202

177203
/**
@@ -273,6 +299,7 @@ define(function (require, exports, module) {
273299
id: id,
274300
label: label,
275301
iconClass: iconClass,
302+
iconHTML: options.iconHTML || null,
276303
priority: options.priority !== undefined ? options.priority : 100,
277304
$tabItem: null
278305
};
@@ -432,6 +459,12 @@ define(function (require, exports, module) {
432459
}
433460
}
434461

462+
// Update active class on sidebar chip tabs
463+
if ($navTabBar) {
464+
$navTabBar.find(".sidebar-tab").removeClass("active");
465+
$navTabBar.find('.sidebar-tab[data-tab-id="' + id + '"]').addClass("active");
466+
}
467+
435468
_applyTabVisibility();
436469

437470
// One-time sidebar width bump when switching to a non-files tab
@@ -482,21 +515,28 @@ define(function (require, exports, module) {
482515
// --- Initialization ------------------------------------------------------
483516

484517
function _updateTabActiveStates() {
485-
if (!$ccbTabGroup) {
486-
return;
518+
if ($ccbTabGroup) {
519+
$ccbTabGroup.find(".ccb-tab-btn").removeClass("active");
520+
if ($sidebar && $sidebar.is(":visible")) {
521+
$ccbTabGroup.find('.ccb-tab-btn[data-tab-id="' + _activeTabId + '"]').addClass("active");
522+
}
487523
}
488-
$ccbTabGroup.find(".ccb-tab-btn").removeClass("active");
489-
if ($sidebar && $sidebar.is(":visible")) {
490-
$ccbTabGroup.find('.ccb-tab-btn[data-tab-id="' + _activeTabId + '"]').addClass("active");
524+
if ($navTabBar) {
525+
$navTabBar.find(".sidebar-tab").removeClass("active");
526+
$navTabBar.find('.sidebar-tab[data-tab-id="' + _activeTabId + '"]').addClass("active");
491527
}
492528
}
493529

494530
AppInit.htmlReady(function () {
495531
$sidebar = $("#sidebar");
496532
$ccbTabGroup = $("#ccbTabGroup");
497533

534+
// Create the sidebar chip tab bar and insert after #mainNavBar
535+
$navTabBar = $('<div id="navTabBar"></div>');
536+
$sidebar.find("#mainNavBar").after($navTabBar);
537+
498538
// Register the built-in Files tab
499-
addTab(SIDEBAR_TAB_FILES, "Files", "fa-solid fa-file", { priority: 0 });
539+
addTab(SIDEBAR_TAB_FILES, "Files", "", { priority: 0, iconHTML: '<span class="files-icon"></span>' });
500540

501541
// VSCode-style toggle: clicking the active tab hides sidebar,
502542
// clicking an inactive tab shows sidebar and switches to that tab.
@@ -523,6 +563,14 @@ define(function (require, exports, module) {
523563
}
524564
});
525565

566+
// Sidebar chip tab clicks just switch tabs (sidebar is already visible)
567+
$navTabBar.on("click", ".sidebar-tab", function () {
568+
const tabId = $(this).attr("data-tab-id");
569+
if (tabId) {
570+
setActiveTab(tabId);
571+
}
572+
});
573+
526574
// Update active states when sidebar is shown/hidden
527575
$sidebar.on("panelCollapsed.sidebarTabs", function () {
528576
_updateTabActiveStates();

0 commit comments

Comments
 (0)