implement thubnail loading from tmdb
fix lots of errors if ' char occurs in path strings correct reverse proxy for websocket
This commit is contained in:
@ -19,6 +19,12 @@ class DynamicContentContainer<T> extends React.Component<Props<T>, state<T>> {
|
||||
// stores current index of loaded elements
|
||||
loadindex: number = 0;
|
||||
|
||||
readonly InitialLoadNR = this.props.initialLoadNr
|
||||
? this.props.initialLoadNr === -1
|
||||
? this.props.data.length
|
||||
: this.props.initialLoadNr
|
||||
: 16;
|
||||
|
||||
constructor(props: Props<T>) {
|
||||
super(props);
|
||||
|
||||
@ -30,14 +36,14 @@ class DynamicContentContainer<T> extends React.Component<Props<T>, state<T>> {
|
||||
componentDidMount(): void {
|
||||
document.addEventListener('scroll', this.trackScrolling);
|
||||
|
||||
this.loadPreviewBlock(this.props.initialLoadNr ? this.props.initialLoadNr : 16);
|
||||
this.loadPreviewBlock(this.InitialLoadNR);
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: Props<T>): void {
|
||||
// when source props change force update!
|
||||
if (prevProps.data.length !== this.props.data.length) {
|
||||
this.clean();
|
||||
this.loadPreviewBlock(this.props.initialLoadNr ? this.props.initialLoadNr : 16);
|
||||
this.loadPreviewBlock(this.InitialLoadNR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ class EpisodePage extends React.Component<Props, State> {
|
||||
<DynamicContentContainer
|
||||
renderElement={(el): JSX.Element => <EpisodeTile key={el.ID} episode={el} />}
|
||||
data={this.episodes}
|
||||
initialLoadNr={-1}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import Preview from '../../elements/Preview/Preview';
|
||||
import {APINode, callAPI} from '../../utils/Api';
|
||||
import {APINode, callAPI, callAPIPlain} from '../../utils/Api';
|
||||
import {TVShow} from '../../types/ApiTypes';
|
||||
import DynamicContentContainer from '../../elements/DynamicContentContainer/DynamicContentContainer';
|
||||
import {Route, Switch, useRouteMatch} from 'react-router-dom';
|
||||
@ -33,11 +33,21 @@ class TVShowPage extends React.Component<Props, State> {
|
||||
<Preview
|
||||
key={elem.Id}
|
||||
name={elem.Name}
|
||||
picLoader={(callback): void => callback('')}
|
||||
picLoader={(callback: (pic: string) => void): void => {
|
||||
callAPIPlain(
|
||||
APINode.TVShow,
|
||||
{
|
||||
action: 'readThumbnail',
|
||||
Id: elem.Id
|
||||
},
|
||||
(result) => callback(result)
|
||||
);
|
||||
}}
|
||||
linkPath={'/tvshows/' + elem.Id}
|
||||
/>
|
||||
)}
|
||||
data={this.state.loading ? [] : this.data}
|
||||
initialLoadNr={20}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user