Remove unused assets, refactor migration handling, and add crash reporting

- Deleted obsolete icons, layout files, and SVG assets.
- Added `useAutoUpdate` hook for streamlined update logic.
- Introduced `auto_migrate_electron` and migration commands for Electron-to-Tauri data migration.
- Implemented `init_panic_hook` for improved crash reporting.
- Updated `.gitignore` for Tauri build output and IDE-specific files.
This commit is contained in:
natreex
2026-04-07 16:43:54 -04:00
parent 5c7e71ce9e
commit 19c8d0057c
26 changed files with 515 additions and 63 deletions

67
hooks/useAutoUpdate.ts Normal file
View File

@@ -0,0 +1,67 @@
import {useEffect, useState} from 'react';
import {check, Update} from '@tauri-apps/plugin-updater';
import {relaunch} from '@tauri-apps/plugin-process';
export interface UpdateState {
available: boolean;
version: string;
notes: string;
downloading: boolean;
progress: number;
install: () => Promise<void>;
dismiss: () => void;
}
export function useAutoUpdate(): UpdateState {
const [available, setAvailable] = useState(false);
const [version, setVersion] = useState('');
const [notes, setNotes] = useState('');
const [downloading, setDownloading] = useState(false);
const [progress, setProgress] = useState(0);
const [update, setUpdate] = useState<Update | null>(null);
useEffect(() => {
let cancelled = false;
async function checkForUpdate() {
try {
const result = await check();
if (cancelled || !result) return;
setUpdate(result);
setAvailable(true);
setVersion(result.version);
setNotes(result.body ?? '');
} catch (_) {
// silently fail — no update or offline
}
}
checkForUpdate();
return () => { cancelled = true; };
}, []);
async function install() {
if (!update) return;
setDownloading(true);
try {
await update.downloadAndInstall((event) => {
if (event.event === 'Started' && event.data.contentLength) {
setProgress(0);
} else if (event.event === 'Progress') {
setProgress((prev) => prev + event.data.chunkLength);
} else if (event.event === 'Finished') {
setProgress(100);
}
});
await relaunch();
} catch (_) {
setDownloading(false);
}
}
function dismiss() {
setAvailable(false);
}
return {available, version, notes, downloading, progress, install, dismiss};
}