Add terms of use translations, sync detection, and refactor book components
- Introduced new translations for terms of use in French and English locales. - Added sync status detection logic for books in `BookList` and `BookCard` components. - Refactored `BookCard` to handle additional props and improve layout flexibility. - Enhanced `TermsOfUse` component with complete localization support and refuse functionality. - Updated data decryption logic in Rust services to handle optional fields and additional metadata consistently. - Improved offline/online synchronization workflows with extended context properties.
This commit is contained in:
13
lib/tauri.ts
13
lib/tauri.ts
@@ -679,7 +679,12 @@ export async function applySeriesTombstones(tombstones: TombstoneRecord[]): Prom
|
||||
|
||||
// ─── Window Management ──────────────────────────────────────
|
||||
|
||||
let loginWindowOpening = false;
|
||||
|
||||
export async function openLoginWindow(): Promise<void> {
|
||||
if (loginWindowOpening) return;
|
||||
loginWindowOpening = true;
|
||||
|
||||
const {WebviewWindow} = await import('@tauri-apps/api/webviewWindow');
|
||||
const {getCurrentWindow} = await import('@tauri-apps/api/window');
|
||||
|
||||
@@ -687,6 +692,7 @@ export async function openLoginWindow(): Promise<void> {
|
||||
if (existing) {
|
||||
await existing.setFocus();
|
||||
await getCurrentWindow().hide();
|
||||
loginWindowOpening = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -701,6 +707,7 @@ export async function openLoginWindow(): Promise<void> {
|
||||
});
|
||||
|
||||
loginWindow.once('tauri://created', async function () {
|
||||
loginWindowOpening = false;
|
||||
await getCurrentWindow().hide();
|
||||
});
|
||||
}
|
||||
@@ -712,20 +719,20 @@ export async function loginSuccess(): Promise<void> {
|
||||
const currentLabel = getCurrentWindow().label;
|
||||
|
||||
if (currentLabel === 'login') {
|
||||
const {emit} = await import('@tauri-apps/api/event');
|
||||
await emit('auth-success');
|
||||
const mainWindow = await WebviewWindow.getByLabel('main');
|
||||
if (mainWindow) {
|
||||
await mainWindow.show();
|
||||
await mainWindow.setFocus();
|
||||
await mainWindow.emit('auth-success');
|
||||
}
|
||||
await getCurrentWindow().close();
|
||||
getCurrentWindow().close();
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
export async function logout(): Promise<void> {
|
||||
await removeToken();
|
||||
await openLoginWindow();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user