feat: more work on UI cleanup
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -537,8 +537,33 @@ button {
|
||||
|
||||
.tab-close {
|
||||
margin-left: auto;
|
||||
font-size: 11px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 15px;
|
||||
line-height: 1;
|
||||
color: var(--vscode-descriptionForeground);
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tab-close:hover {
|
||||
background-color: var(--vscode-toolbar-hoverBackground);
|
||||
color: var(--vscode-tab-activeForeground);
|
||||
}
|
||||
|
||||
.output-item-details {
|
||||
margin: 4px 0 0;
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
color: inherit;
|
||||
font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||
white-space: pre-wrap;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.editor-shell {
|
||||
@@ -936,16 +961,31 @@ button {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.panel-tabs {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.panel-tab {
|
||||
padding: 8px 10px;
|
||||
border-radius: 999px;
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
border: none;
|
||||
padding: 6px 12px;
|
||||
font-size: 12px;
|
||||
color: var(--vscode-tab-inactiveForeground);
|
||||
cursor: pointer;
|
||||
border-bottom: 2px solid transparent;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.panel-tab:hover {
|
||||
color: var(--vscode-tab-activeForeground);
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.panel-tab.active {
|
||||
background: var(--accent-soft);
|
||||
color: var(--ink);
|
||||
color: var(--vscode-tab-activeForeground);
|
||||
border-bottom-color: var(--vscode-focusBorder);
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.assistant-content {
|
||||
@@ -956,29 +996,42 @@ button {
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
height: 34px;
|
||||
height: 22px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 0 12px;
|
||||
background: var(--status);
|
||||
border-top: 1px solid var(--line);
|
||||
background-color: var(--vscode-statusBar-background);
|
||||
color: var(--vscode-statusBar-foreground);
|
||||
font-size: 12px;
|
||||
padding: 0 8px;
|
||||
user-select: none;
|
||||
flex-wrap: nowrap;
|
||||
gap: 0;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.status-bar-left,
|
||||
.status-bar-right {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
flex-shrink: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.status-bar-item {
|
||||
max-width: 180px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
font-size: 11px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 0 8px;
|
||||
height: 100%;
|
||||
max-width: none;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
|
||||
@@ -64,7 +64,7 @@ function renderTitlebar() {
|
||||
<span class="window-titlebar-panel-pane"></span>
|
||||
</span>
|
||||
`)}
|
||||
${renderTitlebarAction("toggle-assistant", "toggle-assistant", "Toggle assistant", `
|
||||
${renderTitlebarAction("toggle-assistant-sidebar", "toggle-assistant", "Toggle assistant", `
|
||||
<span class="window-titlebar-assistant-icon ${state.session.assistant_sidebar_visible ? "is-active" : "is-inactive"}">
|
||||
<span class="window-titlebar-assistant-pane"></span>
|
||||
</span>
|
||||
@@ -184,7 +184,7 @@ function renderTab(tab) {
|
||||
<button class="tab ${active ? "active" : ""} ${tab.is_transient ? "transient" : ""}" data-tab-type="${tab.type}" data-tab-id="${tab.id}" type="button">
|
||||
<span class="tab-icon">${tabIcon(tab.type)}</span>
|
||||
<span class="tab-title">${escapeHtml(meta.title)}</span>
|
||||
<span class="tab-close" aria-hidden="true">${tab.is_transient ? "Preview" : "Pinned"}</span>
|
||||
<span class="tab-close" data-close-tab="${tab.type}:${tab.id}" role="button" aria-label="Close ${escapeHtmlAttribute(meta.title)}" title="Close tab">×</span>
|
||||
</button>
|
||||
`;
|
||||
}
|
||||
@@ -419,11 +419,13 @@ function applyVisibility() {
|
||||
}
|
||||
|
||||
function bindEvents() {
|
||||
root.querySelectorAll("[data-command]").forEach((button) => {
|
||||
root.querySelectorAll("button[data-command]").forEach((button) => {
|
||||
button.onclick = () => {
|
||||
const command = button.dataset.command;
|
||||
if (command === "open-tasks-panel") {
|
||||
openTasksPanel();
|
||||
render();
|
||||
return;
|
||||
}
|
||||
if (command === "toggle-offline-mode") {
|
||||
executeShellCommand("toggle_offline_mode");
|
||||
@@ -471,6 +473,15 @@ function bindEvents() {
|
||||
};
|
||||
});
|
||||
|
||||
root.querySelectorAll("[data-close-tab]").forEach((button) => {
|
||||
button.onclick = (event) => {
|
||||
event.stopPropagation();
|
||||
const [type, id] = button.dataset.closeTab.split(":");
|
||||
closeSpecificTab(type, id);
|
||||
render();
|
||||
};
|
||||
});
|
||||
|
||||
root.querySelectorAll("[data-panel-tab]").forEach((button) => {
|
||||
button.onclick = () => {
|
||||
state.session.panel.active_tab = button.dataset.panelTab;
|
||||
@@ -790,6 +801,30 @@ function closeActiveTab() {
|
||||
}
|
||||
}
|
||||
|
||||
function closeSpecificTab(type, id) {
|
||||
const index = state.session.tabs.findIndex((tab) => tab.type === type && tab.id === id);
|
||||
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const wasActive = state.session.active_tab?.type === type && state.session.active_tab?.id === id;
|
||||
state.session.tabs.splice(index, 1);
|
||||
delete state.tabMeta[`${type}:${id}`];
|
||||
|
||||
if (!state.session.tabs.length) {
|
||||
state.session.active_tab = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wasActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
const next = state.session.tabs[Math.min(index, state.session.tabs.length - 1)];
|
||||
state.session.active_tab = { type: next.type, id: next.id };
|
||||
}
|
||||
|
||||
function openTab(type, id, title, transient, meta = {}) {
|
||||
const existingIndex = state.session.tabs.findIndex((tab) => tab.type === type && tab.id === id);
|
||||
|
||||
@@ -1187,7 +1222,7 @@ function renderLanguageOptions() {
|
||||
return state.supportedUiLanguages
|
||||
.map((language) => {
|
||||
const selected = language.code === state.uiLanguage ? " selected" : "";
|
||||
return `<option value="${escapeHtmlAttribute(language.code)}"${selected}>${escapeHtml(language.code.toUpperCase())}</option>`;
|
||||
return `<option value="${escapeHtmlAttribute(language.code)}"${selected}>${escapeHtml(language.flag || language.code.toUpperCase())}</option>`;
|
||||
})
|
||||
.join("");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user