Remove useNavigate everywhere, and make request a query param. And convert dialog to Jotai

This commit is contained in:
Gregory Schier
2025-01-06 16:54:07 -08:00
parent 806a8eb801
commit bc50891edb
54 changed files with 592 additions and 545 deletions

View File

@@ -1,20 +1,17 @@
import { ExportDataDialog } from '../components/ExportDataDialog';
import { showAlert } from '../lib/alert';
import { showDialog } from '../lib/dialog';
import { jotaiStore } from '../lib/jotai';
import { getActiveWorkspace } from './useActiveWorkspace';
import { useAlert } from './useAlert';
import { useDialog } from './useDialog';
import { useFastMutation } from './useFastMutation';
import { showToast } from '../lib/toast';
import { getActiveWorkspace } from './useActiveWorkspace';
import { useFastMutation } from './useFastMutation';
import { workspacesAtom } from './useWorkspaces';
export function useExportData() {
const alert = useAlert();
const dialog = useDialog();
return useFastMutation({
mutationKey: ['export_data'],
onError: (err: string) => {
alert({ id: 'export-failed', title: 'Export Failed', body: err });
showAlert({ id: 'export-failed', title: 'Export Failed', body: err });
},
mutationFn: async () => {
const activeWorkspace = getActiveWorkspace();
@@ -22,7 +19,7 @@ export function useExportData() {
if (activeWorkspace == null || workspaces.length === 0) return;
dialog.show({
showDialog({
id: 'export-data',
title: 'Export App Data',
size: 'md',