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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user