refactor: implement role-based profile dashboard with custom tab navigation and barber-specific views

This commit is contained in:
2026-05-12 16:55:52 +01:00
parent d29cf7535b
commit a657308f9d
4 changed files with 380 additions and 455 deletions

View File

@@ -69,19 +69,24 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
useEffect(() => {
let mounted = true;
storage.get<{ favorites?: string[]; cart?: CartItem[] }>('smart-agenda-mobile-state', {}).then((stored) => {
if (!mounted) return;
if (Array.isArray(stored.favorites)) setFavorites(stored.favorites);
if (Array.isArray(stored.cart)) setCart(stored.cart);
});
if (user?.id) {
storage.get<{ favorites?: string[]; cart?: CartItem[] }>(`smart-agenda-user-${user.id}`, {}).then((stored) => {
if (!mounted) return;
setFavorites(Array.isArray(stored.favorites) ? stored.favorites : []);
});
} else {
setFavorites([]);
}
return () => {
mounted = false;
};
}, []);
}, [user?.id]);
useEffect(() => {
storage.set('smart-agenda-mobile-state', { favorites, cart });
}, [favorites, cart]);
if (user?.id) {
storage.set(`smart-agenda-user-${user.id}`, { favorites, cart });
}
}, [favorites, cart, user?.id]);
const applySupabaseUser = async (authUser: any): Promise<User | undefined> => {
if (!authUser) return undefined;