diff --git a/client/assets/css/reset.scss b/client/assets/css/reset.scss index 5fbcb601..e71b75eb 100644 --- a/client/assets/css/reset.scss +++ b/client/assets/css/reset.scss @@ -23,6 +23,7 @@ html { background: var(--bg-color); color: var(--color); } +body {overflow: hidden;} body, html{ height: 100%; margin: 0; @@ -80,19 +81,6 @@ input[type="checkbox"]{position: relative; top: 1px; margin: 0; padding: 0;} - - - - -/* I know this looks weird but at least it doesn't rely on javascript to dynamically set element size */ -body {overflow: hidden;} -body, body > div, body > div > div, body > div > div > div{ height: 100%;} - - - - - - /* CONNECTION FORM */ .login-form button.active{ box-shadow: 0px 1px 5px rgba(0,0,0,0.20); diff --git a/client/components/fab.js b/client/components/fab.js index fd216b53..14fcde66 100644 --- a/client/components/fab.js +++ b/client/components/fab.js @@ -1,10 +1,13 @@ import React from 'react'; + import './fab.scss'; export const Fab = (props) => { return (
- {props.children} +
+ {props.children} +
); } diff --git a/client/components/fab.scss b/client/components/fab.scss index ef590a91..73dc0c6e 100644 --- a/client/components/fab.scss +++ b/client/components/fab.scss @@ -1,13 +1,15 @@ .component_fab{ - height: 25px; - width: 25px; - padding: 13px; position: fixed; bottom: 20px; right: 20px; - border-radius: 50%; - background: var(--color); - box-shadow: rgba(0, 0, 0, 0.14) 0px 4px 5px 0px, rgba(0, 0, 0, 0.12) 0px 1px 10px 0px, rgba(0, 0, 0, 0.2) 0px 2px 4px -1px; - z-index: 1000; - cursor: pointer; + .content{ + height: 25px; + width: 25px; + padding: 13px; + border-radius: 50%; + background: var(--color); + box-shadow: rgba(0, 0, 0, 0.14) 0px 4px 5px 0px, rgba(0, 0, 0, 0.12) 0px 1px 10px 0px, rgba(0, 0, 0, 0.2) 0px 2px 4px -1px; + z-index: 1000; + cursor: pointer; + } } diff --git a/client/index.html b/client/index.html index a4b1b21b..f6287be4 100644 --- a/client/index.html +++ b/client/index.html @@ -32,6 +32,6 @@ -
+
diff --git a/client/pages/viewerpage.js b/client/pages/viewerpage.js index 9460bd13..da3ec655 100644 --- a/client/pages/viewerpage.js +++ b/client/pages/viewerpage.js @@ -28,22 +28,24 @@ export class ViewerPage extends React.Component { data: '', needSaving: false, isSaving: false, - height: null, loading: true, error: false }; - this.resetHeight = debounce(this.resetHeight.bind(this), 100); this.props.subscribe('file.select', this.onPathUpdate.bind(this)); } componentWillMount(){ - this.setState({loading: true, error: false}); + this.setState({loading: null, error: false}, () => { + window.setTimeout(() => { + if(this.state.loading === null) this.setState({loading: true}); + }, 500); + }); let app = opener(this.state.path); if(app === 'editor'){ Files.cat(this.state.path).then((content) => { this.setState({data: content, loading: false, opener: app}); }).catch(err => { - if(err && err.code === 'CANCELLED'){ return } + if(err && err.code === 'CANCELLED'){ return; } if(err.code === 'BINARY_FILE'){ Files.url(this.state.path).then((url) => { this.setState({data: url, loading: false, opener: 'download'}); @@ -58,7 +60,7 @@ export class ViewerPage extends React.Component { Files.url(this.state.path).then((url) => { this.setState({data: url, loading: false, opener: app}); }).catch(err => { - if(err && err.code === 'CANCELLED'){ return } + if(err && err.code === 'CANCELLED'){ return; } this.setState({error: err}); }); } @@ -66,7 +68,6 @@ export class ViewerPage extends React.Component { componentWillUnmount() { this.props.unsubscribe('file.select'); - window.removeEventListener("resize", this.resetHeight); } @@ -96,24 +97,13 @@ export class ViewerPage extends React.Component { this.setState({needSaving: bool}); } - componentDidMount(){ - this.resetHeight(); - window.addEventListener("resize", this.resetHeight); - } - - resetHeight(){ - this.setState({ - height: document.body.clientHeight - document.querySelector('.breadcrumb').offsetHeight - }); - } - render() { let style = {height: '100%'}; return ( -
+
-
- +
+ { + window.setTimeout(() => { + if(this.state.loading === null) this.setState({loading: true}); + }, 200); + }); this.loadMode(this.props.filename) + .then((res) => new Promise((done) => this.setState({loading: false}, () => done(res)))) .then(loadCodeMirror.bind(this)); function loadCodeMirror(CodeMirror){ @@ -62,7 +68,6 @@ export class Editor extends React.Component { } this.setState({editor: editor}); - this.updateHeight(this.props.height); editor.on('change', (edit) => { if(this.props.onChange){ @@ -83,13 +88,6 @@ export class Editor extends React.Component { this.state.editor.clearHistory(); } - updateHeight(height){ - if(height){ - document.querySelector('.CodeMirror').style.height = height+'px'; - } - } - - loadMode(file){ let ext = file.split('.').pop(), mode = null; @@ -103,7 +101,7 @@ export class Editor extends React.Component { else if(ext === 'css'){ mode = 'css'; } else if(ext === 'less' || ext === 'scss' || ext === 'sass'){ mode = 'sass'; } else if(ext === 'js' || ext === 'json'){ mode = 'javascript'; } - else if(ext === 'jsx'){ mode = 'jsx' } + else if(ext === 'jsx'){ mode = 'jsx'; } else if(ext === 'php' || ext === 'php5' || ext === 'php4'){ mode = 'php'; } else if(ext === 'elm'){ mode = 'elm'; } else if(ext === 'erl'){ mode = 'erlang'; } @@ -112,7 +110,7 @@ export class Editor extends React.Component { else if(ext === 'pl' || ext === 'pm'){mode = 'perl'; } else if(ext === 'clj'){ mode = 'clojure'; } else if(ext === 'el' || ext === 'lisp' || ext === 'cl' || ext === 'emacs'){ mode = 'lisp'; } - else if(ext === 'Dockerfile'){ mode = 'dockerfile'} + else if(ext === 'Dockerfile'){ mode = 'dockerfile'; } else if(ext === 'R'){ mode = 'r'; } else if(ext === 'Makefile'){ mode = 'cmake'; } else if(ext === 'rb'){ mode = 'ruby'; } @@ -130,12 +128,20 @@ export class Editor extends React.Component { } return import(/* webpackChunkName: "editor" */'./editor/'+mode) + .catch(() => import("./editor/text")) .then((module) => Promise.resolve(module.default)); } render() { return ( +
+ + + +
+
+
); } } diff --git a/client/pages/viewerpage/ide.js b/client/pages/viewerpage/ide.js index 21cf3fb9..ce7accd4 100644 --- a/client/pages/viewerpage/ide.js +++ b/client/pages/viewerpage/ide.js @@ -1,14 +1,16 @@ import React from 'react'; +import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; import { NgIf, Fab, Icon } from '../../components/'; -import { MenuBar } from './menubar'; import { Editor } from './editor'; +import './ide.scss'; + export class IDE extends React.Component { constructor(props){ super(props); this.state = { - contentToSave: null + contentToSave: props.content }; } @@ -32,13 +34,16 @@ export class IDE extends React.Component { render(){ return (
- - - - - - - + + + + + + + + + +
); } diff --git a/client/pages/viewerpage/ide.scss b/client/pages/viewerpage/ide.scss new file mode 100644 index 00000000..fe4a1067 --- /dev/null +++ b/client/pages/viewerpage/ide.scss @@ -0,0 +1,7 @@ +.fab-appear{ + opacity: 0; +} +.fab-appear.fab-appear-active{ + transition: all 0.2s ease-out; + opacity: 1; +} diff --git a/client/pages/viewerpage/index.js b/client/pages/viewerpage/index.js index 343a57e5..4158ce33 100644 --- a/client/pages/viewerpage/index.js +++ b/client/pages/viewerpage/index.js @@ -2,6 +2,6 @@ export { AudioPlayer } from './audioplayer'; export { FileDownloader } from './filedownloader'; export { ImageViewer } from './imageviewer'; export { PDFViewer } from './pdfviewer'; +export { IDE } from './ide'; // Those are commented because they will be delivered as a separate chunk //export { VideoPlayer } from './videoplayer'; -//export { IDE } from './ide'; diff --git a/client/router.js b/client/router.js index 816d3d1c..a2c20cd3 100644 --- a/client/router.js +++ b/client/router.js @@ -7,9 +7,9 @@ import { Audio, Video } from './components/'; export default class AppRouter extends React.Component { render() { return ( -
+
-
+