feat(editor): show pinned tabs in separate row with per-row scroll

This commit is contained in:
zipg authored and GitHub committed 2026-09-08 17:11:30 +08:00
1 parent 3b9cd3eec4
commit 05b719e7a6
18 files changed
+958 -252

No files matched your search

@@ -168,6 +168,14 @@ describe("query result grid identity", () => {
});
describe("tab group presentation", () => {
it("does not expose the internal objects mode in object browser tab titles", () => {
const store = useConnectionStore();
store.connections = [{ id: "conn-1", name: "PostgreSQL", db_type: "postgres", driver_profile: "postgres", database: "app" } as ConnectionConfig];
expect(tabDisplayTitle(queryTab({ mode: "objects", title: "app objects" }), translate)).toBe("db");
expect(tabDisplayTitle(queryTab({ mode: "objects", title: "public objects", objectBrowser: { schema: "public" } }), translate)).toBe("public@db");
});
it("uses the live database and branch context for Dolt version control tabs", () => {
const store = useConnectionStore();
store.connections = [{ id: "conn-1", name: "Production Dolt", db_type: "mysql", driver_profile: "dolt", database: "app" } as ConnectionConfig];
@@ -428,7 +436,7 @@ describe("shared tab presentation helpers", () => {
it("builds active/inactive color styles for classic and non-classic layouts", () => {
const activeClassic = tabColorStyle(queryTab({}), true, true);
expect(activeClassic?.boxShadow).toContain("var(--ring)");
expect(activeClassic?.boxShadow).toContain("var(--foreground)");
const inactiveModern = tabColorStyle(queryTab({}), false, false);
expect(inactiveModern?.borderColor).toBeUndefined();
});
+20 -8
View File
@@ -154,8 +154,9 @@ export function tabDisplayTitle(tab: QueryTab, t: Translate): string {
}
if (tab.mode === "objects") {
const schema = tab.objectBrowser?.schema;
if (compact) return schema || tab.title;
return schema ? `${schema}@${database}` : `${tab.title}@${database}`;
const objectScope = tab.catalog ? `${tab.catalog}.${database}` : database;
if (compact) return schema || objectScope;
return schema ? `${schema}@${objectScope}` : objectScope;
}
if (tab.mode === "users") {
if (compact) return t("tabs.users");
@@ -497,28 +498,39 @@ export function tabDatabaseIconType(tab: QueryTab): string {
export function tabIconClass(tab: QueryTab): string {
if (tab.externalSqlFileMissing) return "text-amber-600 dark:text-amber-400";
if (tab.mode === "mq") return "";
if (tab.objectSource?.objectType === "VIEW") return "text-purple-500";
if (tab.objectSource?.objectType === "MATERIALIZED_VIEW") return "text-indigo-500";
if (tab.objectSource?.objectType === "PROCEDURE") return "text-blue-500";
if (tab.objectSource?.objectType === "FUNCTION") return "text-amber-500";
if (tab.objectSource?.objectType === "TRIGGER") return "text-orange-300";
if (tab.objectSource?.objectType === "EVENT" || tab.objectSource?.objectType === "JOB") return "text-orange-400";
if (tab.objectSource?.objectType === "SEQUENCE") return "text-emerald-500";
if (tab.mode === "redis") return "text-red-400";
if (tab.mode === "data" && tab.tableMeta?.tableType?.toUpperCase() === "VIEW") return "text-purple-500";
if (tab.mode === "data" && tab.tableMeta?.tableType?.toUpperCase() === "MATERIALIZED_VIEW") return "text-indigo-500";
if (tab.mode === "databases" || tab.mode === "objects") return "text-amber-500 dark:text-amber-400";
if (tab.mode === "data" || tab.mode === "mongo" || tab.mode === "vector" || tab.mode === "redis" || tab.mode === "hbase" || tab.mode === "structure") return "text-emerald-600 dark:text-emerald-400";
if (tab.mode === "data" || tab.mode === "mongo" || tab.mode === "vector" || tab.mode === "hbase" || tab.mode === "structure") return "text-emerald-600 dark:text-emerald-400";
return "text-blue-600 dark:text-blue-400";
}
export function tabColorStyle(tab: QueryTab, active: boolean, isClassic: boolean): CSSProperties | undefined {
const activeIndicator = "inset 0 -2px 0 color-mix(in srgb, var(--foreground) 72%, transparent)";
const color = connectionColor(tab.connectionId);
if (!color) {
if (isClassic) {
return active ? { boxShadow: "inset 0 -2px 0 var(--ring)" } : undefined;
return active ? { "--app-tab-background": "color-mix(in srgb, var(--foreground) 18%, var(--background))", boxShadow: activeIndicator } : undefined;
}
return active ? { borderColor: "var(--ring)" } : undefined;
return active ? { "--app-tab-background": "color-mix(in srgb, var(--foreground) 18%, var(--background))", borderColor: "var(--ring)" } : undefined;
}
if (isClassic) {
return {
"--app-tab-background": hexToRgba(color, active ? 0.16 : 0.07),
"--app-tab-background": hexToRgba(color, active ? 0.24 : 0.07),
"--app-tab-hover-background": hexToRgba(color, 0.14),
boxShadow: active ? `inset 0 -2px 0 ${color}` : undefined,
boxShadow: active ? activeIndicator : undefined,
};
}
return {
"--app-tab-background": hexToRgba(color, active ? 0.16 : 0.09),
"--app-tab-background": hexToRgba(color, active ? 0.24 : 0.09),
"--app-tab-hover-background": hexToRgba(color, 0.16),
borderColor: active ? hexToRgba(color, 0.72) : hexToRgba(color, 0.18),
};