@@ -27,14 +34,21 @@ export default class Preview extends React.Component {
}
render() {
- const posts = this.props.posts;
+ const posts = this.props.redux.preview.posts;
+ const postLimit = this.props.redux.postLimit;
+ const increasePostLimit = this.props.actions.increasePostLimit;
+ const fetched = this.props.redux.fetched;
return (
);
}
-}
-
-const loadingElement =
- {posts.length > 0 ? this.insertPosts(posts): null}
- {posts.length > this.props.postLimit ?
-
- : null}
+ {fetched ?
+ }
);
}
diff --git a/client/js/components/sensors/SensorInfo.js b/client/js/components/sensors/SensorInfo.js
new file mode 100644
index 0000000..38c80fc
--- /dev/null
+++ b/client/js/components/sensors/SensorInfo.js
@@ -0,0 +1,11 @@
+import React from 'react';
+
+export default class SensorInfo extends React.Component{
+
+
+ render(){
+ return(
+
+ {posts.length > 0 ? this.insertPosts(posts): null}
+ {posts.length > postLimit ?
+
+ : null}
+
+ : Test123
+ );
+ }
+}
\ No newline at end of file
diff --git a/client/js/components/utils/Loading.js b/client/js/components/utils/Loading.js
new file mode 100644
index 0000000..8b59fe9
--- /dev/null
+++ b/client/js/components/utils/Loading.js
@@ -0,0 +1,14 @@
+import React from 'react';
+
+//loading icon
+import loading from '../../../assets/images/loading.svg';
+
+export default class Loading extends React.Component{
+ render(){
+ return(
+
+
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/client/js/pages/Index.js b/client/js/pages/Index.js
index c6aa2f3..33c1408 100644
--- a/client/js/pages/Index.js
+++ b/client/js/pages/Index.js
@@ -2,10 +2,8 @@ import React from 'react';
//components
import Header from '../components/Header';
-import Preview from '../components/Preview';
import Footer from '../components/Footer';
import Sidebar from '../components/Sidebar';
-import Post from '../components/Post';
//css
import '../../assets/css/normalize.css';
@@ -13,50 +11,18 @@ import '../../assets/scss/main.scss';
import 'font-awesome/css/font-awesome.min.css';
import '../../assets/css/dracula.css';
-//loading icon
-import loading from '../../assets/images/loading.svg';
-
export default class Index extends React.Component {
- componentDidMount() {
- this.props.actions.fetchPreview();
- this.page = this.props.params.page;
- this.page === 'post' ? this.props.actions.fetchPost(this.props.params.category, this.props.params.post) : "";
- }
-
- componentWillReceiveProps(nextProps) {
- if (this.props.params !== nextProps.params) {
- const params = nextProps.params;
- this.page = params.page;
-
- if (typeof params.post !== 'undefined' && typeof params.category !== 'undefined') {
- this.props.actions.fetchPost(params.category, params.post);
- }
- }
- }
render() {
- const fetched = this.props.redux.fetched;
- const fetching = this.props.redux.fetching;
-
return (
- {typeof this.page === 'undefined' && !fetching
- ?
- : null}
- {this.page === 'post' && !fetching ? : null}
- {fetching ? loadingElement : null}
+ {React.cloneElement(this.props.children, this.props)}
-
-
;
+}
\ No newline at end of file