mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-29 05:31:51 +02:00
Fix window stoplights
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { QUERY_ENVIRONMENT_ID } from './useActiveEnvironmentId';
|
||||
import { useActiveWorkspaceId } from './useActiveWorkspaceId';
|
||||
import { useActiveRequestId } from './useActiveRequestId';
|
||||
import type { Environment } from '../lib/models';
|
||||
import { useCallback } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import type { Environment } from '../lib/models';
|
||||
import { QUERY_ENVIRONMENT_ID } from './useActiveEnvironmentId';
|
||||
import { useActiveRequestId } from './useActiveRequestId';
|
||||
import { useActiveWorkspaceId } from './useActiveWorkspaceId';
|
||||
|
||||
export type RouteParamsWorkspace = {
|
||||
workspaceId: string;
|
||||
@@ -18,6 +18,9 @@ export const routePaths = {
|
||||
workspaces() {
|
||||
return '/workspaces';
|
||||
},
|
||||
workspaceSettings({ workspaceId } = { workspaceId: ':workspaceId' } as RouteParamsWorkspace) {
|
||||
return `/workspaces/${workspaceId}/settings`;
|
||||
},
|
||||
workspace(
|
||||
{ workspaceId, environmentId } = {
|
||||
workspaceId: ':workspaceId',
|
||||
|
||||
@@ -12,6 +12,7 @@ export function useSettings() {
|
||||
queryKey: settingsQueryKey(),
|
||||
queryFn: async () => {
|
||||
const settings = (await invoke('cmd_get_settings')) as Settings;
|
||||
console.log('SETTINGS', settings);
|
||||
return [settings];
|
||||
},
|
||||
}).data?.[0] ?? undefined
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { emit } from '@tauri-apps/api/event';
|
||||
import { getCurrent } from '@tauri-apps/api/webviewWindow';
|
||||
import { useEffect } from 'react';
|
||||
import { fallbackRequestName } from '../lib/fallbackRequestName';
|
||||
@@ -12,7 +11,12 @@ export function useSyncWindowTitle() {
|
||||
const activeWorkspace = useActiveWorkspace();
|
||||
const activeEnvironment = useActiveEnvironment();
|
||||
const osInfo = useOsInfo();
|
||||
|
||||
useEffect(() => {
|
||||
if (osInfo?.osType == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
let newTitle = activeWorkspace ? activeWorkspace.name : 'Yaak';
|
||||
if (activeEnvironment) {
|
||||
newTitle += ` [${activeEnvironment.name}]`;
|
||||
@@ -25,9 +29,10 @@ export function useSyncWindowTitle() {
|
||||
// TODO: This resets the stoplight position so we can't use it on macOS yet. Perhaps
|
||||
// we can
|
||||
if (osInfo?.osType !== 'macos') {
|
||||
console.log('DO IT', osInfo?.osType);
|
||||
getCurrent().setTitle(newTitle).catch(console.error);
|
||||
} else {
|
||||
emit('yaak_title_changed', newTitle).catch(console.error);
|
||||
// emit('yaak_title_changed', newTitle).catch(console.error);
|
||||
}
|
||||
}, [activeEnvironment, activeRequest, activeWorkspace, osInfo?.osType]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user