Skip to content

Commit 4caee5a

Browse files
committed
feat: tabs support in main sidebar
1 parent d71c0aa commit 4caee5a

5 files changed

Lines changed: 635 additions & 0 deletions

File tree

src/brackets.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ define(function (require, exports, module) {
126126
require("search/QuickOpenHelper");
127127
require("file/FileUtils");
128128
require("project/SidebarView");
129+
require("view/SidebarTabs");
130+
require("core-ai/main");
129131
require("utils/Resizer");
130132
require("LiveDevelopment/main");
131133
require("utils/NodeConnection");

src/core-ai/main.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* GNU AGPL-3.0 License
3+
*
4+
* Copyright (c) 2021 - present core.ai . All rights reserved.
5+
*
6+
* This program is free software: you can redistribute it and/or modify it
7+
* under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
14+
* for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with this program. If not, see https://opensource.org/licenses/AGPL-3.0.
18+
*
19+
*/
20+
21+
/**
22+
* Registers a placeholder AI sidebar tab. This serves as a starting point for
23+
* AI assistant integration. The tab displays a placeholder message until an AI
24+
* provider extension is installed.
25+
*/
26+
define(function (require, exports, module) {
27+
28+
var AppInit = require("utils/AppInit"),
29+
SidebarTabs = require("view/SidebarTabs");
30+
31+
AppInit.appReady(function () {
32+
SidebarTabs.addTab("ai", "AI", "fa-solid fa-wand-magic-sparkles", { priority: 200 });
33+
34+
var $content = $(
35+
'<div class="ai-tab-placeholder">' +
36+
'<div class="ai-tab-icon"><i class="fa-solid fa-wand-magic-sparkles"></i></div>' +
37+
'<div class="ai-tab-title">AI Assistant</div>' +
38+
'<div class="ai-tab-message">Please add an AI provider to start using AI</div>' +
39+
'</div>'
40+
);
41+
42+
SidebarTabs.addToTab("ai", $content);
43+
});
44+
});

src/styles/Extn-SidebarTabs.less

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*
2+
* GNU AGPL-3.0 License
3+
*
4+
* Copyright (c) 2021 - present core.ai . All rights reserved.
5+
*
6+
* This program is free software: you can redistribute it and/or modify it
7+
* under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
14+
* for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with this program. If not, see https://opensource.org/licenses/AGPL-3.0.
18+
*
19+
*/
20+
21+
/* Sidebar tab bar — switches between tab panes within #sidebar */
22+
23+
#navTabBar {
24+
display: none;
25+
align-items: center;
26+
background-color: @bc-sidebar-bg;
27+
height: 2rem;
28+
overflow: hidden;
29+
user-select: none;
30+
31+
&.has-tabs {
32+
display: flex;
33+
}
34+
}
35+
36+
.sidebar-tab {
37+
display: inline-flex;
38+
align-items: center;
39+
gap: 0.35rem;
40+
padding: 0 0.75rem;
41+
height: 100%;
42+
cursor: pointer;
43+
position: relative;
44+
color: @project-panel-text-2;
45+
font-size: 0.8rem;
46+
letter-spacing: 0.3px;
47+
transition: color 0.15s ease, background-color 0.15s ease;
48+
49+
i {
50+
font-size: 0.75rem;
51+
}
52+
53+
&:hover {
54+
color: @project-panel-text-1;
55+
background-color: rgba(255, 255, 255, 0.06);
56+
}
57+
58+
&.active {
59+
color: @project-panel-text-1;
60+
61+
&::after {
62+
content: "";
63+
position: absolute;
64+
bottom: 0;
65+
left: 0;
66+
right: 0;
67+
height: 2px;
68+
background-color: @project-panel-text-2;
69+
}
70+
}
71+
}
72+
73+
/* Hide sidebar children not belonging to the active tab */
74+
.sidebar-tab-hidden {
75+
display: none !important;
76+
}
77+
78+
/* AI tab placeholder content */
79+
.ai-tab-placeholder {
80+
display: flex;
81+
flex-direction: column;
82+
align-items: center;
83+
justify-content: center;
84+
.box-flex(1);
85+
flex: 1;
86+
color: @project-panel-text-2;
87+
padding: 2rem;
88+
text-align: center;
89+
min-height: 0;
90+
height: 100%;
91+
92+
.ai-tab-icon {
93+
font-size: 2.5rem;
94+
margin-bottom: 1rem;
95+
opacity: 0.6;
96+
}
97+
98+
.ai-tab-title {
99+
font-size: 1rem;
100+
font-weight: 600;
101+
color: @project-panel-text-1;
102+
margin-bottom: 0.5rem;
103+
}
104+
105+
.ai-tab-message {
106+
font-size: 0.8rem;
107+
line-height: 1.4;
108+
opacity: 0.7;
109+
}
110+
}

src/styles/brackets.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
@import "Extn-CSSColorPreview.less";
4747
@import "Extn-CustomSnippets.less";
4848
@import "Extn-CollapseFolders.less";
49+
@import "Extn-SidebarTabs.less";
4950
@import "UserProfile.less";
5051
@import "phoenix-pro.less";
5152

0 commit comments

Comments
 (0)