Skip to content

Commit 01fd376

Browse files
new pages (codesandbox#3946)
* new pages * Update packages/app/src/app/pages/NewDashboard/utils/get-child-collections.js Co-Authored-By: Michaël De Boey <[email protected]> Co-authored-by: Michaël De Boey <[email protected]>
1 parent 0c063c3 commit 01fd376

File tree

10 files changed

+724
-0
lines changed

10 files changed

+724
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// import React from 'react';
2+
// import { Route, Switch, Redirect, withRouter } from 'react-router-dom';
3+
4+
// import { RecentSandboxes } from './routes/RecentSandboxes';
5+
// import PathedSandboxes from './routes/PathedSandboxes';
6+
// import { Templates } from './routes/Templates';
7+
// import DeletedSandboxes from './routes/DeletedSandboxes';
8+
// import SearchSandboxes from './routes/SearchSandboxes';
9+
// import CreateTeam from './routes/CreateTeam';
10+
// import TeamView from './routes/TeamView';
11+
12+
// const Content = () => (
13+
// <Switch>
14+
// <Route path="/dashboard/recent" component={RecentSandboxes} />
15+
// <Route path="/dashboard/trash" component={DeletedSandboxes} />
16+
// <Route path="/dashboard/templates" exact component={Templates} />
17+
// <Route path="/dashboard/sandboxes/:path*" component={PathedSandboxes} />
18+
// <Route path="/dashboard/search" component={SearchSandboxes} />
19+
// <Route path="/dashboard/teams/new" component={CreateTeam} />
20+
// <Route exact path="/dashboard/teams/:teamId" component={TeamView} />
21+
// <Route
22+
// path="/dashboard/teams/:teamId/sandboxes/:path*"
23+
// component={PathedSandboxes}
24+
// />
25+
// <Route
26+
// path="/dashboard/teams/:teamId/templates"
27+
// component={Templates}
28+
// exact
29+
// />
30+
// <Redirect to="/dashboard/recent" />
31+
// </Switch>
32+
// );
33+
34+
// export default withRouter(Content);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import React from 'react';
2+
import { Element } from '@codesandbox/components';
3+
4+
export const Sidebar = () => <Element>I AM A SIDEBAR</Element>;
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { signInPageUrl } from '@codesandbox/common/lib/utils/url-generator';
2+
import React, { useEffect, FunctionComponent } from 'react';
3+
import { Redirect } from 'react-router-dom';
4+
import { createGlobalStyle } from 'styled-components';
5+
import { client } from 'app/graphql/client';
6+
import { useOvermind } from 'app/overmind';
7+
import codesandboxBlack from '@codesandbox/components/lib/themes/codesandbox-black';
8+
import { Element, ThemeProvider, Stack } from '@codesandbox/components';
9+
import { Sidebar } from './Sidebar';
10+
11+
type Theme = {
12+
colors: any;
13+
name: string;
14+
};
15+
16+
const GlobalStyle = createGlobalStyle`
17+
html body {
18+
font-family: 'Inter', sans-serif;
19+
background: ${({ theme }: { theme: Theme }) =>
20+
theme.colors.sideBar.background} !important;
21+
color: ${({ theme }: { theme: Theme }) => theme.colors.sideBar.foreground};
22+
23+
* {
24+
box-sizing: border-box;
25+
}
26+
}
27+
`;
28+
29+
export const Dashboard: FunctionComponent = () => {
30+
const {
31+
actions: {
32+
dashboard: { dashboardMounted },
33+
},
34+
state: { hasLogIn },
35+
} = useOvermind();
36+
37+
useEffect(() => {
38+
dashboardMounted();
39+
40+
// Reset store so new visits get fresh data
41+
return () => client.resetStore();
42+
}, [dashboardMounted]);
43+
44+
if (!hasLogIn) {
45+
return <Redirect to={signInPageUrl()} />;
46+
}
47+
48+
return (
49+
<ThemeProvider theme={codesandboxBlack}>
50+
<GlobalStyle />
51+
<Stack gap={6} style={{ minHeight: '100vh' }}>
52+
<Sidebar />
53+
<Element>I AM THE CONTENT</Element>
54+
</Stack>
55+
</ThemeProvider>
56+
);
57+
};

0 commit comments

Comments
 (0)