diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 388217fc9..e0bb39147 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -140,17 +140,13 @@ abstract class AppRoutes { ), GoRoute( path: '/join_with_alias', - pageBuilder: (context, state) => defaultPageBuilder( - context, - state, - const JoinWithAlias(), - ), - redirect: (context, state) { - if (Matrix.of(context).client.isLogged()) { - return '/rooms/join_with_alias?alias=${state.uri.queryParameters['alias']}'; - } - return null; - }, + pageBuilder: (context, state) => Matrix.of(context).client.isLogged() + ? chatListShellRouteBuilder(context, state, const JoinWithAlias()) + : defaultPageBuilder( + context, + state, + const JoinWithAlias(), + ), ), GoRoute( path: '/user_age', @@ -161,6 +157,32 @@ abstract class AppRoutes { ), redirect: loggedOutRedirect, ), + ShellRoute( + pageBuilder: chatListShellRouteBuilder, + routes: [ + GoRoute( + path: '/homepage', + redirect: loggedOutRedirect, + pageBuilder: (context, state) => defaultPageBuilder( + context, + state, + const SuggestionsPage(), + ), + routes: [ + ...newRoomRoutes, + GoRoute( + path: '/planner', + redirect: loggedOutRedirect, + pageBuilder: (context, state) => defaultPageBuilder( + context, + state, + const ActivityGenerator(), + ), + ), + ], + ), + ], + ), // Pangea# ShellRoute( // Never use a transition on the shell route. Changing the PageBuilder @@ -206,66 +228,6 @@ abstract class AppRoutes { ), ), routes: [ - // #Pangea - // GoRoute( - // path: 'mylearning', - // pageBuilder: (context, state) => defaultPageBuilder( - // context, - // state, - // const StudentAnalyticsPage( - // selectedView: BarChartViewSelection.messages, - // ), - // ), - // redirect: loggedOutRedirect, - // ), - // GoRoute( - // path: 'analytics', - // pageBuilder: (context, state) => defaultPageBuilder( - // context, - // state, - // const AnalyticsSpaceList(), - // ), - // redirect: loggedOutRedirect, - // routes: [ - // GoRoute( - // path: ':spaceid', - // pageBuilder: (context, state) => defaultPageBuilder( - // context, - // state, - // const SpaceAnalyticsPage( - // selectedView: BarChartViewSelection.messages, - // ), - // ), - // ), - // ], - // ), - GoRoute( - path: '/join_with_alias', - pageBuilder: (context, state) => defaultPageBuilder( - context, - state, - const JoinWithAlias(), - ), - ), - GoRoute( - path: '/homepage', - redirect: loggedOutRedirect, - pageBuilder: (context, state) => defaultPageBuilder( - context, - state, - const SuggestionsPage(), - ), - ), - GoRoute( - path: '/planner', - redirect: loggedOutRedirect, - pageBuilder: (context, state) => defaultPageBuilder( - context, - state, - const ActivityGenerator(), - ), - ), - // Pangea# GoRoute( path: 'archive', pageBuilder: (context, state) => defaultPageBuilder( @@ -299,10 +261,7 @@ abstract class AppRoutes { redirect: loggedOutRedirect, ), GoRoute( - // #Pangea - // path: 'newgroup', path: 'newgroup', - // Pangea# pageBuilder: (context, state) => defaultPageBuilder( context, state, @@ -725,4 +684,53 @@ abstract class AppRoutes { // child: child, // ); // Pangea# + + // #Pangea + static List get newRoomRoutes => [ + GoRoute( + path: 'newgroup', + pageBuilder: (context, state) => defaultPageBuilder( + context, + state, + const NewGroup(), + ), + redirect: loggedOutRedirect, + ), + GoRoute( + path: 'newspace', + pageBuilder: (context, state) => defaultPageBuilder( + context, + state, + const NewGroup(createGroupType: CreateGroupType.space), + ), + redirect: loggedOutRedirect, + ), + ]; + + static Page chatListShellRouteBuilder( + context, + state, + child, + ) => + noTransitionPageBuilder( + context, + state, + FluffyThemes.isColumnMode(context) && + state.fullPath?.startsWith('/rooms/settings') == false + ? TwoColumnLayout( + mainView: ChatList( + activeChat: state.pathParameters['roomid'], + displayNavigationRail: + state.path?.startsWith('/rooms/settings') != true, + ), + sideView: child, + ) + : FluffyThemes.isColumnMode(context) || + (state.fullPath?.split("/").reversed.elementAt(1) == + 'rooms' && + state.pathParameters['roomid'] != null) + ? child + : BottomNavLayout(mainView: child), + ); + // Pangea# } diff --git a/lib/pangea/activity_suggestions/activity_suggestions_area.dart b/lib/pangea/activity_suggestions/activity_suggestions_area.dart index 656d99cd0..52f6b95e8 100644 --- a/lib/pangea/activity_suggestions/activity_suggestions_area.dart +++ b/lib/pangea/activity_suggestions/activity_suggestions_area.dart @@ -154,7 +154,7 @@ class ActivitySuggestionsAreaState extends State { children: [ InkWell( customBorder: const CircleBorder(), - onTap: () => context.go('/rooms/newgroup'), + onTap: () => context.go('/homepage/newgroup'), child: Container( decoration: BoxDecoration( color: theme.colorScheme.surfaceContainerHighest, @@ -193,7 +193,7 @@ class ActivitySuggestionsAreaState extends State { ), InkWell( customBorder: const CircleBorder(), - onTap: () => context.go('/rooms/planner'), + onTap: () => context.go('/homepage/planner'), child: Container( decoration: BoxDecoration( color: theme.colorScheme.surfaceContainerHighest, diff --git a/lib/pangea/layouts/bottom_nav_layout.dart b/lib/pangea/layouts/bottom_nav_layout.dart index 3332a673d..4bd7ee99a 100644 --- a/lib/pangea/layouts/bottom_nav_layout.dart +++ b/lib/pangea/layouts/bottom_nav_layout.dart @@ -43,7 +43,7 @@ class BottomNavBarState extends State { void onItemTapped(int index) { switch (index) { case 0: - context.go('/rooms/homepage'); + context.go('/homepage'); break; case 1: context.go('/rooms');