1- import { Suspense , memo } from "react" ;
1+ import { memo } from "react" ;
22import {
33 IonApp ,
44 IonRouterOutlet ,
@@ -13,15 +13,15 @@ import { ReactComponent as PortfolioSVG } from "src/assets/svg/portfolio.svg";
1313import { ReactComponent as SuperfeedSVG } from "src/assets/svg/superfeed.svg" ;
1414import { useAuth } from "./api/hooks" ;
1515import { useGetFeaturesQuery } from "./api/services" ;
16- import { lazyRetry } from "./api/utils/helpers" ;
1716import CONFIG from "./config" ;
1817import ToastContainer from "./containers/toasts/ToastContainer" ;
19- import PreloaderPage from "./pages/preloader" ;
2018import "@alphaday/ui-kit/global.scss" ;
2119import "./customIonicStyles.scss" ;
22- import { mobileRoutes } from "./routes" ;
23-
24- const SuperfeedPage = lazyRetry ( ( ) => import ( "./mobile-pages/superfeed" ) ) ;
20+ import {
21+ EMobileRoutePaths ,
22+ EMobileTabRoutePaths ,
23+ mobileRoutes ,
24+ } from "./routes" ;
2525
2626const { IS_DEV } = CONFIG ;
2727
@@ -46,69 +46,95 @@ const CustomNavTab: React.FC<{
4646 * to a modal.
4747 * For the MVP it's fine to nest everything within /superfeed
4848 */
49- const TabNavigator : React . FC = ( ) => {
49+ const MobileApp : React . FC = ( ) => {
50+ useGetFeaturesQuery ( ) ;
5051 const { isAuthenticated } = useAuth ( ) ;
5152 return (
52- < IonTabs >
53- < IonRouterOutlet >
54- { mobileRoutes . map ( ( route ) => (
55- < Route
56- key = { route . path }
57- path = { route . path }
58- exact = { route . exact ?? false }
59- render = { ( ) => {
53+ < IonApp className = "theme-dark" >
54+ < IonReactRouter >
55+ < IonTabs >
56+ < IonRouterOutlet ionPage >
57+ { mobileRoutes . map ( ( route ) => {
6058 if ( route . type === "redirect" ) {
61- return < Redirect to = { route . redirectTo } /> ;
59+ return (
60+ < Redirect
61+ key = { route . path }
62+ path = { route . path }
63+ to = { route . redirectTo }
64+ exact = { route . exact ?? false }
65+ />
66+ ) ;
6267 }
68+ if ( route . type === "fallback" ) {
69+ return (
70+ < Route
71+ render = { ( ) => (
72+ < Redirect to = { route . redirectTo } />
73+ ) }
74+ />
75+ ) ;
76+ }
77+ // if the route is authwalled, let's just redirect to superfeed page.
6378 if ( route . authWalled && ! isAuthenticated ) {
64- return < SuperfeedPage /> ;
79+ return (
80+ < Redirect
81+ key = { route . path }
82+ path = { route . path }
83+ to = { EMobileRoutePaths . Superfeed }
84+ exact = { route . exact ?? false }
85+ />
86+ ) ;
6587 }
66- return < route . component /> ;
67- } }
68- />
69- ) ) }
70- </ IonRouterOutlet >
71- < IonTabBar slot = "bottom" >
72- < IonTabButton tab = "superfeed" href = "/superfeed" >
73- < CustomNavTab label = "Superfeed" Icon = { SuperfeedSVG } />
74- </ IonTabButton >
75- { IS_DEV && (
76- < IonTabButton tab = "market" href = "/market" >
77- < CustomNavTab label = "Market" Icon = { MarketsSVG } />
78- </ IonTabButton >
79- ) }
80- < IonTabButton
81- tab = "portfolio"
82- href = "/portfolio"
83- disabled = { ! IS_DEV }
84- >
85- < CustomNavTab
86- label = "Portfolio"
87- Icon = { PortfolioSVG }
88- disabled = { ! IS_DEV }
89- />
90- </ IonTabButton >
91- </ IonTabBar >
92- </ IonTabs >
93- ) ;
94- } ;
95-
96- const MobileApp : React . FC = ( ) => {
97- useGetFeaturesQuery ( ) ;
98-
99- return (
100- < IonApp className = "theme-dark" >
101- < IonReactRouter >
102- < IonRouterOutlet >
103- < Suspense fallback = { < PreloaderPage /> } >
104- < Route path = "/" render = { ( ) => < TabNavigator /> } />
105- </ Suspense >
106- </ IonRouterOutlet >
88+ return (
89+ < Route
90+ key = { route . path }
91+ path = { route . path }
92+ exact = { route . exact ?? false }
93+ render = { ( ) => < route . component /> }
94+ />
95+ ) ;
96+ } ) }
97+ </ IonRouterOutlet >
98+ < IonTabBar slot = "bottom" >
99+ < IonTabButton
100+ tab = "superfeed"
101+ href = { EMobileTabRoutePaths . Superfeed }
102+ >
103+ < CustomNavTab
104+ label = "Superfeed"
105+ Icon = { SuperfeedSVG }
106+ />
107+ </ IonTabButton >
108+ { IS_DEV && (
109+ < IonTabButton
110+ tab = "market"
111+ href = { EMobileTabRoutePaths . Market }
112+ >
113+ < CustomNavTab
114+ label = "Market"
115+ Icon = { MarketsSVG }
116+ />
117+ </ IonTabButton >
118+ ) }
119+ < IonTabButton
120+ tab = "portfolio"
121+ href = { EMobileTabRoutePaths . Portfolio }
122+ disabled = { ! IS_DEV }
123+ >
124+ < CustomNavTab
125+ label = "Portfolio"
126+ Icon = { PortfolioSVG }
127+ disabled = { ! IS_DEV }
128+ />
129+ </ IonTabButton >
130+ </ IonTabBar >
131+ </ IonTabs >
107132 </ IonReactRouter >
108133 < ToastContainer
109134 position = "bottom-center"
110135 duration = { CONFIG . UI . TOAST_DURATION }
111- className = "fontGroup-supportBold mb-20"
136+ className = "fontGroup-supportBold"
137+ containerClassName = "last:mb-20"
112138 />
113139 </ IonApp >
114140 ) ;
0 commit comments