mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-05 08:47:05 +02:00
[WIP] Encryption for secure values (#183)
This commit is contained in:
@@ -1,31 +1,22 @@
|
||||
import { emit } from '@tauri-apps/api/event';
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import { setWindowTitle } from '@yaakapp-internal/mac-window';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { useEffect } from 'react';
|
||||
import { jotaiStore } from '../lib/jotai';
|
||||
import { resolvedModelName } from '../lib/resolvedModelName';
|
||||
import { useActiveEnvironment } from './useActiveEnvironment';
|
||||
import { activeRequestAtom } from './useActiveRequest';
|
||||
import { activeWorkspaceAtom } from './useActiveWorkspace';
|
||||
import { useAppInfo } from './useAppInfo';
|
||||
import { useOsInfo } from './useOsInfo';
|
||||
import { appInfo } from './useAppInfo';
|
||||
|
||||
export function useSyncWorkspaceRequestTitle() {
|
||||
const activeWorkspace = useAtomValue(activeWorkspaceAtom);
|
||||
const activeEnvironment = useActiveEnvironment();
|
||||
const osInfo = useOsInfo();
|
||||
const appInfo = useAppInfo();
|
||||
const activeRequest = useAtomValue(activeRequestAtom);
|
||||
|
||||
useEffect(() => {
|
||||
if (osInfo.osType == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
let newTitle = activeWorkspace ? activeWorkspace.name : 'Yaak';
|
||||
if (activeEnvironment) {
|
||||
newTitle += ` [${activeEnvironment.name}]`;
|
||||
}
|
||||
const activeRequest = jotaiStore.get(activeRequestAtom);
|
||||
if (activeRequest) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
newTitle += ` › ${resolvedModelName(activeRequest)}`;
|
||||
@@ -35,12 +26,6 @@ export function useSyncWorkspaceRequestTitle() {
|
||||
newTitle = `[DEV] ${newTitle}`;
|
||||
}
|
||||
|
||||
// TODO: This resets the stoplight position so we can't use it on macOS yet. So we send
|
||||
// a custom command instead
|
||||
if (osInfo.osType !== 'macos') {
|
||||
getCurrentWebviewWindow().setTitle(newTitle).catch(console.error);
|
||||
} else {
|
||||
emit('yaak_title_changed', newTitle).catch(console.error);
|
||||
}
|
||||
}, [activeEnvironment, activeWorkspace, appInfo.isDev, osInfo.osType]);
|
||||
setWindowTitle(newTitle);
|
||||
}, [activeEnvironment, activeRequest, activeWorkspace]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user