Skip to content

Commit c99c16b

Browse files
committed
feat: move control bar to the left side
1 parent 4401efa commit c99c16b

11 files changed

Lines changed: 152 additions & 220 deletions

File tree

src/extensionsIntegrated/NavigationAndHistory/NavigationProvider.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ define(function (require, exports, module) {
5252
let $navback = null,
5353
$navForward = null,
5454
$searchNav = null,
55-
$newProject = null,
56-
$showInTree = null;
55+
$newProject = null;
5756

5857
/**
5958
* Contains list of most recently known cursor positions.
@@ -712,11 +711,6 @@ define(function (require, exports, module) {
712711
MainViewManager.focusActivePane();
713712
}
714713

715-
function _showInFileTreeClicked() {
716-
Metrics.countEvent(Metrics.EVENT_TYPE.UI, "fileNavBar", "showInFileTree");
717-
CommandManager.execute(Commands.NAVIGATE_SHOW_IN_FILE_TREE);
718-
}
719-
720714
function _findInFiles() {
721715
Metrics.countEvent(Metrics.EVENT_TYPE.UI, "fileNavBar", "search");
722716
CommandManager.execute(Commands.CMD_FIND_IN_FILES);
@@ -738,15 +732,13 @@ define(function (require, exports, module) {
738732
function updateTooltips() {
739733
$navback.attr("title", _getShortcutDisplay(Strings.CMD_NAVIGATE_BACKWARD, NAVIGATION_JUMP_BACK));
740734
$navForward.attr("title", _getShortcutDisplay(Strings.CMD_NAVIGATE_FORWARD, NAVIGATION_JUMP_FWD));
741-
$showInTree.attr("title", _getShortcutDisplay(Strings.CMD_SHOW_IN_TREE, Commands.NAVIGATE_SHOW_IN_FILE_TREE));
742735
$searchNav.attr("title", _getShortcutDisplay(Strings.CMD_FIND_IN_FILES, Commands.CMD_FIND_IN_FILES));
743736
// new project extension is not yet loaded, so we cant show keyboard shortcut here.
744737
$newProject.attr("title", Strings.CMD_PROJECT_NEW);
745738
}
746739

747740
function _setupNavigationButtons() {
748741
let $mainNavBarLeft = $("#mainNavBarLeft");
749-
$showInTree = $("#showInfileTree");
750742
$navback = $("#navBackButton");
751743
$navForward = $("#navForwardButton");
752744
$searchNav = $("#searchNav");
@@ -755,14 +747,12 @@ define(function (require, exports, module) {
755747
updateTooltips();
756748
CommandManager.get(NAVIGATION_JUMP_BACK).on(KeyBindingManager.EVENT_KEY_BINDING_ADDED, updateTooltips);
757749
CommandManager.get(NAVIGATION_JUMP_FWD).on(KeyBindingManager.EVENT_KEY_BINDING_ADDED, updateTooltips);
758-
CommandManager.get(Commands.NAVIGATE_SHOW_IN_FILE_TREE).on(KeyBindingManager.EVENT_KEY_BINDING_ADDED, updateTooltips);
759750
CommandManager.get(Commands.CMD_FIND_IN_FILES).on(KeyBindingManager.EVENT_KEY_BINDING_ADDED, updateTooltips);
760751

761752
$navback.on("click", _navigateBackClicked);
762753
$navForward.on("click", _navigateForwardClicked);
763754
$("#navBackButton").contextmenu(_navigateBackClicked);
764755
$("#navForwardButton").contextmenu(_navigateForwardClicked);
765-
$showInTree.on("click", _showInFileTreeClicked);
766756
$searchNav.on("click", _findInFiles);
767757
$newProject.on("click", _newProjectClicked);
768758
}

src/index.html

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,23 @@
905905
<div class="main-view forced-hidden">
906906
<div id="notificationUIDefaultAnchor" href="#">
907907
</div>
908-
<div id="sidebar" class="sidebar panel quiet-scrollbars horz-resizable right-resizer collapsible" data-minsize="0" data-maxsize="80%" data-forceleft=".content">
908+
<!-- Vertical control bar docked to the left edge -->
909+
<div id="centralControlBar" class="no-focus">
910+
<div id="ccbTabGroup" class="ccb-group">
911+
</div>
912+
<div class="ccb-divider"></div>
913+
<div class="ccb-group">
914+
<a href="#" id="searchNav" class="ccb-btn"><i class="fa-solid fa-magnifying-glass"></i></a>
915+
</div>
916+
<div class="ccb-spacer"></div>
917+
<div class="ccb-group ccb-group-bottom">
918+
<a href="#" id="ccbCollapseEditorBtn" class="ccb-btn" title="Switch to Design Mode">
919+
<i class="fa-solid fa-code"></i>
920+
</a>
921+
</div>
922+
</div>
923+
924+
<div id="sidebar" class="sidebar panel quiet-scrollbars horz-resizable right-resizer collapsible" data-minsize="30" data-maxsize="80%" data-forceleft=".content">
909925
<div id="mainNavBar">
910926
<div id="mainNavBarLeft">
911927
<div id="newProject" class="new-project-btn btn-alt-quiet"></div>
@@ -914,6 +930,8 @@
914930
<a id="phcode-io-main-nav" href="https://phcode.io" target="_blank" rel="noopener">phcode.io</a>
915931
</div>
916932
<div id="mainNavBarRight">
933+
<div id="navBackButton" class="nav-back-btn btn-alt-quiet"></div>
934+
<div id="navForwardButton" class="nav-forward-btn btn-alt-quiet"></div>
917935
<div class="working-set-splitview-btn btn-alt-quiet"></div>
918936
</div>
919937
</div>
@@ -933,46 +951,6 @@
933951
</div>
934952
</div>
935953

936-
<!-- Vertical control bar between sidebar and editor content -->
937-
<div id="centralControlBar" class="no-focus">
938-
<div class="ccb-group ccb-group-top">
939-
<a href="#" id="ccbCollapseEditorBtn" class="ccb-btn" title="Switch to Design Mode">
940-
<svg class="ccb-pen-nib-icon" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
941-
<path d="M19.8301 13.3181L19.8253 13.2941L17.7493 6.36938C17.461 5.41309 16.7305 4.65382 15.7791 4.33666L3.07815 0.0790007C2.66007 -0.0603584 2.20355 -0.0123035 1.82872 0.199138L9.29645 7.66686C9.48867 7.614 9.68569 7.58998 9.89233 7.58998C11.1658 7.58998 12.199 8.62316 12.199 9.89661C12.199 11.1701 11.1658 12.2032 9.89233 12.2032C8.61888 12.2032 7.5857 11.1701 7.5857 9.89661C7.5857 9.68997 7.61453 9.48814 7.66258 9.30073L0.199661 1.833C-0.0117809 2.20783 -0.0598357 2.65955 0.0795234 3.08243L4.33718 15.7833C4.65435 16.73 5.41362 17.4653 6.36991 17.7536L13.2946 19.8295L13.3186 19.8344L19.8301 13.3229V13.3181Z" fill="currentColor"/>
942-
<line x1="14.1513" y1="20.5938" x2="20.5906" y2="14.1064" stroke="currentColor" stroke-width="1.15332"/>
943-
</svg>
944-
</a>
945-
<a href="#" id="ccbSidebarToggleBtn" class="ccb-btn" title="Toggle sidebar">
946-
<i class="fa-solid fa-angles-left"></i>
947-
</a>
948-
</div>
949-
<div class="ccb-divider"></div>
950-
<div class="ccb-group ccb-group-edit">
951-
<a href="#" id="ccbUndoBtn" class="ccb-btn" title="Undo">
952-
<svg class="ccb-edit-icon" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
953-
<path fill="currentColor" d="M8.9502 2.33398L6.49219 4.79395L6.18945 5.0957H6.61719L11.4883 5.09766C14.2134 5.09841 15.5922 5.10134 16.4404 5.18164C16.8608 5.22144 17.1435 5.27977 17.3906 5.36328C17.6394 5.44739 17.8593 5.55885 18.1582 5.71582V5.7168C19.3778 6.35739 20.3334 7.45815 20.8584 8.83691C20.9639 9.11405 21.0196 9.29347 21.0508 9.5332C21.0828 9.77961 21.0898 10.094 21.0898 10.6416C21.0898 11.1889 21.0828 11.5027 21.0508 11.749C21.0274 11.929 20.9903 12.0752 20.9287 12.2539L20.8584 12.4463C20.5052 13.3739 20.0723 14.0292 19.3896 14.6748C18.9323 15.1075 18.3356 15.4867 17.7188 15.7578C17.1008 16.0294 16.4754 16.1874 15.9609 16.1875H15.7314V13.2285H15.8633C16.0644 13.2272 16.3978 13.1398 16.6211 13.0381C18.6414 12.1171 18.7461 9.33015 16.7764 8.33105L16.2627 8.07129L16.2256 8.05176H6.18945L6.49219 8.35449L8.9502 10.8145L11.1055 12.9707H6.68848L3.43262 9.71484L0.25 6.53125L3.43262 3.39648L6.6875 0.186523L9.0752 0.182617L11.1055 0.177734L8.9502 2.33398Z"/>
954-
</svg>
955-
</a>
956-
<a href="#" id="ccbRedoBtn" class="ccb-btn" title="Redo">
957-
<svg class="ccb-edit-icon" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
958-
<path fill="currentColor" d="M12.3164 2.33398L14.7744 4.79395L15.0771 5.0957H14.6494L9.77832 5.09766C7.05319 5.09841 5.67443 5.10134 4.82617 5.18164C4.40582 5.22144 4.12312 5.27977 3.87598 5.36328C3.62717 5.44739 3.40726 5.55885 3.1084 5.71582V5.7168C1.88885 6.35739 0.933211 7.45815 0.408203 8.83691C0.302675 9.11405 0.247023 9.29347 0.21582 9.5332C0.183785 9.77961 0.176758 10.094 0.176758 10.6416C0.176759 11.1889 0.183829 11.5027 0.21582 11.749C0.239218 11.929 0.276306 12.0752 0.337891 12.2539L0.408203 12.4463C0.761384 13.3739 1.19432 14.0292 1.87695 14.6748C2.33434 15.1075 2.93102 15.4867 3.54785 15.7578C4.16581 16.0294 4.79116 16.1874 5.30566 16.1875H5.53516V13.2285H5.40332C5.20224 13.2272 4.86878 13.1398 4.64551 13.0381C2.62518 12.1171 2.52048 9.33015 4.49023 8.33105L5.00391 8.07129L5.04102 8.05176H15.0771L14.7744 8.35449L12.3164 10.8145L10.1611 12.9707H14.5781L17.834 9.71484L21.0166 6.53125L17.834 3.39648L14.5791 0.186523L12.1914 0.182617L10.1611 0.177734L12.3164 2.33398Z"/>
959-
</svg>
960-
</a>
961-
</div>
962-
<div class="ccb-divider"></div>
963-
<div class="ccb-group ccb-group-save">
964-
<a href="#" id="ccbSaveBtn" class="ccb-btn" title="Save">
965-
<i class="fa-solid fa-floppy-disk"></i>
966-
</a>
967-
</div>
968-
<div class="ccb-divider"></div>
969-
<div class="ccb-group ccb-group-nav">
970-
<a href="#" id="searchNav" class="ccb-btn"><i class="fa-solid fa-magnifying-glass"></i></a>
971-
<a href="#" id="navBackButton" class="ccb-btn"><i class="fa-solid fa-arrow-left"></i></a>
972-
<a href="#" id="navForwardButton" class="ccb-btn"><i class="fa-solid fa-arrow-right"></i></a>
973-
</div>
974-
</div>
975-
976954
<!--
977955
Vertical stack of titlebar (in-browser), editor, bottom panels, status bar
978956
(status bar is injected later - see StatusBar.init()).

src/project/SidebarView.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ define(function (require, exports, module) {
339339
}
340340
width = Math.round(width);
341341
$sidebar.width(width);
342-
$(".content").css("left", width);
342+
const sidebarLeft = parseInt($sidebar.css("left"), 10) || 0;
343+
$(".content").css("left", sidebarLeft + width);
343344
Resizer.resyncSizer($sidebar);
344345
var sidebarPrefs = PreferencesManager.getViewState("sidebar") || {};
345346
sidebarPrefs.size = width;

src/styles/CentralControlBar.less

Lines changed: 40 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,22 @@
1818
*
1919
*/
2020

21-
/* Central vertical control bar between sidebar and editor content */
22-
23-
@central-control-bar-width: 30px;
21+
/* Vertical control bar docked to the left edge of the window */
2422

2523
#centralControlBar {
2624
position: absolute;
2725
top: 0;
26+
left: 0;
2827
height: 100%;
2928
width: @central-control-bar-width;
30-
left: @sidebar-width; /* updated dynamically when sidebar resizes */
31-
z-index: @z-index-brackets-main-content + 1;
29+
z-index: @z-index-brackets-main-toolbar;
3230
display: flex;
3331
flex-direction: column;
3432
align-items: stretch;
3533
padding: 4px 0;
3634
box-sizing: border-box;
3735
user-select: none;
38-
/* Phoenix's sidebar uses a fixed dark panel color (#252525) in both
39-
light and dark themes. Use a slightly darker fixed tone here so the
40-
control bar reads as a distinct surface next to the sidebar while
41-
still staying on-theme in light mode. */
42-
background-color: #222;
36+
background-color: @main-toolbar-background-color;
4337
border-right: 1px solid rgba(0, 0, 0, 0.45);
4438

4539
.ccb-group {
@@ -55,7 +49,35 @@
5549
background-color: rgba(255, 255, 255, 0.06);
5650
}
5751

58-
/* New-style buttons (icons with FA) */
52+
.ccb-spacer {
53+
flex: 1 1 auto;
54+
}
55+
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+
71+
/* Override legacy sprite styles that NavigationProvider applies */
72+
#searchNav {
73+
background: transparent !important;
74+
top: auto !important;
75+
padding: 0 !important;
76+
width: auto !important;
77+
height: 28px !important;
78+
content: normal !important;
79+
}
80+
5981
.ccb-btn {
6082
display: flex;
6183
align-items: center;
@@ -73,12 +95,6 @@
7395
pointer-events: none;
7496
}
7597

76-
svg.ccb-edit-icon {
77-
width: 15px;
78-
height: 11px;
79-
pointer-events: none;
80-
}
81-
8298
&:hover {
8399
color: @project-panel-text-1;
84100
background-color: rgba(255, 255, 255, 0.08);
@@ -89,62 +105,24 @@
89105
background-color: rgba(255, 255, 255, 0.12);
90106
}
91107

108+
&.active {
109+
color: @project-panel-text-1;
110+
background-color: rgba(255, 255, 255, 0.12);
111+
}
112+
92113
&.disabled,
93114
&[aria-disabled="true"] {
94115
opacity: 0.4;
95116
pointer-events: none;
96117
}
97118
}
98-
99-
/* Nudge the collapse-editor icon up so it visually aligns with titlebar icons */
100-
#ccbCollapseEditorBtn {
101-
margin-top: -2px;
102-
103-
svg {
104-
width: 15px;
105-
height: 15px;
106-
pointer-events: none;
107-
}
108-
}
109-
110-
/* Nav buttons: suppress legacy sprite styles (NavigationProvider toggles enabled/disabled class) */
111-
#searchNav,
112-
#navBackButton,
113-
#navForwardButton {
114-
background: transparent !important;
115-
top: auto !important;
116-
padding: 0 !important;
117-
width: auto !important;
118-
height: 28px !important;
119-
content: normal !important;
120-
opacity: 1;
121-
}
122-
123-
#navBackButton.nav-back-btn-disabled,
124-
#navForwardButton.nav-forward-btn-disabled {
125-
opacity: 0.35;
126-
pointer-events: none;
127-
}
128-
129119
}
130120

131121
/* Editor collapse: actual layout handled in JS via .content width/visibility */
132122
.ccb-editor-collapsed .content {
133123
overflow: hidden;
134124
}
135125

136-
/* Visually move the sidebar's right-resizer to the right edge of the central
137-
control bar, so the drag handle sits between the control bar and the editor
138-
/ live-preview area. The Resizer keeps the handle at `left: sidebar.width`
139-
internally (and keeps bumping it back after reposition), so a transform is
140-
used here instead of overriding `left`. Hit-testing follows the transform.
141-
When the sidebar is hidden the Resizer moves the handle out to become a
142-
sibling of #sidebar inside .main-view — apply the same shift there. */
143-
#sidebar > .horz-resizer,
144-
.main-view > .horz-resizer {
145-
transform: translateX(@central-control-bar-width);
146-
}
147-
148126
/* In design mode the sidebar resizer doubles as the sidebar↔live-preview
149127
splitter — hide the main-toolbar's own left-resizer so there aren't two
150128
overlapping handles in the same region. */
@@ -153,12 +131,8 @@
153131
}
154132

155133
/* Cap the sidebar in design mode so the live-preview panel always keeps at
156-
least ~200px of its own. A percentage of the viewport (e.g. 70vw) became
157-
too wide on large screens — the live preview would shrink to a useless
158-
sliver. Enforcing this via CSS max-width stops the drag itself rather than
159-
snapping back after the Resizer has already written a larger value, which
160-
also avoids ResizeObserver loop warnings from rapid width writes. The
161-
230px accounts for the 30px control bar plus a 200px LP minimum. */
134+
least ~200px of its own. The 230px accounts for the 30px control bar
135+
plus a 200px LP minimum. */
162136
.ccb-editor-collapsed #sidebar {
163137
max-width: ~"calc(100vw - 230px)";
164138
}

src/styles/Extn-CollapseFolders.less

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,23 @@
1515

1616
#collapse-folders {
1717
flex-direction: column;
18-
right: 0;
18+
right: 2px;
19+
padding: 0.27em 0.6em 0.15em 0.6em;
1920

2021
.collapse-icon {
21-
font-size: 0.5em;
22+
font-size: 0.55em;
2223
line-height: 1;
2324
}
2425
}
2526

2627
#show-in-file-tree {
2728
// Sit to the left of #collapse-folders.
28-
right: 24px;
29+
right: 32px;
30+
padding: 0.3em 0.5em;
2931

3032
.show-in-tree-icon {
31-
// Sized to match the combined stacked-chevron glyph of #collapse-folders.
32-
width: 11px;
33-
height: 11px;
33+
width: 14px;
34+
height: 14px;
3435
pointer-events: none;
3536
}
3637
}

src/styles/brackets.less

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ a, img {
259259

260260
.sidebar {
261261
.vbox;
262-
left: 0;
262+
left: @central-control-bar-width;
263263
width: @sidebar-width; // changed dynamically via Resizer
264264
white-space: nowrap;
265265
}
266266

267267
.content {
268268
padding: 0;
269-
left: (@sidebar-width + 30px); // changed dynamically via Resizer + CentralControlBar
269+
left: (@central-control-bar-width + @sidebar-width); // changed dynamically via Resizer
270270
right: @main-toolbar-width;
271271
z-index: @z-index-brackets-main-content;
272272
border-left: 2px solid rgba(255, 255, 255, 0.10);
@@ -1285,16 +1285,6 @@ a, img {
12851285
z-index: 1;
12861286
}
12871287

1288-
.show-in-file-tree-btn {
1289-
top: 7px;
1290-
padding: 4px 6px;
1291-
.sprite-icon(0, 0, 13px, 13px, "images/sprites.svg#binoculars");
1292-
background-position: center;
1293-
background-size: cover;
1294-
opacity: 0.8;
1295-
z-index: 1;
1296-
}
1297-
12981288
.nav-back-btn {
12991289
top: 7px;
13001290
padding: 4px 6px;

src/styles/brackets_variables.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
@inline-triangle-size: 9px;
4747

4848
/* Main layout */
49+
@central-control-bar-width: 30px;
4950
@sidebar-width: 270px; // user resizable, however
5051
@main-toolbar-width: 30px;
5152

0 commit comments

Comments
 (0)