feat(tabs): add tab group pills with names, colors and collapsible side bar
This commit is contained in:
15 files changed
+1253
-51
No files matched your search
@@ -79,4 +79,19 @@ describe("usePanelResize", () => {
|
||||
expect(aiPanelWidth.value).toBe(600);
|
||||
expect(localStorage.getItem("dbx-ai-panel-width")).toBe("600");
|
||||
});
|
||||
|
||||
it("persists the collapsed vertical tab bar state across composable instances", () => {
|
||||
const first = usePanelResize();
|
||||
expect(first.tabBarCollapsed.value).toBe(false);
|
||||
|
||||
first.setTabBarCollapsed(true);
|
||||
expect(first.tabBarCollapsed.value).toBe(true);
|
||||
expect(localStorage.getItem("dbx-tab-bar-collapsed")).toBe("true");
|
||||
|
||||
const restored = usePanelResize();
|
||||
expect(restored.tabBarCollapsed.value).toBe(true);
|
||||
|
||||
restored.setTabBarCollapsed(false);
|
||||
expect(localStorage.getItem("dbx-tab-bar-collapsed")).toBe("false");
|
||||
});
|
||||
});
|
||||
@@ -21,6 +21,8 @@ export function usePanelResize() {
|
||||
const historyWidth = ref(Number(safeLocalStorageGet("dbx-history-width")) || 288);
|
||||
const sqlLibraryWidth = ref(Number(safeLocalStorageGet("dbx-sql-library-width")) || 288);
|
||||
const sqlFilePanelWidth = ref(Number(safeLocalStorageGet("dbx-sql-file-panel-width")) || 288);
|
||||
const tabBarWidth = ref(Number(safeLocalStorageGet("dbx-tab-bar-width")) || 240);
|
||||
const tabBarCollapsed = ref(safeLocalStorageGet("dbx-tab-bar-collapsed") === "true");
|
||||
|
||||
function startPanelResize(widthRef: Ref<number>, storageKey: string, direction: "left" | "right", maxWidth: PanelMaxWidth = DEFAULT_PANEL_MAX_WIDTH) {
|
||||
return (e: MouseEvent) => {
|
||||
@@ -55,6 +57,13 @@ export function usePanelResize() {
|
||||
const startHistoryResize = startPanelResize(historyWidth, "dbx-history-width", "left");
|
||||
const startSqlLibraryResize = startPanelResize(sqlLibraryWidth, "dbx-sql-library-width", "left");
|
||||
const startSqlFilePanelResize = startPanelResize(sqlFilePanelWidth, "dbx-sql-file-panel-width", "left");
|
||||
const startLeftTabBarResize = startPanelResize(tabBarWidth, "dbx-tab-bar-width", "right");
|
||||
const startRightTabBarResize = startPanelResize(tabBarWidth, "dbx-tab-bar-width", "left");
|
||||
|
||||
function setTabBarCollapsed(collapsed: boolean) {
|
||||
tabBarCollapsed.value = collapsed;
|
||||
safeLocalStorageSet("dbx-tab-bar-collapsed", String(collapsed));
|
||||
}
|
||||
|
||||
return {
|
||||
sidebarWidth,
|
||||
@@ -62,10 +71,15 @@ export function usePanelResize() {
|
||||
historyWidth,
|
||||
sqlLibraryWidth,
|
||||
sqlFilePanelWidth,
|
||||
tabBarWidth,
|
||||
tabBarCollapsed,
|
||||
startSidebarResize,
|
||||
startAiPanelResize,
|
||||
startHistoryResize,
|
||||
startSqlLibraryResize,
|
||||
startSqlFilePanelResize,
|
||||
startLeftTabBarResize,
|
||||
startRightTabBarResize,
|
||||
setTabBarCollapsed,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user