Track dialogs

This commit is contained in:
Gregory Schier
2024-01-28 16:33:36 -08:00
parent 15714ae188
commit fb11aff03f
29 changed files with 111 additions and 89 deletions

View File

@@ -1,23 +1,23 @@
import { useEffect } from 'react';
import { fallbackRequestName } from '../lib/fallbackRequestName';
import { useActiveEnvironment } from './useActiveEnvironment';
import { useActiveRequest } from './useActiveRequest';
import { useActiveWorkspace } from './useActiveWorkspace';
// import { useEffect } from 'react';
// import { fallbackRequestName } from '../lib/fallbackRequestName';
// import { useActiveEnvironment } from './useActiveEnvironment';
// import { useActiveRequest } from './useActiveRequest';
// import { useActiveWorkspace } from './useActiveWorkspace';
export function useSyncWindowTitle() {
const activeRequest = useActiveRequest();
const activeWorkspace = useActiveWorkspace();
const activeEnvironment = useActiveEnvironment();
useEffect(() => {
let newTitle = activeWorkspace ? activeWorkspace.name : 'Yaak';
if (activeEnvironment) {
newTitle += ` [${activeEnvironment.name}]`;
}
if (activeRequest) {
newTitle += ` ${fallbackRequestName(activeRequest)}`;
}
// TODO: This resets the stoplight position so we can't use it yet
// appWindow.setTitle(newTitle).catch(console.error);
}, [activeEnvironment, activeRequest, activeWorkspace]);
// const activeRequest = useActiveRequest();
// const activeWorkspace = useActiveWorkspace();
// const activeEnvironment = useActiveEnvironment();
// useEffect(() => {
// let newTitle = activeWorkspace ? activeWorkspace.name : 'Yaak';
// if (activeEnvironment) {
// newTitle += ` [${activeEnvironment.name}]`;
// }
// if (activeRequest) {
// newTitle += ` ${fallbackRequestName(activeRequest)}`;
// }
//
// // TODO: This resets the stoplight position so we can't use it yet
// // appWindow.setTitle(newTitle).catch(console.error);
// }, [activeEnvironment, activeRequest, activeWorkspace]);
}