Recreate the org flow
This commit is contained in:
parent
ac733af3b5
commit
49e4bd8f8a
8 changed files with 233 additions and 107 deletions
31
src/App.tsx
31
src/App.tsx
|
|
@ -19,6 +19,8 @@ import type {userObject} from "./hooks/UserContext.ts";
|
|||
import Organisations from "./Organisations.tsx";
|
||||
import {RefreshContext} from "./hooks/RefreshContext.ts";
|
||||
import Bridges from "./Bridges.tsx";
|
||||
import {OrgContext, type OrgContextType, type OrgObject} from "./hooks/OrgContext.ts";
|
||||
import CreateOrgFlow from "./CreateOrgFlow.tsx";
|
||||
|
||||
const { Header, Content, Sider } = Layout;
|
||||
|
||||
|
|
@ -72,9 +74,28 @@ const App: React.FC = () => {
|
|||
},
|
||||
setCurrentUser: () => {}
|
||||
}
|
||||
|
||||
const defaultOrg: OrgContextType = {
|
||||
currentOrg: {
|
||||
name: "",
|
||||
status: "partial",
|
||||
root_user_email: "",
|
||||
billing_contact: {email: "", id: -1},
|
||||
owner_contact: {email: "", id: -1},
|
||||
security_contact: {email: "", id: -1},
|
||||
organisation_id: -1,
|
||||
intake_questionnaire: {
|
||||
question_one: "",
|
||||
question_two: "",
|
||||
question_three: "",
|
||||
},
|
||||
},
|
||||
setCurrentOrg: () => {}
|
||||
}
|
||||
|
||||
const [currentUser, setCurrentUser] = useState<userObject>(defaultUser.currentUser);
|
||||
const [refreshKey, setRefreshKey] = useState<number>(1);
|
||||
|
||||
const [currentOrg, setCurrentOrg] = useState<OrgObject>(defaultOrg.currentOrg);
|
||||
|
||||
|
||||
/*****************************
|
||||
|
|
@ -132,7 +153,7 @@ const App: React.FC = () => {
|
|||
navigate('/profile');
|
||||
break;
|
||||
case 'orgs':
|
||||
navigate('/organisations');
|
||||
navigate('/create-org-flow');
|
||||
break;
|
||||
case 'logout':
|
||||
auth.removeUser().then(() => navigate('/profile'));
|
||||
|
|
@ -154,7 +175,7 @@ const App: React.FC = () => {
|
|||
|
||||
if (currentUser.organisations.length > 0) {
|
||||
|
||||
side_nav_items = [ getItem('My organisations', 'orgs', <SettingOutlined />),
|
||||
side_nav_items = [ getItem('Onboarding', 'orgs', <SettingOutlined />),
|
||||
getItem('Bridges', 'bridges', <DeploymentUnitOutlined />), ];
|
||||
|
||||
const currentOrg = currentUser.organisations[0]['name']
|
||||
|
|
@ -163,6 +184,7 @@ const App: React.FC = () => {
|
|||
}
|
||||
|
||||
return (
|
||||
<OrgContext.Provider value={{ currentOrg, setCurrentOrg }}>
|
||||
<UserContext.Provider value={{ currentUser, setCurrentUser }}>
|
||||
<RefreshContext.Provider value={{ refreshKey, setRefreshKey }}>
|
||||
<Layout>
|
||||
|
|
@ -209,6 +231,8 @@ const App: React.FC = () => {
|
|||
<Route path="/" element={<Home/>}/>
|
||||
{currentUser && <Route path="/profile" element={<Profile/>}/> }
|
||||
{currentUser && <Route path="/organisations" element={<Organisations/>}/> }
|
||||
{currentUser && <Route path="/create-org-flow" element={<CreateOrgFlow/>}/> }
|
||||
|
||||
{currentUser && <Route path="/bridges" element={<Bridges/>}/> }
|
||||
|
||||
</Routes>
|
||||
|
|
@ -218,6 +242,7 @@ const App: React.FC = () => {
|
|||
</Layout>
|
||||
</RefreshContext.Provider>
|
||||
</UserContext.Provider>
|
||||
</OrgContext.Provider>
|
||||
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue