mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-17 23:13:51 +01:00
Tweak settings for release
This commit is contained in:
@@ -12,7 +12,6 @@ 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
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useActiveWorkspace } from './useActiveWorkspace';
|
||||
import { useOsInfo } from './useOsInfo';
|
||||
import { emit } from '@tauri-apps/api/event';
|
||||
|
||||
export function useSyncWindowTitle() {
|
||||
export function useSyncWorkspaceRequestTitle() {
|
||||
const activeRequest = useActiveRequest();
|
||||
const activeWorkspace = useActiveWorkspace();
|
||||
const activeEnvironment = useActiveEnvironment();
|
||||
@@ -1,17 +1,16 @@
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import type { Settings } from '../lib/models';
|
||||
import { settingsQueryKey } from './useSettings';
|
||||
import { useSettings } from './useSettings';
|
||||
|
||||
export function useUpdateSettings() {
|
||||
const queryClient = useQueryClient();
|
||||
const settings = useSettings();
|
||||
|
||||
return useMutation<void, unknown, Settings>({
|
||||
mutationFn: async (settings) => {
|
||||
await invoke('cmd_update_settings', { settings });
|
||||
},
|
||||
onMutate: async (settings) => {
|
||||
queryClient.setQueryData<Settings[]>(settingsQueryKey(), [settings]);
|
||||
return useMutation<void, unknown, Partial<Settings>>({
|
||||
mutationFn: async (patch) => {
|
||||
if (settings == null) return;
|
||||
const newSettings: Settings = { ...settings, ...patch };
|
||||
await invoke('cmd_update_settings', { settings: newSettings });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ export function useZoom() {
|
||||
const zoomIn = useCallback(() => {
|
||||
if (!settings) return;
|
||||
updateSettings.mutate({
|
||||
...settings,
|
||||
interfaceScale: Math.min(1.8, settings.interfaceScale * 1.1),
|
||||
});
|
||||
}, [settings, updateSettings]);
|
||||
@@ -17,13 +16,11 @@ export function useZoom() {
|
||||
const zoomOut = useCallback(() => {
|
||||
if (!settings) return;
|
||||
updateSettings.mutate({
|
||||
...settings,
|
||||
interfaceScale: Math.max(0.4, settings.interfaceScale * 0.9),
|
||||
});
|
||||
}, [settings, updateSettings]);
|
||||
|
||||
const zoomReset = useCallback(() => {
|
||||
if (!settings) return;
|
||||
updateSettings.mutate({ ...settings, interfaceScale: 1 });
|
||||
}, [settings, updateSettings]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user