Bump app version to 0.5.0 and implement offline mode support across components
- Added offline detection logic with `OfflineContext` to improve app functionality in offline scenarios. - Integrated Tauri IPC functions to handle local tool settings and character attributes when offline. - Refined indentation logic in `TextEditor` for better compatibility with WebKit engines. - Removed unused `indent` property and related settings in editor components to simplify configuration. - Updated locale files with improved translation consistency and parameterized placeholders.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
'use client';
|
||||
import React, {ChangeEvent, Dispatch, SetStateAction, useContext, useState} from "react";
|
||||
import {AlertContext, AlertContextProps} from "@/context/AlertContext";
|
||||
import OfflineContext, {OfflineContextType} from '@/context/OfflineContext';
|
||||
import {isDesktop} from '@/lib/configs';
|
||||
import {apiPost} from '@/lib/api/client';
|
||||
import {createSeries} from '@/lib/tauri';
|
||||
import {SessionContext, SessionContextProps} from "@/context/SessionContext";
|
||||
import {Book, Check, Layers, Pencil} from 'lucide-react';
|
||||
import InputField from "@/components/form/InputField";
|
||||
@@ -24,6 +27,7 @@ export default function AddNewSeriesForm({setCloseForm, onSeriesCreated}: AddNew
|
||||
const {lang}: LangContextProps = useContext<LangContextProps>(LangContext);
|
||||
const {session}: SessionContextProps = useContext<SessionContextProps>(SessionContext);
|
||||
const {errorMessage, successMessage}: AlertContextProps = useContext<AlertContextProps>(AlertContext);
|
||||
const {isCurrentlyOffline} = useContext(OfflineContext);
|
||||
const {
|
||||
serverSyncedBooks,
|
||||
setServerSyncedBooks
|
||||
@@ -60,16 +64,10 @@ export default function AddNewSeriesForm({setCloseForm, onSeriesCreated}: AddNew
|
||||
|
||||
setIsAddingSeries(true);
|
||||
try {
|
||||
const response: string = await apiPost<string>(
|
||||
'series/add',
|
||||
{
|
||||
name: name,
|
||||
description: description || null,
|
||||
bookIds: selectedBookIds,
|
||||
},
|
||||
token,
|
||||
lang
|
||||
);
|
||||
const useLocal: boolean = isDesktop && isCurrentlyOffline();
|
||||
const response: string = useLocal
|
||||
? await createSeries({name, description: description || null, bookIds: selectedBookIds})
|
||||
: await apiPost<string>('series/add', {name, description: description || null, bookIds: selectedBookIds}, token, lang);
|
||||
if (!response) {
|
||||
errorMessage(t('addNewSeriesForm.error.addingSeries'));
|
||||
setIsAddingSeries(false);
|
||||
|
||||
Reference in New Issue
Block a user