11import React from "react"
2- import { Routes , Route , useNavigate } from "react-router-dom"
2+ import { Routes , Route , useNavigate , BrowserRouter } from "react-router-dom"
33import { Loading } from "./components/Loading"
44import { SERVER_LOADING_MESSAGE } from "./components/constants"
55import { ProductsExplorer } from "./pages/ProductsExplorer"
66import * as PATH from "./routing/constants"
77import { ModelProductPage } from "./pages/ModelProductPage"
88import { DataProductsHome } from "./pages/DataProductsHome"
99import { VerifyEmail } from "./pages/VerifyEmail"
10+ import { PlansPage } from "./pages/PlansPage"
1011import PrivateRoute from "./routing/PrivateRoute"
1112import { DocumentExplorer } from "./pages/DocumentExplorer"
1213import { Documents } from "./pages/Documents"
@@ -27,20 +28,25 @@ import {DocumentTemplate} from "./pages/DocumentTemplate"
2728import { GraphIqlEditor } from "./pages/GraphIqlEditor"
2829import { PageNotFound } from "./pages/PageNotFound"
2930import { DocumentsPageList } from "./pages/DocumentsListPage"
30-
31+ import { PLANS } from "./routing/constants" ;
3132
3233export function App ( props ) {
3334 let navigate = useNavigate ( ) ;
3435 const { connectionError, loadingServer, clientUser, accessControlDashboard, woqlClient} = WOQLClientObj ( )
3536 if ( ! clientUser ) return ""
3637 // we have this loading only in terminusX, it is auth0 information/login loading
3738 const { loading} = clientUser
38-
39+
40+ if ( clientUser . firstLogin === true ) {
41+ clientUser . firstLogin = false
42+ navigate ( `/${ PLANS } ` )
43+ }
44+
3945 // this happen after confirm you password linking in the email url
4046 if ( window . location . search . includes ( "supportSignUp=true" ) ) {
4147 window . location . replace ( '/' )
4248 }
43-
49+
4450 if ( connectionError ) {
4551 return < ServerError message = { connectionError } />
4652 }
@@ -53,16 +59,16 @@ export function App (props){
5359 //the accessControlDashboard in terminusX is created only after the login
5460 // so he can be undefined at the start
5561 const isAdmin = accessControlDashboard ? accessControlDashboard . isAdmin ( ) : false
56-
57- return < div className = "container-fluid container-background h-100" >
58- < Routes >
59- { getRoutes ( clientUser , isAdmin , woqlClient ) }
60- </ Routes >
62+
63+ const basename = process . env . BASE_URL ? { basename :process . env . BASE_URL } : { }
64+
65+ return < div className = "container-fluid container-background h-100" >
66+ < Routes >
67+ { getRoutes ( clientUser , isAdmin , woqlClient ) }
68+ </ Routes >
6169 </ div >
6270}
6371
64- // {getRoutes(clientUser,isAdmin, woqlClient)}
65-
6672function getRoutes ( clientUser , isAdmin , woqlClient ) {
6773 //const client = createApolloClient()
6874
@@ -87,6 +93,7 @@ function getRoutes(clientUser, isAdmin, woqlClient){
8793 return < React . Fragment >
8894 < Route path = "/verify" element = { < VerifyEmail /> } />
8995 < Route path = { PATH . INVITE_PAGE } element = { < PrivateRoute component = { InvitePage } /> } />
96+ < Route path = { PATH . PLANS } element = { < PrivateRoute component = { PlansPage } /> } />
9097 < Route index element = { < PrivateRoute component = { Home } /> } />
9198 < Route path = ":organization" >
9299 < Route index element = { < PrivateRoute component = { OrganizationHome } > </ PrivateRoute > } />
@@ -102,7 +109,6 @@ function getRoutes(clientUser, isAdmin, woqlClient){
102109 < Route index element = { < PrivateRoute component = { ChangeRequests } /> } />
103110 < Route path = ":id" element = { < PrivateRoute component = { ChangeDiff } /> } />
104111 </ Route >
105-
106112 < Route path = { PATH . DOCUMENT_EXPLORER } element = { < DocumentTemplate /> } >
107113 < Route index element = { < PrivateRoute component = { Documents } /> } />
108114 < Route path = ":type" >
@@ -116,7 +122,6 @@ function getRoutes(clientUser, isAdmin, woqlClient){
116122 </ Route >
117123 </ Route >
118124 </ Route >
119-
120125 < Route path = { PATH . PRODUCT_EXPLORER } element = { < PrivateRoute component = { ProductsExplorer } /> } />
121126 < Route path = { PATH . PRODUCT_MODELS } element = { < PrivateRoute component = { ModelProductPage } /> } />
122127 </ Route >
@@ -125,37 +130,3 @@ function getRoutes(clientUser, isAdmin, woqlClient){
125130 < Route path = "*" element = { < PageNotFound /> } />
126131 </ React . Fragment >
127132}
128- // <Route path="test" element={<ApolloProvider client={client}><DocumentList/></ApolloProvider>} />
129- // <Route index element={<PrivateRoute component={DocumentsList01}/>} />
130- /*
131- \ <Route path={PATH.CHANGE_REQUESTS} >
132- <Route index element={<PrivateRoute component={ChangeRequests}/>} />
133- <Route path=":id" element={<PrivateRoute component={ChangeDiff}/> } />
134- </Route>
135- */
136-
137- /* <Route path={"test"} element={<PrivateRoute component={DocumentList}/>} /> */
138- /*
139- return <React.Fragment>
140- <Route path="/verify" element={<VerifyEmail/>}/>
141- <Route path = {INVITE_PAGE} element = {<PrivateRoute component={InvitePage}/>} />
142- <Route index element={<PrivateRoute component={Home}/>} />
143- <Route path=":organization" >
144- <Route index element={<PrivateRoute component={OrganizationHome}></PrivateRoute>}/>
145- <Route path = {PROFILE} element = {<PrivateRoute component={Profile}/>} />
146- {isAdmin && <Route path="administrator" element={<PrivateRoute component={UserManagement}/>}/> }
147- {!isAdmin && <Route path="administrator" element={<div>Not Found 404 !!!!</div >}/> }
148- <Route path="members" element={<PrivateRoute component={UserManagement}/>}/>
149- <Route path=":dataProduct" >
150- <Route index element={<PrivateRoute component={DataProductsHome}/>} />
151-
152- <Route path={"test"} element={<PrivateRoute component={DocumentList}/>} />
153-
154- <Route path={DOCUMENT_EXPLORER} element={<PrivateRoute component={DocumentExplorer}/>} />
155- <Route path={PRODUCT_EXPLORER} element={<PrivateRoute component={ProductsExplorer}/>} />
156- <Route path={PRODUCT_MODELS} element={<PrivateRoute component={ModelProductPage}/>} />
157- </Route>
158- </Route>
159-
160- <Route path="*" element={<div>Not Found 404 !!!!</div >} />
161- </React.Fragment>*/
0 commit comments