Home page
- beep beep
+ Infos:
+
Total Number of Videos: {this.state.sideinfo.videonr}
+
HD Videos: {this.state.sideinfo.hdvideonr}
+
SD Videos: {this.state.sideinfo.sdvideonr}
+
Total Number of Categories: {this.state.sideinfo.categorynr}
{this.state.loadeditems.map(elem => (
diff --git a/src/MainBody.js b/src/MainBody.js
index 7e85f79..e0e2935 100644
--- a/src/MainBody.js
+++ b/src/MainBody.js
@@ -1,5 +1,6 @@
import React from "react";
import HomePage from "./HomePage";
+import RandomPage from "./RandomPage";
class MainBody extends React.Component {
constructor(props) {
@@ -11,7 +12,9 @@ class MainBody extends React.Component {
let page;
if (this.props.page === "default") {
page =
;
- } else if (this.props.page === "video") {
+ } else if (this.props.page === "random"){
+ page = ;
+ }else if (this.props.page === "video") {
// show videoelement if neccessary
page = this.props.videoelement;
} else {
diff --git a/src/Player.js b/src/Player.js
index 1f3ad65..429daa8 100644
--- a/src/Player.js
+++ b/src/Player.js
@@ -121,6 +121,8 @@ class Player extends React.Component {
}
closebtn() {
+ // todo go back to correct page here!
+ // have a catch to
this.props.viewbinding.hideVideo();
}
}
diff --git a/src/Preview.js b/src/Preview.js
index 91bd18d..8028c33 100644
--- a/src/Preview.js
+++ b/src/Preview.js
@@ -43,7 +43,7 @@ class Preview extends React.Component {
+ alt='Pic loading.'/>
);
@@ -52,7 +52,9 @@ class Preview extends React.Component {
itemClick() {
console.log("item clicked!" + this.state.name);
- this.props.viewbinding.showVideo(
);
+ this.props.viewbinding.showVideo();
}
}
diff --git a/src/RandomPage.js b/src/RandomPage.js
new file mode 100644
index 0000000..2f40a7f
--- /dev/null
+++ b/src/RandomPage.js
@@ -0,0 +1,67 @@
+import React from "react";
+import Preview from "./Preview";
+import "./css/RandomPage.css"
+
+class RandomPage extends React.Component {
+ constructor(props: P, context: any) {
+ super(props, context);
+
+ this.state = {
+ videos: []
+ };
+ }
+
+ componentDidMount() {
+ this.loadShuffledvideos(6);
+ }
+
+ render() {
+ return (
+
Random Videos
+
+ todo here.
+
+
+ {this.state.videos.map(elem => (
+
+ ))}
+
+
+ right
+
+
+
+
+
+
);
+ }
+
+ shuffleclick() {
+ this.loadShuffledvideos(6);
+ }
+
+ loadShuffledvideos(nr) {
+ const updateRequest = new FormData();
+ updateRequest.append('action', 'getRandomMovies');
+ updateRequest.append('number', nr);
+
+ // fetch all videos available
+ fetch('/php/videoload.php', {method: 'POST', body: updateRequest})
+ .then((response) => response.json()
+ .then((result) => {
+ this.setState({videos: result});
+ }))
+ .catch(() => {
+ console.log("no connection to backend");
+ });
+ }
+}
+
+export default RandomPage;
\ No newline at end of file
diff --git a/src/css/RandomPage.css b/src/css/RandomPage.css
new file mode 100644
index 0000000..d8a06ac
--- /dev/null
+++ b/src/css/RandomPage.css
@@ -0,0 +1,4 @@
+.Shufflebutton{
+ width: 100%;
+ align-content: center;
+}
\ No newline at end of file