2020-05-31 20:24:35 +02:00
|
|
|
import React from "react";
|
2020-07-08 00:14:08 +02:00
|
|
|
import style from "./Preview.module.css";
|
2020-06-12 15:57:30 +00:00
|
|
|
import Player from "../../pages/Player/Player";
|
2020-06-18 21:53:48 +02:00
|
|
|
import {Spinner} from "react-bootstrap";
|
2020-08-05 22:00:55 +02:00
|
|
|
import GlobalInfos from "../../GlobalInfos";
|
2020-05-31 20:24:35 +02:00
|
|
|
|
|
|
|
class Preview extends React.Component {
|
|
|
|
constructor(props, context) {
|
|
|
|
super(props, context);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
previewpicture: null,
|
2020-05-31 23:22:50 +02:00
|
|
|
name: null
|
2020-05-31 20:24:35 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
this.setState({
|
|
|
|
previewpicture: null,
|
2020-05-31 23:22:50 +02:00
|
|
|
name: this.props.name
|
|
|
|
});
|
2020-05-31 20:24:35 +02:00
|
|
|
|
|
|
|
const updateRequest = new FormData();
|
|
|
|
updateRequest.append('action', 'readThumbnail');
|
|
|
|
updateRequest.append('movieid', this.props.movie_id);
|
|
|
|
|
2020-06-01 21:36:55 +02:00
|
|
|
fetch('/api/videoload.php', {method: 'POST', body: updateRequest})
|
2020-06-12 15:57:30 +00:00
|
|
|
.then((response) => response.text()
|
|
|
|
.then((result) => {
|
2020-07-03 00:20:11 +02:00
|
|
|
this.setState({
|
|
|
|
previewpicture: result
|
|
|
|
});
|
2020-05-31 20:24:35 +02:00
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2020-08-05 22:00:55 +02:00
|
|
|
const themeStyle = GlobalInfos.getThemeStyle();
|
2020-05-31 20:24:35 +02:00
|
|
|
return (
|
2020-08-03 18:38:22 +00:00
|
|
|
<div className={style.videopreview + ' ' + themeStyle.secbackground + ' '+ themeStyle.preview} onClick={() => this.itemClick()}>
|
|
|
|
<div className={style.previewtitle + ' '+ themeStyle.lighttextcolor}>{this.state.name}</div>
|
2020-07-08 00:14:08 +02:00
|
|
|
<div className={style.previewpic}>
|
2020-06-18 21:53:48 +02:00
|
|
|
{this.state.previewpicture != null ?
|
2020-07-08 00:14:08 +02:00
|
|
|
<img className={style.previewimage}
|
2020-06-18 21:53:48 +02:00
|
|
|
src={this.state.previewpicture}
|
|
|
|
alt='Pic loading.'/> :
|
2020-07-08 00:14:08 +02:00
|
|
|
<span className={style.loadAnimation}><Spinner animation="border"/></span>}
|
2020-06-18 21:53:48 +02:00
|
|
|
|
2020-05-31 20:24:35 +02:00
|
|
|
</div>
|
2020-07-08 00:14:08 +02:00
|
|
|
<div className={style.previewbottom}>
|
2020-06-04 16:45:24 +02:00
|
|
|
|
|
|
|
</div>
|
2020-05-31 20:24:35 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2020-05-31 23:22:50 +02:00
|
|
|
|
|
|
|
itemClick() {
|
2020-06-01 19:09:32 +02:00
|
|
|
console.log("item clicked!" + this.state.name);
|
2020-05-31 23:22:50 +02:00
|
|
|
|
2020-06-21 23:08:46 +02:00
|
|
|
this.props.viewbinding.changeRootElement(
|
|
|
|
<Player
|
|
|
|
viewbinding={this.props.viewbinding}
|
|
|
|
movie_id={this.props.movie_id}/>);
|
2020-05-31 23:22:50 +02:00
|
|
|
}
|
2020-05-31 20:24:35 +02:00
|
|
|
}
|
|
|
|
|
2020-06-07 15:48:27 +02:00
|
|
|
export class TagPreview extends React.Component {
|
|
|
|
render() {
|
2020-08-05 22:00:55 +02:00
|
|
|
const themeStyle = GlobalInfos.getThemeStyle();
|
2020-06-07 15:48:27 +02:00
|
|
|
return (
|
2020-08-03 23:31:43 +00:00
|
|
|
<div className={style.videopreview + ' ' + style.tagpreview + ' ' + themeStyle.secbackground + ' '+ themeStyle.preview} onClick={() => this.itemClick()}>
|
|
|
|
<div className={style.tagpreviewtitle + ' ' + themeStyle.lighttextcolor}>
|
2020-06-07 21:42:01 +02:00
|
|
|
{this.props.name}
|
2020-06-07 15:48:27 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-06-07 21:42:01 +02:00
|
|
|
itemClick() {
|
2020-06-24 21:47:22 +02:00
|
|
|
this.props.categorybinding(this.props.name);
|
2020-06-07 15:48:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-31 20:24:35 +02:00
|
|
|
export default Preview;
|