Fixed the circular imports and things

This commit is contained in:
Gregory Schier
2024-12-20 23:49:15 -08:00
parent 51a11b6495
commit ec999015ab
83 changed files with 511 additions and 551 deletions

View File

@@ -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],