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:
@@ -6,7 +6,10 @@ import AlertBox from "@/components/ui/AlertBox";
|
||||
import {SessionContext, SessionContextProps} from "@/context/SessionContext";
|
||||
import {LangContext, LangContextProps} from "@/context/LangContext";
|
||||
import {AlertContext, AlertContextProps} from "@/context/AlertContext";
|
||||
import OfflineContext, {OfflineContextType} from '@/context/OfflineContext';
|
||||
import {isDesktop} from '@/lib/configs';
|
||||
import {apiDelete} from '@/lib/api/client';
|
||||
import {deleteSeries} from '@/lib/tauri';
|
||||
|
||||
interface SeriesSettingOption {
|
||||
id: string;
|
||||
@@ -32,18 +35,18 @@ export default function SeriesSettingSidebar(
|
||||
const {session}: SessionContextProps = useContext<SessionContextProps>(SessionContext);
|
||||
const {lang}: LangContextProps = useContext<LangContextProps>(LangContext);
|
||||
const {errorMessage, successMessage}: AlertContextProps = useContext<AlertContextProps>(AlertContext);
|
||||
const {isCurrentlyOffline} = useContext(OfflineContext);
|
||||
const userToken: string = session?.accessToken ? session?.accessToken : '';
|
||||
|
||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState<boolean>(false);
|
||||
|
||||
async function handleDeleteSeries(): Promise<void> {
|
||||
try {
|
||||
const success: boolean = await apiDelete<boolean>(
|
||||
'series/delete',
|
||||
{seriesId: seriesId},
|
||||
userToken,
|
||||
lang
|
||||
);
|
||||
const useLocal: boolean = isDesktop && isCurrentlyOffline();
|
||||
const deletedAt: number = Math.floor(Date.now() / 1000);
|
||||
const success: boolean = useLocal
|
||||
? await deleteSeries(seriesId, deletedAt)
|
||||
: await apiDelete<boolean>('series/delete', {seriesId: seriesId}, userToken, lang);
|
||||
if (success) {
|
||||
successMessage(t('seriesSetting.deleteSuccess'));
|
||||
onClose();
|
||||
|
||||
Reference in New Issue
Block a user