A bunch more theme stuff

This commit is contained in:
Gregory Schier
2024-05-22 23:14:53 -07:00
parent 83aaeb94f6
commit 8e662e6feb
61 changed files with 8374 additions and 530 deletions

View File

@@ -1,23 +1,24 @@
// 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
// // getCurrent().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) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
newTitle += ` ${fallbackRequestName(activeRequest)}`;
}
// TODO: This resets the stoplight position so we can't use it yet
// invoke('cmd_set_title', { title: newTitle }).catch(console.error);
}, [activeEnvironment, activeRequest, activeWorkspace]);
}