From 516949dc6524d8174818eab52be4a6f8e1228964 Mon Sep 17 00:00:00 2001 From: Lukas Heiligenbrunner Date: Sun, 7 Jun 2020 11:37:50 +0200 Subject: [PATCH] structured project with folders better min preview height correct sort by creation date --- api/videoload.php | 2 +- package.json | 2 +- src/App.js | 10 +++++++--- src/css/Preview.css | 1 + src/{ => elements}/AddTagPopup.js | 0 src/{ => elements}/Preview.js | 4 ++-- src/{ => elements}/SideBar.js | 2 +- src/{ => elements}/Tag.js | 4 ++-- src/pages/CategoryPage.js | 13 +++++++++++++ src/{ => pages}/HomePage.js | 10 +++++----- src/{ => pages}/Player.js | 8 ++++---- src/{ => pages}/RandomPage.js | 8 ++++---- src/{ => pages}/SettingsPage.js | 2 +- 13 files changed, 42 insertions(+), 24 deletions(-) rename src/{ => elements}/AddTagPopup.js (100%) rename src/{ => elements}/Preview.js (96%) rename src/{ => elements}/SideBar.js (88%) rename src/{ => elements}/Tag.js (83%) create mode 100644 src/pages/CategoryPage.js rename src/{ => pages}/HomePage.js (97%) rename src/{ => pages}/Player.js (97%) rename src/{ => pages}/RandomPage.js (93%) rename src/{ => pages}/SettingsPage.js (98%) diff --git a/api/videoload.php b/api/videoload.php index 9929924..3ea3460 100755 --- a/api/videoload.php +++ b/api/videoload.php @@ -8,7 +8,7 @@ if (isset($_POST['action'])) { $action = $_POST['action']; switch ($action) { case "getMovies": - $query = "SELECT movie_id,movie_name FROM videos ORDER BY likes DESC, create_date ASC, movie_name ASC"; + $query = "SELECT movie_id,movie_name FROM videos ORDER BY likes DESC, create_date DESC, movie_name ASC"; if (isset($_POST['tag'])) { $tag = $_POST['tag']; if ($_POST['tag'] != "all") { diff --git a/package.json b/package.json index 9a7c96b..dcd0c86 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "test": "react-scripts test", "eject": "react-scripts eject" }, - "proxy": "http://192.168.0.248", + "proxy": "http://192.168.0.209", "homepage": "/", "eslintConfig": { "extends": "react-app" diff --git a/src/App.js b/src/App.js index 5ef49e4..60627fa 100644 --- a/src/App.js +++ b/src/App.js @@ -1,11 +1,12 @@ import React from 'react'; import "./css/App.css" -import HomePage from "./HomePage"; -import RandomPage from "./RandomPage"; +import HomePage from "./pages/HomePage"; +import RandomPage from "./pages/RandomPage"; // include bootstraps css import 'bootstrap/dist/css/bootstrap.min.css'; -import SettingsPage from "./SettingsPage"; +import SettingsPage from "./pages/SettingsPage"; +import CategoryPage from "./pages/CategoryPage"; class App extends React.Component { constructor(props, context) { @@ -30,6 +31,9 @@ class App extends React.Component { } else if (this.state.page === "settings") { page = ; this.mypage = page; + } else if (this.state.page === "categories") { + page = ; + this.mypage = page; } else if (this.state.page === "video") { // show videoelement if neccessary page = this.videoelement; diff --git a/src/css/Preview.css b/src/css/Preview.css index 3373a75..32146ea 100644 --- a/src/css/Preview.css +++ b/src/css/Preview.css @@ -13,6 +13,7 @@ } .previewimage { + min-height: 150px; max-height: 400px; min-width: 266px; max-width: 410px; diff --git a/src/AddTagPopup.js b/src/elements/AddTagPopup.js similarity index 100% rename from src/AddTagPopup.js rename to src/elements/AddTagPopup.js diff --git a/src/Preview.js b/src/elements/Preview.js similarity index 96% rename from src/Preview.js rename to src/elements/Preview.js index c728915..eb82fe2 100644 --- a/src/Preview.js +++ b/src/elements/Preview.js @@ -1,6 +1,6 @@ import React from "react"; -import "./css/Preview.css"; -import Player from "./Player"; +import "../css/Preview.css"; +import Player from "../pages/Player"; class Preview extends React.Component { constructor(props, context) { diff --git a/src/SideBar.js b/src/elements/SideBar.js similarity index 88% rename from src/SideBar.js rename to src/elements/SideBar.js index 5c06447..173e8ef 100644 --- a/src/SideBar.js +++ b/src/elements/SideBar.js @@ -1,5 +1,5 @@ import React from "react"; -import "./css/SideBar.css" +import "../css/SideBar.css" class SideBar extends React.Component { render() { diff --git a/src/Tag.js b/src/elements/Tag.js similarity index 83% rename from src/Tag.js rename to src/elements/Tag.js index c567a30..015abe8 100644 --- a/src/Tag.js +++ b/src/elements/Tag.js @@ -1,6 +1,6 @@ import React from "react"; -import "./css/Tag.css" +import "../css/Tag.css" class Tag extends React.Component { @@ -11,7 +11,7 @@ class Tag extends React.Component { } render() { - // todo onclick events correctly + // todo onclick events correctlyy return ( ); diff --git a/src/pages/CategoryPage.js b/src/pages/CategoryPage.js new file mode 100644 index 0000000..c3f1b9b --- /dev/null +++ b/src/pages/CategoryPage.js @@ -0,0 +1,13 @@ +import React from "react"; + +class CategoryPage extends React.Component{ + render() { + return ( + <> + + + ); + } +} + +export default CategoryPage; \ No newline at end of file diff --git a/src/HomePage.js b/src/pages/HomePage.js similarity index 97% rename from src/HomePage.js rename to src/pages/HomePage.js index 3013b8c..5b3e096 100644 --- a/src/HomePage.js +++ b/src/pages/HomePage.js @@ -1,10 +1,10 @@ import React from "react"; -import Preview from "./Preview"; -import SideBar from "./SideBar"; +import Preview from "../elements/Preview"; +import SideBar from "../elements/SideBar"; +import Tag from "../elements/Tag"; -import "./css/HomePage.css" -import "./css/DefaultPage.css" -import Tag from "./Tag"; +import "../css/HomePage.css" +import "../css/DefaultPage.css" class HomePage extends React.Component { // stores all available movies diff --git a/src/Player.js b/src/pages/Player.js similarity index 97% rename from src/Player.js rename to src/pages/Player.js index 0be3d4f..4b9138d 100644 --- a/src/Player.js +++ b/src/pages/Player.js @@ -1,9 +1,9 @@ import React from "react"; -import "./css/Player.css" +import "../css/Player.css" import {PlyrComponent} from 'plyr-react'; -import SideBar from "./SideBar"; -import Tag from "./Tag"; -import AddTagPopup from "./AddTagPopup"; +import SideBar from "../elements/SideBar"; +import Tag from "../elements/Tag"; +import AddTagPopup from "../elements/AddTagPopup"; class Player extends React.Component { diff --git a/src/RandomPage.js b/src/pages/RandomPage.js similarity index 93% rename from src/RandomPage.js rename to src/pages/RandomPage.js index c0f814b..081b6d1 100644 --- a/src/RandomPage.js +++ b/src/pages/RandomPage.js @@ -1,8 +1,8 @@ import React from "react"; -import Preview from "./Preview"; -import "./css/RandomPage.css" -import SideBar from "./SideBar"; -import Tag from "./Tag"; +import Preview from "../elements/Preview"; +import "../css/RandomPage.css" +import SideBar from "../elements/SideBar"; +import Tag from "../elements/Tag"; class RandomPage extends React.Component { constructor(props, context) { diff --git a/src/SettingsPage.js b/src/pages/SettingsPage.js similarity index 98% rename from src/SettingsPage.js rename to src/pages/SettingsPage.js index 0cda3e0..895bd51 100644 --- a/src/SettingsPage.js +++ b/src/pages/SettingsPage.js @@ -1,5 +1,5 @@ import React from "react"; -import "./css/DefaultPage.css" +import "../css/DefaultPage.css" class SettingsPage extends React.Component {