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。

improve(tabs): mark active grouped tab with a primary edge accent (#12540)

lxk955b5eb36e578f4
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 4b88bd816a..0ca704d042 100644
--- a/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.groups.spec.ts
+++ b/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.groups.spec.ts
@@ -222,6 +222,59 @@ describe("EditorGroupTabBar group behavior", () => {
}
});
+ it("marks the active horizontal grouped tab with a primary edge accent", async () => {
+ const store = useQueryStore();
+ const settings = useSettingsStore();
+ const connectionStore = useConnectionStore();
+ connectionStore.connections = [{ id: "pg-1", name: "Postgres", db_type: "postgres", driver_profile: "postgres", color: "#3b82f6" } as ConnectionConfig];
+ settings.editorSettings.appLayout = "separated";
+ settings.editorSettings.tabGroupMode = "connection";
+ settings.editorSettings.tabPlacement = "top";
+ const activeTabId = store.createTab("pg-1", "app", "PG 1", "query");
+ store.createTab("pg-1", "app", "PG 2", "query");
+ const { app, host } = mountBar(store.groups[0]!.id, store.tabs.slice(), activeTabId, pinia);
+ const styles = document.createElement("style");
+ styles.textContent = `html { font-size: 16px; } .h-full { height: 100%; }\n${sharedStyles}`;
+ document.head.appendChild(styles);
+
+ try {
+ await settle();
+ // Exactly one pill carries the active state; the CSS accent keys off it.
+ const activeTabs = host.querySelectorAll('.tab-group-tab[data-active-tab="true"]');
+ expect(activeTabs).toHaveLength(1);
+ expect(activeTabs[0]!.getAttribute("data-tab-id")).toBe(activeTabId);
+ // The accent is a ::before pseudo-element, so assert it on the parsed
+ // stylesheet rather than a computed style: it must paint the active
+ // grouped tab with the primary accent, not the group color, so it
+ // stays findable among several groups (issue #12485).
+ const selectors: string[] = [];
+ const heights = new Set<string>();
+ for (const sheet of document.styleSheets) {
+ for (const rule of sheet.cssRules) {
+ const styleRule = rule as CSSStyleRule;
+ if (styleRule.selectorText?.includes(".tab-group-tab") && styleRule.selectorText.includes('[data-active-tab="true"]') && styleRule.selectorText.endsWith("::before")) {
+ selectors.push(styleRule.selectorText);
+ // Geometry survives happy-dom's parser; var() paints do not.
+ heights.add(styleRule.style.getPropertyValue("height"));
+ }
+ }
+ }
+ expect(selectors.length).toBeGreaterThan(0);
+ expect([...heights]).toContain("3px");
+ // The paint itself: the rule block must use the primary accent token so
+ // the active tab reads as "the chosen one", distinct from every group's
+ // own colored rail.
+ const ruleStart = sharedStyles.indexOf('.tab-group-tab[data-active-tab="true"]::before');
+ expect(ruleStart).toBeGreaterThan(-1);
+ const ruleBlock = sharedStyles.slice(ruleStart, sharedStyles.indexOf("}", ruleStart) + 1);
+ expect(ruleBlock).toContain("--app-tab-active-accent");
+ } finally {
+ app.unmount();
+ host.remove();
+ styles.remove();
+ }
+ });
+
it.each(["classic", "separated"] as const)("keeps configured connection colors on inactive horizontal tabs when grouping is off in %s layout", async (layout) => {
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 c1de0b923f..60e6e00f7d 100644
--- a/apps/desktop/src/components/layout/appTabBar.css
+++ b/apps/desktop/src/components/layout/appTabBar.css
@@ -820,6 +820,30 @@
opacity: 1;
}
+/* With several groups in view, the neutral rail segment above is not enough
+ * to spot the active tab at a glance (issue #12485): every tab already owns a
+ * colored group rail, so the bottom edge cannot carry a unique signal. Mark
+ * the active grouped tab with a primary-colored edge accent on the opposite
+ * edge instead — the same vocabulary as the vertical tab's inset --ring edge.
+ * The var fallback keeps legacy WebViews (no color-mix()) painted. */
+.app-tab-bar:not(.vertical-tab-layout) .tab-group-tab[data-active-tab="true"]::before {
+ content: "";
+ position: absolute;
+ z-index: 2;
+ top: -0.5px;
+ right: 0;
+ left: 0;
+ height: 3px;
+ border-radius: 9999px;
+ background: var(--app-tab-active-accent, var(--ring));
+ pointer-events: none;
+}
+
+.app-tab-bar:not(.vertical-tab-layout)[data-placement="bottom"] .tab-group-tab[data-active-tab="true"]::before {
+ top: auto;
+ bottom: -0.5px;
+}
+
.app-tab-bar:not(.vertical-tab-layout):not(:has(.wrap-mode))[data-placement="bottom"] .tab-group-tab::after {
top: -0.5px;
bottom: auto;