Integrate offline logic for book creation and enhance synchronization

- Add offline handling to `AddNewBookForm` by updating `BooksSyncContext` with server-only and local-only book management.
- Refactor `guideTourDone` to check offline completion states via `localStorage`.
- Update and lock dependencies, including `@esbuild` and `@next`, to latest versions.
- Clean up unused session state updates in book creation logic.
This commit is contained in:
natreex
2025-12-15 23:03:32 -05:00
parent 64c7cb6243
commit f5e66f8983
5 changed files with 1327 additions and 823 deletions

View File

@@ -71,8 +71,22 @@ export default class User {
}
static guideTourDone(guide: GuideTour[], tour: string): boolean {
if (!guide || !tour) return false;
return guide.find((guide: GuideTour): boolean => guide[tour]) === undefined;
if (!tour) return false;
// Vérifier d'abord dans le guide du serveur
if (guide && guide.find((guide: GuideTour): boolean => guide[tour]) !== undefined) {
return false;
}
// Vérifier ensuite dans localStorage pour le mode offline
if (typeof window !== 'undefined' && window.localStorage) {
const completedGuides = JSON.parse(localStorage.getItem('completedGuides') || '[]');
if (completedGuides.includes(tour)) {
return false;
}
}
return true;
}
static setNewGuideTour(session: SessionProps, tour: string): SessionProps {