@@ -16,11 +16,12 @@ import { Todos } from './containers/Todo'
1616import { TodoGraphQLRelay } from './containers/TodoGraphQLRelay'
1717import { SupplierList } from './containers/SupplierList'
1818import { Files } from './containers/Files'
19- import { Route , useNavigate , Routes } from 'react-router-dom'
19+ import { Route , useNavigate , Routes , useLocation } from 'react-router-dom'
2020
2121const App = ( ) => {
2222 useAuthCheck ( )
2323 const auth = useAuth ( )
24+ const location = useLocation ( )
2425
2526 const navigate = useNavigate ( )
2627 /* CRA: app hooks */
@@ -30,7 +31,7 @@ const App = () => {
3031 return (
3132 < RelayEnvironmentProvider environment = { relayEnvironment } >
3233 < RelayEnvironmentContext . Provider value = { relayEnvironment } >
33- < div className = " App" >
34+ < div className = { ` App ${ location . pathname === '/suppliers' ? 'full-width-layout' : '' } ` } >
3435 < div className = "App-nav-header" >
3536 < div style = { { display : 'flex' , flex : 1 } } >
3637 < a className = "NavButton" onClick = { ( ) => navigate ( '/' ) } > Home</ a >
@@ -48,9 +49,10 @@ const App = () => {
4849 { ! auth . isAuthenticated && < a className = "NavButton" onClick = { ( ) => navigate ( '/login' ) } > Login/Register</ a > }
4950 </ div >
5051 </ div >
52+ < div style = { { margin : '0 auto' , maxWidth : '800px' } } >
5153 < Routes >
52- < Route path = "/" element = { < div style = { { margin : '0 auto' , maxWidth : '800px' } } > < Home /> </ div > } />
53- < Route path = "/todos" element = { < div style = { { margin : '0 auto' , maxWidth : '800px' } } > < Todos /> </ div > } />
54+ < Route path = "/" element = { < Home /> } />
55+ < Route path = "/todos" element = { < Todos /> } />
5456 { /*
5557 CRITICAL: Relay components that use useLazyLoadQuery MUST be wrapped in <Suspense>
5658
@@ -67,29 +69,28 @@ const App = () => {
6769 - User sees a proper loading state followed by the actual content
6870 */ }
6971 < Route path = "/todos-relay" element = {
70- < div style = { { margin : '0 auto' , maxWidth : '800px' } } >
71- < Suspense fallback = { < div > Loading Relay todos...</ div > } >
72- < TodoGraphQLRelay />
73- </ Suspense >
74- </ div >
72+ < Suspense fallback = { < div > Loading Relay todos...</ div > } >
73+ < TodoGraphQLRelay />
74+ </ Suspense >
7575 } />
7676 < Route path = "/suppliers" element = {
7777 < Suspense fallback = { < div > Loading suppliers...</ div > } >
7878 < SupplierList />
7979 </ Suspense >
8080 } />
8181 { /* CRA: routes */ }
82- < Route path = "/files" element = { < div style = { { margin : '0 auto' , maxWidth : '800px' } } > < Files /> </ div > } />
83- < Route path = "/login" element = { < div style = { { margin : '0 auto' , maxWidth : '800px' } } > < LoginPage /> </ div > } />
84- < Route path = "/oauth/success" element = { < div style = { { margin : '0 auto' , maxWidth : '800px' } } > < OauthLoginResultPage /> </ div > } />
85- < Route path = "/oauth/error" element = { < div style = { { margin : '0 auto' , maxWidth : '800px' } } > < OauthLoginResultPage /> </ div > } />
86- < Route path = "/recovery" element = { < div style = { { margin : '0 auto' , maxWidth : '800px' } } > < RecoveryPage /> </ div > } />
87- < Route path = "/reset" element = { < div style = { { margin : '0 auto' , maxWidth : '800px' } } > < ResetPage /> </ div > } />
88- < Route path = "/activate" element = { < div style = { { margin : '0 auto' , maxWidth : '800px' } } > < ActivationPage /> </ div > } />
89- < Route path = "/register" element = { < div style = { { margin : '0 auto' , maxWidth : '800px' } } > < RegistrationPage /> </ div > } />
90- < Route path = "/account" element = { < div style = { { margin : '0 auto' , maxWidth : '800px' } } > < AccountPage /> </ div > } />
82+ < Route path = "/files" element = { < Files /> } />
83+ < Route path = "/login" element = { < LoginPage /> } />
84+ < Route path = "/oauth/success" element = { < OauthLoginResultPage /> } />
85+ < Route path = "/oauth/error" element = { < OauthLoginResultPage /> } />
86+ < Route path = "/recovery" element = { < RecoveryPage /> } />
87+ < Route path = "/reset" element = { < ResetPage /> } />
88+ < Route path = "/activate" element = { < ActivationPage /> } />
89+ < Route path = "/register" element = { < RegistrationPage /> } />
90+ < Route path = "/account" element = { < AccountPage /> } />
9191
9292 </ Routes >
93+ </ div >
9394 </ div >
9495 </ RelayEnvironmentContext . Provider >
9596 </ RelayEnvironmentProvider >
0 commit comments