You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by zh...@apache.org on 2026/09/18 07:50:25 UTC
(maka) 04/05: fix(desktop): route WorkHub settings through overlay contract
This is an automated email from the ASF dual-hosted git repository.
me2seeks pushed a commit to branch fix/workhub-model-setup
in repository https://gitbox.apache.org/repos/asf/maka.git
commit 1c81fd16d8f849c5558c0465a26e7498ee88500e
Author: me2seeks <me...@gmail.com>
AuthorDate: Fri Sep 18 15:25:59 2026 +0800
fix(desktop): route WorkHub settings through overlay contract
Generated-by: OpenAI Codex
---
apps/desktop/src/renderer/app-shell.tsx | 3 +--
.../contracts/settings-presentation/index.ts | 1 +
.../{index.ts => settings-navigation.tsx} | 26 +++++++++++++++++-----
.../features/overlays/ui/overlays-root.tsx | 7 +++++-
.../features/workhub/ui/main-navigation.tsx | 8 ++++---
5 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/apps/desktop/src/renderer/app-shell.tsx b/apps/desktop/src/renderer/app-shell.tsx
index a17fc5c0d1..c9b074a387 100644
--- a/apps/desktop/src/renderer/app-shell.tsx
+++ b/apps/desktop/src/renderer/app-shell.tsx
@@ -2394,8 +2394,7 @@ function AppShellContent({
<ModuleHub.ModuleHubHost />
<WorkHubMainNavigation workbarReady={workHubActive && Boolean(workbar.host.activeId)}
onOpenUsage={() => commands.toggleTool('inspector')} onToggleWorkbar={commands.toggleRight}
- onOpenWorkHub={openWorkHub} onOpenSession={(sessionId) => { closeSettings(); openSession(sessionId); }}
- onOpenSettings={(section) => openSettingsSection(section)} />
+ onOpenWorkHub={openWorkHub} onOpenSession={(sessionId) => { closeSettings(); openSession(sessionId); }} />
<WorkHubDock workbarCollapsed={selectors.rightCollapsed} enabled={workHubEnabled} visible={workHubActive && sessionsSelected && !shellObscured} />
<ChatSurfaceLayout
// ChatView positions this transcript: switching conversations,
diff --git a/apps/desktop/src/renderer/application/contracts/settings-presentation/index.ts b/apps/desktop/src/renderer/application/contracts/settings-presentation/index.ts
index 4a7399cc40..a93ace6511 100644
--- a/apps/desktop/src/renderer/application/contracts/settings-presentation/index.ts
+++ b/apps/desktop/src/renderer/application/contracts/settings-presentation/index.ts
@@ -22,3 +22,4 @@ export * from "./runtime-host-settings-target.js";
export * from "./action-guard.js";
export * from "./oauth-login-flow-guard.js";
export * from "./use-action-guard.js";
+export * from "./settings-navigation.js";
diff --git a/apps/desktop/src/renderer/application/contracts/settings-presentation/index.ts b/apps/desktop/src/renderer/application/contracts/settings-presentation/settings-navigation.tsx
similarity index 51%
copy from apps/desktop/src/renderer/application/contracts/settings-presentation/index.ts
copy to apps/desktop/src/renderer/application/contracts/settings-presentation/settings-navigation.tsx
index 4a7399cc40..3f5bfa89e5 100644
--- a/apps/desktop/src/renderer/application/contracts/settings-presentation/index.ts
+++ b/apps/desktop/src/renderer/application/contracts/settings-presentation/settings-navigation.tsx
@@ -17,8 +17,24 @@
* under the License.
*/
-export * from "./settings-section.js";
-export * from "./runtime-host-settings-target.js";
-export * from "./action-guard.js";
-export * from "./oauth-login-flow-guard.js";
-export * from "./use-action-guard.js";
+import { createContext, useContext, type ReactNode } from 'react';
+import type { SettingsSection } from '@maka/core/settings';
+
+export interface SettingsNavigation {
+ openSettingsSection(section: SettingsSection): void;
+}
+
+export const SettingsNavigationContext = createContext<SettingsNavigation | null>(null);
+
+export function useSettingsNavigation(): SettingsNavigation {
+ const navigation = useContext(SettingsNavigationContext);
+ if (!navigation) throw new Error('SettingsNavigationProvider is missing');
+ return navigation;
+}
+
+export function SettingsNavigationProvider(props: {
+ navigation: SettingsNavigation;
+ children: ReactNode;
+}) {
+ return <SettingsNavigationContext.Provider value={props.navigation}>{props.children}</SettingsNavigationContext.Provider>;
+}
diff --git a/apps/desktop/src/renderer/features/overlays/ui/overlays-root.tsx b/apps/desktop/src/renderer/features/overlays/ui/overlays-root.tsx
index 9dedcf96e8..6eabb435db 100644
--- a/apps/desktop/src/renderer/features/overlays/ui/overlays-root.tsx
+++ b/apps/desktop/src/renderer/features/overlays/ui/overlays-root.tsx
@@ -21,6 +21,7 @@ import { useMemo, type ReactNode } from 'react';
import { useOverlaysController } from '../controller/use-overlays-controller.js';
import type { OverlaysShellProjection } from '../model/overlays-projection.js';
import { OverlaysContext } from './overlays-context.js';
+import { SettingsNavigationProvider } from '../../../application/contracts/settings-presentation/settings-navigation.js';
export interface OverlaysRootProps {
/**
@@ -35,5 +36,9 @@ export interface OverlaysRootProps {
export function OverlaysRoot({ children }: OverlaysRootProps) {
const overlays = useOverlaysController();
const frame = useMemo(() => children(overlays), [children, overlays]);
- return <OverlaysContext.Provider value={overlays}>{frame}</OverlaysContext.Provider>;
+ return (
+ <SettingsNavigationProvider navigation={overlays.commands}>
+ <OverlaysContext.Provider value={overlays}>{frame}</OverlaysContext.Provider>
+ </SettingsNavigationProvider>
+ );
}
diff --git a/apps/desktop/src/renderer/features/workhub/ui/main-navigation.tsx b/apps/desktop/src/renderer/features/workhub/ui/main-navigation.tsx
index 1930ed7ba6..36b6cc4503 100644
--- a/apps/desktop/src/renderer/features/workhub/ui/main-navigation.tsx
+++ b/apps/desktop/src/renderer/features/workhub/ui/main-navigation.tsx
@@ -18,19 +18,21 @@
*/
import { useEffect, useRef, useState } from 'react';
+import { useSettingsNavigation } from '../../../application/contracts/settings-presentation/settings-navigation.js';
import { useWorkHubServices } from '../services.js';
-export function WorkHubMainNavigation(props: { workbarReady: boolean; onOpenUsage(): void; onToggleWorkbar(): void; onOpenWorkHub(): void; onOpenSession(sessionId: string): void; onOpenSettings(section: 'models'): void }) {
+export function WorkHubMainNavigation(props: { workbarReady: boolean; onOpenUsage(): void; onToggleWorkbar(): void; onOpenWorkHub(): void; onOpenSession(sessionId: string): void }) {
const [pendingAction, setPendingAction] = useState<'usage' | 'toggle'>();
const { presentation } = useWorkHubServices();
+ const settingsNavigation = useSettingsNavigation();
const current = useRef(props); current.current = props;
useEffect(() => presentation.onOpenMain((navigation) => {
if (navigation.kind === 'workhub') {
current.current.onOpenWorkHub();
setPendingAction(navigation.panelAction);
}
- else if (navigation.kind === 'settings') { setPendingAction(undefined); current.current.onOpenSettings(navigation.section); }
+ else if (navigation.kind === 'settings') { setPendingAction(undefined); settingsNavigation.openSettingsSection(navigation.section); }
else { setPendingAction(undefined); current.current.onOpenSession(navigation.sessionKey); }
- }), [presentation]);
+ }), [presentation, settingsNavigation]);
useEffect(() => {
if (pendingAction && props.workbarReady) {
if (pendingAction === 'usage') current.current.onOpenUsage();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org