refactor: update profile navigation to show AgentHomeScreen and restrict app-wide routing to standard user dashboard
This commit is contained in:
@@ -14,7 +14,6 @@ import 'package:real_estate_mobile/features/faq/presentation/screens/faq_screen.
|
||||
import 'package:real_estate_mobile/features/home/presentation/screens/home_screen.dart';
|
||||
import 'package:real_estate_mobile/features/messaging/presentation/screens/conversations_screen.dart';
|
||||
import 'package:real_estate_mobile/features/messaging/presentation/screens/chat_screen.dart';
|
||||
import 'package:real_estate_mobile/features/agents/presentation/screens/agent_home_screen.dart';
|
||||
import 'package:real_estate_mobile/features/contact/presentation/screens/contact_screen.dart';
|
||||
import 'package:real_estate_mobile/features/about/presentation/screens/about_screen.dart';
|
||||
import 'package:real_estate_mobile/features/agents/presentation/screens/agent_network_screen.dart';
|
||||
@@ -289,9 +288,8 @@ final routerProvider = Provider<GoRouter>((ref) {
|
||||
);
|
||||
});
|
||||
|
||||
/// Reactively switches between HomeScreen and AgentHomeScreen based on auth.
|
||||
/// Shows a loading indicator while auth status is being determined to prevent
|
||||
/// flashing the wrong screen on refresh.
|
||||
/// Always shows the user HomeScreen for /home. Agents reach their own
|
||||
/// dashboard via the Edit Profile tab in the Profile section.
|
||||
class _HomeRouteWrapper extends ConsumerWidget {
|
||||
const _HomeRouteWrapper();
|
||||
|
||||
@@ -308,10 +306,8 @@ class _HomeRouteWrapper extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
if (authState.status == AuthStatus.authenticated &&
|
||||
authState.user?.role == 'AGENT') {
|
||||
return const AgentHomeScreen();
|
||||
}
|
||||
// Home icon always shows the User Home Page regardless of role.
|
||||
// Agents access their own dashboard via the Edit Profile tab in /profile.
|
||||
return const HomeScreen();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user