Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(tabs): align side tab connection colors

二丫讲梵9c069c9cfeff
diff --git a/apps/desktop/src/components/layout/EditorGroupTabBar.vue b/apps/desktop/src/components/layout/EditorGroupTabBar.vue
index 514982348b..2829614f75 100644
--- a/apps/desktop/src/components/layout/EditorGroupTabBar.vue
+++ b/apps/desktop/src/components/layout/EditorGroupTabBar.vue
@@ -176,7 +176,9 @@ function specialPageTabClass(active: boolean): string[] {
function specialPageTabStyle(active: boolean) {
if (!active) return undefined;
- if (isVerticalLayout.value) return { "--app-tab-background": "var(--accent)" };
+ // Vertical active pills take the neutral wash from appTabBar.css; an inline
+ // --app-tab-background here would repaint the special pages in solid accent.
+ if (isVerticalLayout.value) return undefined;
if (!isClassicLayout.value) return { "--app-tab-background": appTabActiveBackground(), borderColor: "var(--ring)" };
return { "--app-tab-background": appTabActiveBackground(), boxShadow: appTabActiveIndicator() };
}
@@ -1071,14 +1073,23 @@ const stripSections = computed(() => {
});
function tabColorStyle(tab: QueryTab): CSSProperties | undefined {
- // Sidebar tabs carry their group/connection color as a soft active wash;
- // the active indicator itself comes from the vertical CSS rules.
+ // Keep ungrouped sidebar tabs aligned with the horizontal tab strip: every
+ // tab gets a connection-colored wash, while the active tab gets the stronger
+ // border and leading accent.
if (isVerticalLayout.value) {
- if (!isTabActive(tab)) {
- return undefined;
- }
- const color = settingsStore.editorSettings.colorizeConnectionTabs ? tabConnectionColor(tab.connectionId) : "";
- return { "--app-tab-background": color ? hexToRgba(color, 0.12) : "var(--accent)" } as CSSProperties;
+ if (settingsStore.editorSettings.tabGroupMode !== "none" || !settingsStore.editorSettings.colorizeConnectionTabs) return undefined;
+ const active = isTabActive(tab);
+ const color = tabConnectionColor(tab.connectionId);
+ return {
+ "--app-tab-background": hexToRgba(color, active ? 0.24 : 0.09),
+ "--app-tab-hover-background": hexToRgba(color, 0.16),
+ ...(active
+ ? {
+ "--app-tab-active-border": hexToRgba(color, 0.72),
+ "--app-tab-active-accent": color,
+ }
+ : { borderColor: hexToRgba(color, 0.18) }),
+ } as CSSProperties;
}
return sharedTabColorStyle(tab, isTabActive(tab), isClassicLayout.value);
}
diff --git a/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.groups.spec.ts b/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.groups.spec.ts
index 60167ddbac..8ab0c397c0 100644
--- a/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.groups.spec.ts
+++ b/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.groups.spec.ts
@@ -219,6 +219,70 @@ describe("EditorGroupTabBar group behavior", () => {
host.remove();
});
+ it.each(["left", "right"] as const)("applies the connection color to the active %s side tab", async (placement) => {
+ const store = useQueryStore();
+ const settings = useSettingsStore();
+ const connections = useConnectionStore();
+ connections.connections = [
+ { id: "pg-1", name: "Postgres", db_type: "postgres", color: "#22c55e" },
+ { id: "mysql-1", name: "MySQL", db_type: "mysql", color: "#3b82f6" },
+ ] as ConnectionConfig[];
+ settings.editorSettings.tabPlacement = placement;
+ settings.editorSettings.tabGroupMode = "none";
+ settings.editorSettings.colorizeConnectionTabs = true;
+ const inactiveTabId = store.createTab("mysql-1", "app", "Inactive", "query");
+ const tabId = store.createTab("pg-1", "app", "Active", "query");
+ const { app, host } = mountBar(store.focusedGroupId, store.tabs.slice(), tabId, pinia);
+
+ try {
+ await settle();
+ const tab = host.querySelector<HTMLElement>(`[data-tab-id="${tabId}"]`)!;
+ const inactiveTab = host.querySelector<HTMLElement>(`[data-tab-id="${inactiveTabId}"]`)!;
+ expect(tab.style.getPropertyValue("--app-tab-background")).toBe("rgba(34, 197, 94, 0.24)");
+ expect(tab.style.getPropertyValue("--app-tab-active-border")).toBe("rgba(34, 197, 94, 0.72)");
+ expect(tab.style.getPropertyValue("--app-tab-active-accent")).toBe("#22c55e");
+ expect(inactiveTab.style.getPropertyValue("--app-tab-background")).toBe("rgba(59, 130, 246, 0.09)");
+ expect(inactiveTab.style.getPropertyValue("--app-tab-hover-background")).toBe("rgba(59, 130, 246, 0.16)");
+ expect(inactiveTab.style.borderColor).toBe("rgba(59, 130, 246, 0.18)");
+
+ settings.editorSettings.colorizeConnectionTabs = false;
+ await settle();
+ expect(tab.style.getPropertyValue("--app-tab-background")).toBe("");
+ expect(tab.style.getPropertyValue("--app-tab-active-border")).toBe("");
+ expect(tab.style.getPropertyValue("--app-tab-active-accent")).toBe("");
+ expect(inactiveTab.style.getPropertyValue("--app-tab-background")).toBe("");
+ expect(inactiveTab.style.getPropertyValue("--app-tab-hover-background")).toBe("");
+ expect(inactiveTab.style.borderColor).toBe("");
+ } finally {
+ app.unmount();
+ host.remove();
+ }
+ });
+
+ it.each(["left", "right"] as const)("keeps the active %s special-page tab on the neutral active wash", async (placement) => {
+ const store = useQueryStore();
+ const settings = useSettingsStore();
+ settings.editorSettings.tabPlacement = placement;
+ settings.editorSettings.tabGroupMode = "none";
+ settings.editorSettings.colorizeConnectionTabs = true;
+ store.createTab("pg-1", "app", "Query", "query");
+ const { app, host } = mountBar(store.focusedGroupId, store.tabs.slice(), store.activeTabId, pinia, {
+ specialPageTabs: { settingsOpen: true, settingsActive: true, driverStoreOpen: false, driverStoreActive: false, pluginCenterOpen: false, pluginCenterActive: false, driverUpdateCount: 0 },
+ });
+
+ try {
+ await settle();
+ const specialTab = host.querySelector<HTMLElement>("[data-settings-page-tab]")!;
+ expect(specialTab.getAttribute("data-active-tab")).toBe("true");
+ // Special pages have no connection color: the active vertical wash must
+ // come from the appTabBar.css fallback, not an inline solid override.
+ expect(specialTab.style.getPropertyValue("--app-tab-background")).toBe("");
+ } finally {
+ app.unmount();
+ host.remove();
+ }
+ });
+
it("only reveals a right-edge group when expansion leaves every member offscreen", async () => {
const store = useQueryStore();
const settings = useSettingsStore();
diff --git a/apps/desktop/src/components/layout/appTabBar.css b/apps/desktop/src/components/layout/appTabBar.css
index 98c670b075..b1b81233f2 100644
--- a/apps/desktop/src/components/layout/appTabBar.css
+++ b/apps/desktop/src/components/layout/appTabBar.css
@@ -1027,10 +1027,10 @@
/* Without semantic grouping there is no group color to distinguish the
* active item, so give the selected vertical tab a stronger neutral state. */
.vertical-tab-layout .app-tab-pill:not(.tab-group-tab)[data-active-tab="true"] {
- background-color: color-mix(in srgb, var(--foreground) 16%, var(--background));
- border-color: color-mix(in srgb, var(--foreground) 32%, var(--border));
+ background-color: var(--app-tab-background, color-mix(in srgb, var(--foreground) 16%, var(--background)));
+ border-color: var(--app-tab-active-border, color-mix(in srgb, var(--foreground) 32%, var(--border)));
box-shadow:
- inset 3px 0 0 var(--ring),
+ inset 3px 0 0 var(--app-tab-active-accent, var(--ring)),
inset 0 0 0 1px color-mix(in srgb, var(--foreground) 18%, transparent),
0 1px 2px rgb(0 0 0 / 0.08);
}
@@ -1044,8 +1044,8 @@
* background and border over the same tokens. The composite box-shadow stays
* out — losing it is cosmetic, and a partial shadow list is all-or-nothing. */
html.dbx-legacy-webview .vertical-tab-layout .app-tab-pill:not(.tab-group-tab)[data-active-tab="true"] {
- background-color: rgba(var(--dbx-foreground-rgb), 0.16) !important;
- border-color: rgba(var(--dbx-foreground-rgb), 0.32) !important;
+ background-color: var(--app-tab-background, rgba(var(--dbx-foreground-rgb), 0.16)) !important;
+ border-color: var(--app-tab-active-border, rgba(var(--dbx-foreground-rgb), 0.32)) !important;
}
.vertical-tab-layout .app-tab-scroll > * {