From 9ce867c6c8ba5313b1e3e7c012b68cd4d224aa67 Mon Sep 17 00:00:00 2001 From: Lukas Heiligenbrunner Date: Sat, 4 Jul 2020 00:45:18 +0200 Subject: [PATCH] added some todos and css to video reindex --- src/pages/SettingsPage/GeneralSettings.js | 22 ++++++++++++++++++---- src/pages/SettingsPage/MovieSettings.css | 13 +++++++++++++ src/pages/SettingsPage/MovieSettings.js | 8 ++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 src/pages/SettingsPage/MovieSettings.css diff --git a/src/pages/SettingsPage/GeneralSettings.js b/src/pages/SettingsPage/GeneralSettings.js index 7d39876..978fa59 100644 --- a/src/pages/SettingsPage/GeneralSettings.js +++ b/src/pages/SettingsPage/GeneralSettings.js @@ -15,13 +15,13 @@ class GeneralSettings extends React.Component { componentDidMount() { const updateRequest = new FormData(); - updateRequest.append('action', 'loadVideo'); - updateRequest.append('movieid', this.props.movie_id); + updateRequest.append('action', 'loadGeneralSettings'); - fetch('/api/videoload.php', {method: 'POST', body: updateRequest}) + fetch('/api/settings.php', {method: 'POST', body: updateRequest}) .then((response) => response.json() .then((result) => { // todo 2020-07-3: set state here + // todo 2020-07-4: php and test code })); } @@ -29,7 +29,10 @@ class GeneralSettings extends React.Component { return ( <>
-
+ { + e.preventDefault(); + this.saveSettings(); + }}> Video Path @@ -67,6 +70,17 @@ class GeneralSettings extends React.Component { ); } + + saveSettings() { + const updateRequest = new FormData(); + updateRequest.append('action', 'saveGeneralSettings'); + + fetch('/api/settings.php', {method: 'POST', body: updateRequest}) + .then((response) => response.json() + .then((result) => { + // todo 2020-07-4: settings result here + })); + } } export default GeneralSettings; \ No newline at end of file diff --git a/src/pages/SettingsPage/MovieSettings.css b/src/pages/SettingsPage/MovieSettings.css new file mode 100644 index 0000000..6265fbf --- /dev/null +++ b/src/pages/SettingsPage/MovieSettings.css @@ -0,0 +1,13 @@ +.indextextarea { + margin-top: 15px; + padding: 10px; + + overflow-y: scroll; + overflow-x: auto; + + min-height: 100px; + max-height: 300px; + width: 50%; + background-color: #c2c2c2; + border-radius: 5px; +} \ No newline at end of file diff --git a/src/pages/SettingsPage/MovieSettings.js b/src/pages/SettingsPage/MovieSettings.js index 5ff54aa..a4a0e89 100644 --- a/src/pages/SettingsPage/MovieSettings.js +++ b/src/pages/SettingsPage/MovieSettings.js @@ -1,4 +1,5 @@ import React from "react"; +import "./MovieSettings.css" class MovieSettings extends React.Component { constructor(props) { @@ -35,12 +36,15 @@ class MovieSettings extends React.Component { } startReindex() { + document.getElementsByClassName("indextextarea")[0].innerHTML = ""; console.log("starting"); const updateRequest = new FormData(); // fetch all videos available fetch('/api/extractvideopreviews.php', {method: 'POST', body: updateRequest}) .then((response) => response.json() .then((result) => { + // todo 2020-07-4: some kind of start event + // maybe disable start btn console.log("returned"); })) .catch(() => { @@ -60,11 +64,15 @@ class MovieSettings extends React.Component { .then((result) => { if (result.contentAvailable === true) { console.log(result); + // todo 2020-07-4: scroll to bottom of div here this.setState({ + // insert a string for each line text: [...result.message.split("\n"), ...this.state.text] }); } else { + // clear refresh interval if no content available + // todo 2020-07-4: maybe enable start btn again clearInterval(this.myinterval); } }))