Mobile Work

This commit is contained in:
Eric Gullickson
2025-09-19 11:33:31 -05:00
parent 040da4c759
commit 3588372cef
7 changed files with 189 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
import { create } from 'zustand';
import { persist, createJSONStorage } from 'zustand/middleware';
import { safeStorage } from '../utils/safe-storage';
export type MobileScreen = 'Dashboard' | 'Vehicles' | 'Log Fuel' | 'Settings';
export type VehicleSubScreen = 'list' | 'detail' | 'add' | 'edit';
@@ -193,13 +194,20 @@ export const useNavigationStore = create<NavigationState>()(
}),
{
name: 'motovaultpro-mobile-navigation',
storage: createJSONStorage(() => localStorage),
storage: createJSONStorage(() => safeStorage),
partialize: (state) => ({
activeScreen: state.activeScreen,
vehicleSubScreen: state.vehicleSubScreen,
selectedVehicleId: state.selectedVehicleId,
formStates: state.formStates,
}),
onRehydrateStorage: () => (state) => {
if (state) {
console.log('[Navigation] State rehydrated successfully');
} else {
console.warn('[Navigation] State rehydration failed, using defaults');
}
},
}
)
);