Migrate from window.electron to tauri IPC functions across components

- Replaced `window.electron.invoke` calls with equivalent `tauri` function calls for all IPC interactions.
- Removed `electron.d.ts` TypeScript definitions as they are no longer needed.
- Updated related logic for offline/online state synchronization.
- Added `types.rs` and `shared/mod.rs` modules to support Tauri IPC integration with Rust enums and shared logic.
- Refactored IPC request queues to use updated handler names for consistency with Tauri.
This commit is contained in:
natreex
2026-03-21 09:34:13 -04:00
parent 1a15692e40
commit ee4438834c
144 changed files with 21258 additions and 876 deletions

View File

@@ -1,4 +1,5 @@
'use client'
import * as tauri from '@/lib/tauri';
import React, {useCallback, useContext, useEffect, useState} from 'react';
import {useTranslations} from 'next-intl';
import {BookContext} from '@/context/BookContext';
@@ -33,10 +34,7 @@ export default function ExportSetting(): React.JSX.Element {
if (!book) return;
setIsLoading(true);
try {
const chaptersInfo: ChapterExportInfo[] = await window.electron.invoke<ChapterExportInfo[]>(
'db:book:export:info',
{bookId: book.bookId}
);
const chaptersInfo: ChapterExportInfo[] = await tauri.getBookExportInfo(book.bookId) as ChapterExportInfo[];
setChapters(chaptersInfo);
const initialSelections: ChapterExportSelection[] = chaptersInfo.map(
(ch: ChapterExportInfo): ChapterExportSelection => ({
@@ -92,7 +90,7 @@ export default function ExportSetting(): React.JSX.Element {
.filter((s: ChapterExportSelection): boolean => s.selected)
.map((s: ChapterExportSelection) => ({chapterId: s.chapterId, version: s.version}));
const result: boolean = await window.electron.invoke<boolean>('db:book:export', {
const result: boolean = await tauri.exportBook({
bookId: book.bookId,
format,
selections: selectedChapters.length === chapters.length ? null : selectedChapters