Skip to content

Commit d15a05a

Browse files
committed
revert tabbar change, simpllify workspace-layout-model change
1 parent 7a61e68 commit d15a05a

3 files changed

Lines changed: 8 additions & 46 deletions

File tree

frontend/app/tab/tabbar.tsx

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -75,30 +75,6 @@ const WaveAIButton = memo(({ divRef }: { divRef?: React.RefObject<HTMLDivElement
7575
});
7676
WaveAIButton.displayName = "WaveAIButton";
7777

78-
const WidgetsSidebarButton = memo(({ divRef }: { divRef?: React.RefObject<HTMLDivElement> }) => {
79-
const widgetsSidebarVisible = useAtomValue(WorkspaceLayoutModel.getInstance().widgetsSidebarVisibleAtom);
80-
81-
const onClick = () => {
82-
const current = WorkspaceLayoutModel.getInstance().getWidgetsSidebarVisible();
83-
WorkspaceLayoutModel.getInstance().setWidgetsSidebarVisible(!current);
84-
};
85-
86-
return (
87-
<Tooltip
88-
content="Toggle Widgets Sidebar"
89-
placement="bottom"
90-
hideOnClick
91-
divClassName={`flex h-[22px] px-3.5 justify-end mb-1 items-center rounded-md mr-1 box-border cursor-pointer bg-hover hover:bg-hoverbg transition-colors text-[12px] ${widgetsSidebarVisible ? "text-accent" : "text-secondary"}`}
92-
divStyle={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}
93-
divOnClick={onClick}
94-
divRef={divRef}
95-
>
96-
<i className="fa fa-bars" />
97-
</Tooltip>
98-
);
99-
});
100-
WidgetsSidebarButton.displayName = "WidgetsSidebarButton";
101-
10278
function strArrayIsEqual(a: string[], b: string[]) {
10379
// null check
10480
if (a == null && b == null) {
@@ -147,7 +123,6 @@ const TabBar = memo(({ workspace, noTabs }: TabBarProps) => {
147123
const rightContainerRef = useRef<HTMLDivElement>(null);
148124
const workspaceSwitcherRef = useRef<HTMLDivElement>(null);
149125
const waveAIButtonRef = useRef<HTMLDivElement>(null);
150-
const widgetsSidebarButtonRef = createRef<HTMLDivElement>();
151126
const appMenuButtonRef = useRef<HTMLDivElement>(null);
152127
const tabWidthRef = useRef<number>(TabDefaultWidth);
153128
const scrollableRef = useRef<boolean>(false);
@@ -690,7 +665,6 @@ const TabBar = memo(({ workspace, noTabs }: TabBarProps) => {
690665
</button>
691666
<div className="flex-1" />
692667
<div ref={rightContainerRef} className="flex flex-row gap-1 items-end">
693-
<WidgetsSidebarButton divRef={widgetsSidebarButtonRef} />
694668
<UpdateStatusBanner />
695669
<div
696670
className="h-full shrink-0 z-window-drag"
@@ -701,4 +675,4 @@ const TabBar = memo(({ workspace, noTabs }: TabBarProps) => {
701675
);
702676
});
703677

704-
export { TabBar, WaveAIButton, WidgetsSidebarButton };
678+
export { TabBar, WaveAIButton };

frontend/app/workspace/workspace-layout-model.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ class WorkspaceLayoutModel {
7272
this.vtabWidth = VTabBar_DefaultWidth;
7373
this.vtabVisible = false;
7474
this.panelVisibleAtom = jotai.atom(false);
75-
this.widgetsSidebarVisibleAtom = jotai.atom((get) => get(this.getWidgetsSidebarVisibleAtom()) ?? true);
75+
this.widgetsSidebarVisibleAtom = jotai.atom(
76+
(get) =>
77+
get(getOrefMetaKeyAtom(WOS.makeORef("workspace", this.getWorkspaceId()), "layout:widgetsvisible")) ??
78+
true
79+
);
7680
this.initializeFromMeta();
7781

7882
this.handleWindowResize = this.handleWindowResize.bind(this);
@@ -137,10 +141,6 @@ class WorkspaceLayoutModel {
137141
return getOrefMetaKeyAtom(WOS.makeORef("workspace", this.getWorkspaceId()), "layout:vtabbarwidth");
138142
}
139143

140-
private getWidgetsSidebarVisibleAtom(): jotai.Atom<boolean | undefined> {
141-
return getOrefMetaKeyAtom(WOS.makeORef("workspace", this.getWorkspaceId()), "layout:widgetsvisible");
142-
}
143-
144144
private initializeFromMeta(): void {
145145
try {
146146
const savedVisible = globalStore.get(this.getPanelOpenAtom());
@@ -358,18 +358,6 @@ class WorkspaceLayoutModel {
358358
return this.getResolvedAIWidth(window.innerWidth);
359359
}
360360

361-
getWidgetsSidebarVisible(): boolean {
362-
return globalStore.get(this.widgetsSidebarVisibleAtom);
363-
}
364-
365-
setWidgetsSidebarVisible(visible: boolean): void {
366-
if (globalStore.get(this.widgetsSidebarVisibleAtom) === visible) return;
367-
RpcApi.SetMetaCommand(TabRpcClient, {
368-
oref: WOS.makeORef("workspace", this.getWorkspaceId()),
369-
meta: { "layout:widgetsvisible": visible },
370-
});
371-
}
372-
373361
// ---- Initial percentage helpers (used by workspace.tsx for defaultSize) ----
374362

375363
getLeftGroupInitialPercentage(windowWidth: number, showLeftTabBar: boolean): number {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)