Skip to content

Commit b8ba3b9

Browse files
authored
Merge pull request #1455 from ghalestrilo/feature/mobile-canvas
Create Mobile Editor Endpoint
2 parents 53cb305 + 96261db commit b8ba3b9

File tree

4 files changed

+57
-3
lines changed

4 files changed

+57
-3
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import styled from 'styled-components';
4+
import { Link } from 'react-router';
5+
6+
import { prop, remSize } from '../../../theme';
7+
8+
const background = prop('Button.default.background');
9+
const textColor = prop('primaryTextColor');
10+
11+
const Header = styled.div`
12+
width: 100%;
13+
background-color: ${background};
14+
color: ${textColor};
15+
padding-left: ${remSize(32)};
16+
`;
17+
18+
const Footer = styled.div`
19+
width: 100%;
20+
position: absolute;
21+
bottom: 0;
22+
background: ${background};
23+
color: ${textColor};
24+
padding-left: ${remSize(32)};
25+
`;
26+
27+
const Screen = ({ children }) => (
28+
<div className="fullscreen-preview">
29+
{children}
30+
</div>
31+
);
32+
Screen.propTypes = {
33+
children: PropTypes.node.isRequired
34+
};
35+
36+
export default () => (
37+
<Screen>
38+
<Header><h1>Mobile View</h1></Header>
39+
40+
41+
<h3>
42+
<br />This page is under construction.
43+
<br /><Link to="/">Click here</Link> to return to the regular editor
44+
</h3>
45+
46+
<Footer><h1>Bottom Bar</h1></Footer>
47+
</Screen>
48+
);

client/routes.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Route, IndexRoute } from 'react-router';
22
import React from 'react';
33
import App from './modules/App/App';
44
import IDEView from './modules/IDE/pages/IDEView';
5+
import IDEViewMobile from './modules/IDE/pages/IDEViewMobile';
56
import FullView from './modules/IDE/pages/FullView';
67
import LoginView from './modules/User/pages/LoginView';
78
import SignupView from './modules/User/pages/SignupView';
@@ -49,6 +50,8 @@ const routes = store => (
4950
<Route path="/:username/collections/create" component={DashboardView} />
5051
<Route path="/:username/collections/:collection_id" component={CollectionView} />
5152
<Route path="/about" component={IDEView} />
53+
<Route path="/mobile" component={IDEViewMobile} />
54+
5255
</Route>
5356
);
5457

server/routes/server.routes.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,11 @@ router.get('/about', (req, res) => {
114114
res.send(renderIndex());
115115
});
116116

117-
router.get('/feedback', (req, res) => {
118-
res.send(renderIndex());
119-
});
117+
if (process.env.MOBILE_ENABLED) {
118+
router.get('/mobile', (req, res) => {
119+
res.send(renderIndex());
120+
});
121+
}
120122

121123
router.get('/:username/collections/create', (req, res) => {
122124
userExists(req.params.username, (exists) => {

server/views/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export function renderIndex() {
3232
window.process.env.UI_ACCESS_TOKEN_ENABLED = ${process.env.UI_ACCESS_TOKEN_ENABLED === 'false' ? false : true};
3333
window.process.env.UI_COLLECTIONS_ENABLED = ${process.env.UI_COLLECTIONS_ENABLED === 'false' ? false : true};
3434
window.process.env.UPLOAD_LIMIT = ${process.env.UPLOAD_LIMIT ? `${process.env.UPLOAD_LIMIT}` : undefined};
35+
window.process.env.MOBILE_ENABLED = ${process.env.MOBILE_ENABLED ? `${process.env.MOBILE_ENABLED}` : undefined};
3536
</script>
3637
</head>
3738
<body>

0 commit comments

Comments
 (0)