Merge branch 'config-work' into dev
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
||||
} from "@/utils/command-center-focus-restore";
|
||||
import {
|
||||
buildHostAgentDetailRoute,
|
||||
buildHostSettingsRoute,
|
||||
buildSettingsRoute,
|
||||
parseServerIdFromPathname,
|
||||
} from "@/utils/host-routes";
|
||||
import type { ShortcutKey } from "@/utils/format-shortcut";
|
||||
@@ -170,9 +170,8 @@ export function useCommandCenter() {
|
||||
}, [agents, open, query]);
|
||||
|
||||
const settingsRoute = useMemo<Href>(() => {
|
||||
const serverIdFromPath = activeServerId;
|
||||
return serverIdFromPath ? buildHostSettingsRoute(serverIdFromPath) : "/";
|
||||
}, [activeServerId]);
|
||||
return buildSettingsRoute();
|
||||
}, []);
|
||||
|
||||
const actionItems = useMemo(() => {
|
||||
if (!open) {
|
||||
|
||||
@@ -15,8 +15,7 @@ async function loadDesktopDaemonServerId(): Promise<DesktopDaemonServerIdResult>
|
||||
};
|
||||
}
|
||||
|
||||
export function useIsLocalDaemon(serverId: string): boolean {
|
||||
const normalizedServerId = serverId.trim();
|
||||
export function useLocalDaemonServerId(): string | null {
|
||||
const isDesktopApp = shouldUseDesktopDaemon();
|
||||
|
||||
const query = useQuery({
|
||||
@@ -32,9 +31,20 @@ export function useIsLocalDaemon(serverId: string): boolean {
|
||||
retry: false,
|
||||
});
|
||||
|
||||
if (!isDesktopApp || normalizedServerId.length === 0) {
|
||||
if (!isDesktopApp) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return query.data?.serverId ?? null;
|
||||
}
|
||||
|
||||
export function useIsLocalDaemon(serverId: string): boolean {
|
||||
const normalizedServerId = serverId.trim();
|
||||
const localServerId = useLocalDaemonServerId();
|
||||
|
||||
if (localServerId === null || normalizedServerId.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return query.data?.serverId === normalizedServerId;
|
||||
return localServerId === normalizedServerId;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useHosts } from "@/runtime/host-runtime";
|
||||
import { useKeyboardShortcutsStore } from "@/stores/keyboard-shortcuts-store";
|
||||
import { setCommandCenterFocusRestoreElement } from "@/utils/command-center-focus-restore";
|
||||
import {
|
||||
buildHostSettingsRoute,
|
||||
buildSettingsRoute,
|
||||
parseHostAgentRouteFromPathname,
|
||||
parseServerIdFromPathname,
|
||||
parseHostWorkspaceRouteFromPathname,
|
||||
@@ -245,14 +245,11 @@ export function useKeyboardShortcuts({
|
||||
toggleAgentList();
|
||||
return true;
|
||||
case "settings.toggle":
|
||||
if (pathname.endsWith("/settings")) {
|
||||
if (pathname.startsWith("/settings")) {
|
||||
router.back();
|
||||
return true;
|
||||
}
|
||||
if (!activeServerId) {
|
||||
return false;
|
||||
}
|
||||
router.push(buildHostSettingsRoute(activeServerId));
|
||||
router.push(buildSettingsRoute());
|
||||
return true;
|
||||
case "sidebar.toggle.both":
|
||||
if (toggleBothSidebars) {
|
||||
|
||||
Reference in New Issue
Block a user