mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-27 11:51:13 +01:00
Fixed the circular imports and things
This commit is contained in:
@@ -1,27 +1,26 @@
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
import { SettingsTab } from '../components/Settings/Settings';
|
||||
import { useRouter } from '@tanstack/react-router';
|
||||
import { SettingsTab } from '../components/Settings/SettingsTab';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { router } from '../main';
|
||||
import { Route as SettingsRoute } from '../routes/workspaces/settings';
|
||||
import { useActiveWorkspace } from './useActiveWorkspace';
|
||||
import { getActiveWorkspaceId } from './useActiveWorkspace';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
|
||||
export function useOpenSettings(tab = SettingsTab.General) {
|
||||
const workspace = useActiveWorkspace();
|
||||
|
||||
const router = useRouter();
|
||||
return useFastMutation({
|
||||
mutationKey: ['open_settings'],
|
||||
mutationFn: async () => {
|
||||
if (workspace == null) return;
|
||||
const workspaceId = getActiveWorkspaceId();
|
||||
if (workspaceId == null) return;
|
||||
|
||||
trackEvent('dialog', 'show', { id: 'settings', tab: `${tab}` });
|
||||
const location = router.buildLocation({
|
||||
to: SettingsRoute.fullPath,
|
||||
params: { workspaceId: workspace.id },
|
||||
to: '/workspaces/$workspaceId/settings',
|
||||
params: { workspaceId },
|
||||
search: { tab },
|
||||
});
|
||||
await invokeCmd('cmd_new_child_window', {
|
||||
url: location,
|
||||
url: location.href,
|
||||
label: 'settings',
|
||||
title: 'Yaak Settings',
|
||||
innerSize: [600, 550],
|
||||
|
||||
Reference in New Issue
Block a user