Update database schema and synchronization logic

- Add `useEffect` in `ScribeLeftBar` for handling book state changes.
- Extend `BooksSyncContext` with new properties and stricter typings.
- Refine `Repositories` to include `lastUpdate` handling for synchronization processes.
- Add comprehensive `fetchComplete*` repository methods for retrieving entity-specific sync data.
- Enhance offline logic for chapters, characters, locations, and world synchronization.
- Improve error handling across IPC handlers and repositories.
This commit is contained in:
natreex
2025-12-15 20:55:24 -05:00
parent bb331b5c22
commit 64c7cb6243
23 changed files with 1609 additions and 79 deletions

View File

@@ -8,14 +8,15 @@ import {SessionContext} from "@/context/SessionContext";
import {useTranslations} from "next-intl";
import {AlertContext} from "@/context/AlertContext";
import {BookContext} from "@/context/BookContext";
import {BooksSyncContext, BooksSyncContextProps} from "@/context/BooksSyncContext";
export default function ScribeFooterBar() {
const t = useTranslations();
const {chapter} = useContext(ChapterContext);
const {book} = useContext(BookContext);
const editor: Editor | null = useContext(EditorContext).editor;
const {session} = useContext(SessionContext);
const {errorMessage} = useContext(AlertContext)
const {serverOnlyBooks,localOnlyBooks} = useContext<BooksSyncContextProps>(BooksSyncContext);
const [wordsCount, setWordsCount] = useState<number>(0);
@@ -91,7 +92,7 @@ export default function ScribeFooterBar() {
className="flex items-center gap-2 bg-secondary/50 px-4 py-2 rounded-xl border border-secondary shadow-sm">
<FontAwesomeIcon icon={faBook} className={'text-primary w-4 h-4'}/>
<span className="text-muted text-sm font-medium mr-1">{t('scribeFooterBar.books')}:</span>
<span className="text-text-primary font-bold">{session.user?.books?.length}</span>
<span className="text-text-primary font-bold">{(serverOnlyBooks.length+localOnlyBooks.length)}</span>
</div>
</div>
)