Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions emain/emain-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,20 @@ function makeViewMenu(
{
role: "togglefullscreen",
},
{ type: "separator" },
{
label: "Toggle Widgets Bar",
click: () => {
fireAndForget(async () => {
const workspaceId = focusedWaveWindow?.workspaceId;
if (!workspaceId) return;
const oref = `workspace:${workspaceId}`;
const meta = await RpcApi.GetMetaCommand(ElectronWshClient, { oref });
const current = meta?.["layout:widgetsvisible"] ?? true;
await RpcApi.SetMetaCommand(ElectronWshClient, { oref, meta: { "layout:widgetsvisible": !current } });
});
},
},
];
}

Expand Down
6 changes: 6 additions & 0 deletions frontend/app/workspace/workspace-layout-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class WorkspaceLayoutModel {
private focusTimeoutRef: NodeJS.Timeout | null = null;
private debouncedPersistAIWidth: () => void;
private debouncedPersistVTabWidth: () => void;
widgetsSidebarVisibleAtom: jotai.Atom<boolean>;

private constructor() {
this.aiPanelRef = null;
Expand All @@ -71,6 +72,11 @@ class WorkspaceLayoutModel {
this.vtabWidth = VTabBar_DefaultWidth;
this.vtabVisible = false;
this.panelVisibleAtom = jotai.atom(false);
this.widgetsSidebarVisibleAtom = jotai.atom(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL: Missing setter - the derived atom has no write functionality

The widgetsSidebarVisibleAtom is now a derived read-only atom (no getter/setter pair). There is no way to update the value. Compare with how panelVisibleAtom works in this file - it has a setter method setAIPanelVisible() that updates the atom and persists to meta. The widgets sidebar needs similar setter functionality to persist visibility changes to layout:widgetsvisible.

(get) =>
get(getOrefMetaKeyAtom(WOS.makeORef("workspace", this.getWorkspaceId()), "layout:widgetsvisible")) ??
true
);
this.initializeFromMeta();

this.handleWindowResize = this.handleWindowResize.bind(this);
Expand Down
3 changes: 2 additions & 1 deletion frontend/app/workspace/workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const WorkspaceElem = memo(() => {
const tabBarPosition = useAtomValue(getSettingsKeyAtom("app:tabbar")) ?? "top";
const showLeftTabBar = tabBarPosition === "left";
const aiPanelVisible = useAtomValue(workspaceLayoutModel.panelVisibleAtom);
const widgetsSidebarVisible = useAtomValue(workspaceLayoutModel.widgetsSidebarVisibleAtom);
const windowWidth = window.innerWidth;
const leftGroupInitialPct = workspaceLayoutModel.getLeftGroupInitialPercentage(windowWidth, showLeftTabBar);
const innerVTabInitialPct = workspaceLayoutModel.getInnerVTabInitialPercentage(windowWidth, showLeftTabBar);
Expand Down Expand Up @@ -158,7 +159,7 @@ const WorkspaceElem = memo(() => {
) : (
<div className="flex flex-row h-full">
<TabContent key={tabId} tabId={tabId} noTopPadding={showLeftTabBar && isMacOS()} />
<Widgets />
{widgetsSidebarVisible && <Widgets />}
</div>
)}
</Panel>
Expand Down
1 change: 1 addition & 0 deletions frontend/types/gotypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ declare global {
"bg:bordercolor"?: string;
"bg:activebordercolor"?: string;
"layout:vtabbarwidth"?: number;
"layout:widgetsvisible"?: boolean;
"waveai:panelopen"?: boolean;
"waveai:panelwidth"?: number;
"waveai:model"?: string;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/waveobj/metaconsts.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const (
MetaKey_BgActiveBorderColor = "bg:activebordercolor"

MetaKey_LayoutVTabBarWidth = "layout:vtabbarwidth"
MetaKey_LayoutWidgetsVisible = "layout:widgetsvisible"

MetaKey_WaveAiPanelOpen = "waveai:panelopen"
MetaKey_WaveAiPanelWidth = "waveai:panelwidth"
Expand Down
3 changes: 2 additions & 1 deletion pkg/waveobj/wtypemeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ type MetaTSType struct {
BgActiveBorderColor string `json:"bg:activebordercolor,omitempty"` // frame:activebordercolor

// for workspace
LayoutVTabBarWidth int `json:"layout:vtabbarwidth,omitempty"`
LayoutVTabBarWidth int `json:"layout:vtabbarwidth,omitempty"`
LayoutWidgetsVisible *bool `json:"layout:widgetsvisible,omitempty"`

// for tabs+waveai
WaveAiPanelOpen bool `json:"waveai:panelopen,omitempty"`
Expand Down