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:
natreex
2026-03-24 22:45:10 -04:00
parent a114592ac9
commit cfd08e3261
23 changed files with 410 additions and 409 deletions

View File

@@ -339,17 +339,18 @@ export function useLocations(config: UseLocationsConfig): UseLocationsReturn {
}
}
setSections(function (prev: LocationProps[]): LocationProps[] {
const updated: LocationProps[] = [...prev];
const sectionIndex: number = updated.findIndex(function (section: LocationProps): boolean {
return section.id === sectionId;
return prev.map(function (section: LocationProps): LocationProps {
if (section.id !== sectionId) return section;
return {
...section,
elements: [...section.elements, {
id: elementId,
name: newElementNames[sectionId],
description: '',
subElements: [],
}],
};
});
updated[sectionIndex].elements.push({
id: elementId,
name: newElementNames[sectionId],
description: '',
subElements: [],
});
return updated;
});
setNewElementNames(function (prev: { [key: string]: string }): { [key: string]: string } {
return {...prev, [sectionId]: ''};
@@ -404,13 +405,23 @@ export function useLocations(config: UseLocationsConfig): UseLocationsReturn {
}
}
setSections(function (prev: LocationProps[]): LocationProps[] {
const updated: LocationProps[] = [...prev];
updated[sectionIndex].elements[elementIndex].subElements.push({
id: subElementId,
name: newSubElementNames[elementIndex],
description: '',
return prev.map(function (section: LocationProps, i: number): LocationProps {
if (i !== sectionIndex) return section;
return {
...section,
elements: section.elements.map(function (el, j: number) {
if (j !== elementIndex) return el;
return {
...el,
subElements: [...el.subElements, {
id: subElementId,
name: newSubElementNames[elementIndex],
description: '',
}],
};
}),
};
});
return updated;
});
setNewSubElementNames(function (prev: { [key: string]: string }): { [key: string]: string } {
return {...prev, [elementIndex]: ''};

View File

@@ -1,5 +1,5 @@
import {useContext} from 'react';
import {apiGet, apiPost} from '@/lib/api/client';
import {apiGet, apiPatch, apiPost} from '@/lib/api/client';
import {SessionContext} from '@/context/SessionContext';
import {LangContext} from '@/context/LangContext';
import {AlertContext} from '@/context/AlertContext';